POST /vc-templates
Create a new Verifiable Credential Template.
{{baseUrl}}/vc-templates
Headers
Header | Type | Description |
---|---|---|
x-api-key | string | The API key required for authentication. |
Request Body Parameters
Parameter | Type | Description |
---|---|---|
templateName | string | The name of the template (e.g., "DegreeSample"). |
description | string | A description of the template. |
issuer | string | The DID of the issuer authorized to issue credentials. |
attributes | array | An array of attributes that define the credential. |
attributeName | string | The name of each attribute (e.g., "degree"). |
type | string | The data type of each attribute (e.g., "string"). |
expiration | object | The expiration settings of the credential template. |
expiration.value | number | The number of units for expiration (e.g., 5). |
expiration.unit | string | The unit of time for expiration (e.g., "years"). |
Sample Request Body:
{
"templateName": "DegreeSample",
"description": "Schema for degree certificate template",
"issuer": "did:earthid:testnet:7QFmnthxqyJVmdBC8WbMtVrfEfenMbVAw3JWYC4kmkYu",
"attributes": [
{
"attributeName": "degree",
"type": "string",
"description": "Degree Name"
},
{
"attributeName": "dateOfBirth",
"type": "string",
"description": "Date of Birth"
},
{
"attributeName": "city",
"type": "string",
"description": "City of University"
}
],
"expiration": {
"value": 5,
"unit": "years"
}
}
Click Send
and wait for the response.
Response (Success - 201)
Parameter | Type | Description |
---|---|---|
templateId | string | The unique identifier for the Verifiable Credential template. |
name | string | The name of the Verifiable Credential template. |
description | string | A description of the Verifiable Credential template. |
context | array | An array that defines the JSON-LD context for the template. |
type | array | The type of Verifiable Credential. |
issuer | string | The DID of the issuer authorized to issue the credential. |
issuanceDate | string | The date when the credential was issued. |
expirationDate | string | The date when the credential expires. |
credentialSubject | array | An array of attributes that define the credential subject. |
_id | string | The unique ID of the template in the system. |
__v | number | The version key for the document. |
Sample Response Body:
{
"templateId": "a752d4e1-7279-44f1-baa9-cce36995ad7e",
"name": "DegreeSample",
"description": "Schema for degree certificate template",
"context": [
"https://www.w3.org/2018/credentials/v1"
],
"type": [
"VerifiableCredential",
"DegreeSample"
],
"issuer": "did:earthid:testnet:7QFmnthxqyJVmdBC8WbMtVrfEfenMbVAw3JWYC4kmkYu",
"issuanceDate": "2024-10-19T07:22:43.740Z",
"expirationDate": "2029-10-19T07:22:43.740Z",
"credentialSubject": [
{
"attributeName": "degree",
"type": "string",
"description": "Degree Name"
},
{
"attributeName": "dateOfBirth",
"type": "string",
"description": "Date of Birth"
},
{
"attributeName": "city",
"type": "string",
"description": "City of University"
}
],
"_id": "67135e43904a633605cca093",
"__v": 0
}
Response (Server Error - 500)
Parameter | Type | Description |
---|---|---|
error | string | Describes the error that occurred. |
Sample Response Body:
{
"error": "Server error"
}