light-mode-image
Learn
API Reference

Issuance

Sign a JSON credential

Sign a JSON credential

Returns a signed JSON credential generated from a provided valid payload.

Analytic events

  • CREDENTIAL_WEB_SEMANTIC_SIGN_START
  • CREDENTIAL_WEB_SEMANTIC_SIGN_SUCCESS
  • CREDENTIAL_WEB_SEMANTIC_SIGN_FAIL
POST/v2/credentials/web-semantic/sign
AuthorizationBearer <token>

In: header

JSON credential payload to sign

payloadobject
proofType?string

This is an optional field which defines the cryptographic algorithm used to sign the credential. The credential Issuer's DID must contain a key that supports the corresponding signing capability. If no proofType is provided, the credential will be signed using the key that is available in the Issuer's DID:

  • If a Bls12381G2 key is available, the credential will be signed with a BbsSignature2022 proof. Credentials signed with this proof type support selective disclosure.
  • If a Bls12381G2 key is unavailable but a Ed25519 key is available, the credential will be signed with a Ed25519Signature2018 proof. Credentials signed with this proof type do not support selective disclosure.
  • If none of the two suitable keys are available, the request will be rejected and the credential will not be created.
Value in"Ed25519Signature2018" | "BbsSignature2022"
tag?string

Insert a case sensitive tag to reference this credential. The gets stored as part of the credential metadata and can be used to search for it in the credential registry.

Length1 <= length <= 1024
persist?boolean

When set to true, both the credential and the credential metadata are stored in the credential registry. When set to false, only the following metadata is stored in the credential registry:

  • id
  • tag
  • credentialStatus
  • issuanceDate ℹ️ Note: Credentials by nature tend to hold Personally Identifying Information (PII). Before storing credential data, familiarize yourself with compliance to any PII restrictions that may apply to your use-case.
Defaultfalse
revocable?boolean

When set to true, the created credential can later be revoked. When set to false, the credential cannot be revoked. When set to true, https://w3id.org/vc-revocation-list-2020/v1 is injected into the credential @context object when it is issued. This references the JSON-LD definition of the credentialStatus object.

Defaultfalse
curl -X POST "https://example.vii.au01.mattr.global/v2/credentials/web-semantic/sign" \  -H "Content-Type: application/json" \  -d '{    "payload": {      "type": [        "EducationalOccupationalCredential",        "AlumniCredential"      ],      "credentialSubject": {        "id": "did:example:abcdb1f712ebc6f1c276e12ec21",        "givenName": "Jamie",        "familyName": "Doe",        "alumniOf": "<span lang=\"en\">Example University</span>"      },      "issuer": {        "id": "did:issuer:abcdb1f712ebc6f1c276e12ec21",        "name": "ABC University"      }    }  }'
{
  "id": "873277c0-a162-11ea-8a1d-a111119347e6",
  "credential": {
    "@context": [
      "https://www.w3.org/2018/credentials/v1",
      "https://mattr.global/contexts/vc-extensions/v2",
      "https://w3id.org/vc-revocation-list-2020/v1",
      "https://optionalschema.example/"
    ],
    "type": [
      "VerifiableCredential",
      "AlumniCredential"
    ],
    "issuer": "string",
    "issuanceDate": "2020-05-02T12:06:29.156Z",
    "credentialStatus": {
      "id": "https://tenant.vii.mattr.global/v1/revocation-lists/cc641396-3750-43c8-b8b8-f30d74eb3fb3#1",
      "type": "RevocationList2020Status",
      "revocationListIndex": 1,
      "revocationListCredential": "https://tenant.vii.mattr.global/v1/revocation-lists/cc641396-3750-43c8-b8b8-f30d74eb3fb3"
    },
    "credentialSubject": {
      "givenName": "Jamie",
      "familyName": "Doe",
      "alumniOf": "Example University"
    },
    "proof": {
      "type": "Ed25519Signature2018",
      "created": "2020-05-02T12:06:29Z",
      "jws": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
      "proofPurpose": "assertionMethod",
      "verificationMethod": "did:web:organization.com"
    },
    "name": "Alumni Credential",
    "description": "This credential shows that the person has attended the mentioned university."
  },
  "tag": "identifier123",
  "credentialStatus": {
    "id": "https://tenant.vii.mattr.global/v1/revocation-lists/cc641396-3750-43c8-b8b8-f30d74eb3fb3#1",
    "type": "RevocationList2020Status",
    "revocationListIndex": 1,
    "revocationListCredential": "https://tenant.vii.mattr.global/v1/revocation-lists/cc641396-3750-43c8-b8b8-f30d74eb3fb3"
  },
  "issuanceDate": "2020-05-02T12:06:29.156Z"
}
{
  "code": "string",
  "message": "string",
  "details": [
    {
      "value": "string",
      "msg": "Invalid value",
      "param": "id",
      "location": "body"
    }
  ]
}

How would you rate this page?