POST /credentials
Issue a new Verifiable Credential.
{{baseUrl}}/credentials
Headers
Header | Type | Description |
---|---|---|
x-api-key | string | The API key required for authentication. |
Request Body
Parameter | Type | Description |
---|---|---|
vcTemplate | string | The template used to create the Verifiable Credential. |
issuerDid | string | The DID of the issuer. |
userDid | string | The DID of the credential subject (user). |
isEncrypted | boolean | Flag to indicate if the credential subject should be encrypted. |
credentialSubject | object | Attributes and details about the credential subject. |
validity | integer | The 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)
Parameter | Type | Description |
---|---|---|
@context | array | The JSON-LD context of the Verifiable Credential. |
id | string | Unique identifier for the Verifiable Credential. |
type | array | The types associated with this Verifiable Credential. |
issuer | string | The DID of the entity issuing the credential. |
issuanceDate | string | The issuance date of the Verifiable Credential. |
expirationDate | string | The expiration date of the Verifiable Credential. |
credentialSubject | array | The subject details of the Verifiable Credential. |
proof | object | The 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)
Parameter | Type | Description |
---|---|---|
error | string | Describes the error that occurred. |
Sample Response Body:
{
"error": "Server error"
}