Skip to main content

POST /credentials

Issue a new Verifiable Credential.

{{baseUrl}}/credentials

Headers

HeaderTypeDescription
x-api-keystringThe API key required for authentication.

Request Body

ParameterTypeDescription
vcTemplatestringThe template used to create the Verifiable Credential.
issuerDidstringThe DID of the issuer.
userDidstringThe DID of the credential subject (user).
isEncryptedbooleanFlag to indicate if the credential subject should be encrypted.
credentialSubjectobjectAttributes and details about the credential subject.
validityintegerThe validity period of the credential, in years.

Sample Request Body:

{
"vcTemplate": "DegreeCredential",
"issuerDid": "did:earthid:testnet:HwetGVKwLAu12HRZaCKcMxdijsjxdSc7Lw1KSzC6FYDR:0.0.5021630",
"userDid": "did:earthid:testnet:CqfgWPDd67TBe3wieHhhD9y9M6AderRRJnozU12DdP2t:0.0.5021687",
"isEncrypted": false,
"credentialSubject": {
"degree": "Bachelor of Computer Science",
"dateOfBirth": "01-01-2000",
"city": "Delhi"
},
"validity": "5"
}

Click Send and wait for the response.

Response (Success - 201)

ParameterTypeDescription
@contextarrayThe JSON-LD context of the Verifiable Credential.
idstringUnique identifier for the Verifiable Credential.
typearrayThe types associated with this Verifiable Credential.
issuerstringThe DID of the entity issuing the credential.
issuanceDatestringThe issuance date of the Verifiable Credential.
expirationDatestringThe expiration date of the Verifiable Credential.
credentialSubjectarrayThe subject details of the Verifiable Credential.
proofobjectThe cryptographic proof for this credential.

Sample Response Body:

{
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"id": "DegreeCredential8fa09780-23b2-4b9c-a7b5-c9d292fd9826",
"type": [
"VerifiableCredential",
"DegreeCredential"
],
"version": "DegreeCredential",
"credentialSchema": {
"id": "http://ssi-stage.myearth.id/schema/DegreeCredential",
"type": "JsonSchemaValidator2018"
},
"issuer": "did:earthid:testnet:HwetGVKwLAu12HRZaCKcMxdijsjxdSc7Lw1KSzC6FYDR:0.0.5021630",
"credentialSubject": [
{
"id": "did:earthid:testnet:CqfgWPDd67TBe3wieHhhD9y9M6AderRRJnozU12DdP2t:0.0.5021687",
"degree": "Bachelor of Computer Science",
"dateOfBirth": "01-01-2000",
"city": "Delhi"
}
],
"issuanceDate": "2024-10-23T10:03:50.676Z",
"expirationDate": "+020245-10-23T10:03:50.676Z",
"proof": {
"type": "HederaConsensusProof",
"creator": "did:earthid:testnet:HwetGVKwLAu12HRZaCKcMxdijsjxdSc7Lw1KSzC6FYDR:0.0.5021630",
"created": "2024-10-23T10:03:50.676Z"
}
}

Response (Server Error - 500)

ParameterTypeDescription
errorstringDescribes the error that occurred.

Sample Response Body:

{
"error": "Server error"
}