Skip to main content
Version: v0.10.0

Import credential

POST 

/api/management/credentials/import

Import a credential issued by an external credential issuer

Request

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
    idstringrequired
    Example: did:example:subject-1
    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
    property name*any
    Example: {"type":"DocumentVerification","verifier":"did:example:verifier"}
    credentialStatus object
    oneOf
    @contextstring[]required
    Example: ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"]
    typestringrequired
    Example: CredentialStatus
    issuerPidstringrequired
    holderPidstringrequired
    statusstringrequired

    Possible values: [RECEIVED, REJECTED, ISSUED]

    proof object[]required
  • Array [
  • typestringrequired

    Possible values: [JsonWebSignature2020, DataIntegrityProof]

    Example: JsonWebSignature2020
    proofPurposestringrequired
    Example: assertionMethod
  • ]

Responses

Schema
    idstringrequired

    Unique identifier of the credential record

    Example: b86483f3-3792-4a54-b11e-f1c6face9935
    targetDidstringrequired

    Target decentralized identifier

    Example: did:example:456
    credential object

    The verifiable credential object

    @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
    idstringrequired
    Example: did:example:subject-1
    property name*any
    Example: {"id":"did:example:subject-1","customProp":"value"}
    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
    property name*any
    Example: {"type":"DocumentVerification","verifier":"did:example:verifier"}
    credentialStatus object
    oneOf
    @contextstring[]required
    Example: ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"]
    typestringrequired
    Example: CredentialStatus
    issuerPidstringrequired
    holderPidstringrequired
    statusstringrequired

    Possible values: [RECEIVED, REJECTED, ISSUED]

    proof object[]required
  • Array [
  • typestringrequired

    Possible values: [JsonWebSignature2020, DataIntegrityProof]

    Example: JsonWebSignature2020
    proofPurposestringrequired
    Example: assertionMethod
  • ]
  • 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

Authorization: oauth2

name: oauth2type: oauth2scopes: wallet_view_all_credentials,wallet_view_own_credentialsflows: {
  "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_credentialsflows: {
  "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 -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"
}
]
}'
Request Collapse all
Auth
Body required
{
  "@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"
    }
  ]
}