Import credential
POST/api/management/credentials/import
Import a credential issued by an external credential issuer
Request
- application/json
Bodyrequired
@contextstring[]required
Possible values: [https://www.w3.org/2018/credentials/v1
, https://www.w3.org/ns/credentials/v2
, https://w3id.org/security/suites/jws-2020/v1
, https://w3id.org/security/data-integrity/v2
, string
]
Example:
["https://www.w3.org/2018/credentials/v1"]
typestring[]required
Example:
["VerifiableCredential","TestCredential"]
idstring
Example:
http://example.edu/credentials/1872
credentialSubject objectrequired
issuerstringrequired
Example:
did:example:issuer
issuanceDatestring
Example:
2020-01-01T00:00:00Z
expirationDatestring
Example:
2030-01-01T00:00:00Z
validFromstring
Example:
2020-01-01T00:00:00Z
validUntilstring
Example:
2030-01-01T00:00:00Z
evidence object
credentialStatus object
proof object[]required
Responses
- 200
- 403
- 409
- application/json
- Schema
- Example (auto)
Schema
idstringrequired
Unique identifier of the credential record
Example:
b86483f3-3792-4a54-b11e-f1c6face9935
targetDidstringrequired
Target decentralized identifier
Example:
did:example:456
credential object
selfIssuedbooleanrequired
If the credential is self issued
Example:
true
revokedbooleanrequired
Indicates if the credential has been revoked
Example:
false
statusListIndexnumber
Optional status list index
Example:
0
createdDatedate-timerequired
Creation timestamp
Example:
2023-10-01T00:00:00Z
modifiedDatedate-timerequired
Modification timestamp
Example:
2023-10-02T00:00:00Z
deletedDatedate-time
Optional deletion timestamp
Example:
2023-10-03T00:00:00Z
{
"id": "b86483f3-3792-4a54-b11e-f1c6face9935",
"targetDid": "did:example:456",
"credential": {
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"type": [
"VerifiableCredential",
"DataSpaceCredential"
],
"issuer": "did:example:issuer",
"issuanceDate": "2023-10-01T00:00:00Z",
"credentialSubject": {
"id": "did:example:subject"
}
},
"selfIssued": true,
"revoked": false,
"statusListIndex": 0,
"createdDate": "2023-10-01T00:00:00Z",
"modifiedDate": "2023-10-02T00:00:00Z",
"deletedDate": "2023-10-03T00:00:00Z"
}
Forbidden
- application/json
- Schema
- Example (auto)
Schema
namestringrequired
Example:
ResourceNotFound
statusstringrequired
Example:
404 Not Found
codenumberrequired
Example:
404
messageobject
Example:
The requested resource does not exist.
errorstring
Example:
Not Found
{
"name": "ResourceNotFound",
"status": "404 Not Found",
"code": 404,
"message": "The requested resource does not exist.",
"error": "Not Found"
}
Resource already exists
- application/json
- Schema
- Example (auto)
Schema
namestringrequired
Example:
ResourceNotFound
statusstringrequired
Example:
404 Not Found
codenumberrequired
Example:
404
messageobject
Example:
The requested resource does not exist.
errorstring
Example:
Not Found
{
"name": "ResourceNotFound",
"status": "404 Not Found",
"code": 404,
"message": "The requested resource does not exist.",
"error": "Not Found"
}
Authorization: oauth2
name: oauth2type: oauth2scopes:wallet_view_all_credentials,wallet_view_own_credentials
flows: { "password": { "scopes": { "wallet_view_did": "wallet_view_did", "wallet_manage_keys": "wallet_manage_keys", "wallet_use_keys": "wallet_use_keys", "wallet_view_own_credentials": "wallet_view_own_credentials", "wallet_view_all_credentials": "wallet_view_all_credentials", "wallet_manage_own_credentials": "wallet_manage_own_credentials", "wallet_manage_all_credentials": "wallet_manage_all_credentials", "wallet_issue_credentials": "wallet_issue_credentials", "wallet_view_presentations": "wallet_view_presentations" } } }
name: oauth2type: oauth2scopes:wallet_manage_all_credentials,wallet_manage_own_credentials
flows: { "password": { "scopes": { "wallet_view_did": "wallet_view_did", "wallet_manage_keys": "wallet_manage_keys", "wallet_use_keys": "wallet_use_keys", "wallet_view_own_credentials": "wallet_view_own_credentials", "wallet_view_all_credentials": "wallet_view_all_credentials", "wallet_manage_own_credentials": "wallet_manage_own_credentials", "wallet_manage_all_credentials": "wallet_manage_all_credentials", "wallet_issue_credentials": "wallet_issue_credentials", "wallet_view_presentations": "wallet_view_presentations" } } }
- curl
- http
- CURL
curl -L 'https://tsg.dataspac.es/api/management/credentials/import' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <token>' \
-H 'Authorization: Bearer <token>' \
--data-raw '{
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"type": [
"VerifiableCredential",
"TestCredential"
],
"id": "http://example.edu/credentials/1872",
"credentialSubject": {
"id": "did:example:subject-1",
"customProp": "value"
},
"issuer": "did:example:issuer",
"issuanceDate": "2020-01-01T00:00:00Z",
"expirationDate": "2030-01-01T00:00:00Z",
"validFrom": "2020-01-01T00:00:00Z",
"validUntil": "2030-01-01T00:00:00Z",
"evidence": {
"type": "DocumentVerification",
"verifier": "did:example:verifier"
},
"credentialStatus": {
"@context": [
"https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"
],
"type": "CredentialStatus",
"issuerPid": "string",
"holderPid": "string",
"status": "RECEIVED"
},
"proof": [
{
"type": "JsonWebSignature2020",
"created": "2020-01-01T00:00:00Z",
"proofPurpose": "assertionMethod",
"jws": "eyJhbGciOiJFUzI1NiIsInR5cCI...",
"verificationMethod": "did:example:123456#key-1"
}
]
}'