POST /create-vp
Create a new Verifiable Presentation from the provided Verifiable Credentials (VCs).
{{baseUrl}}/create-vp
Headers
Header | Type | Description |
---|---|---|
x-api-key | string | The API key required for authentication. |
Request Body
Parameter | Type | Description |
---|---|---|
vcs | array | An array of Verifiable Credentials (VCs) to be included in the Verifiable Presentation. |
holder | string | DID of the holder creating the Verifiable Presentation. |
selectedAttributes | object | Specifies the attributes from the VCs to be included in the presentation. |
privateKey | string | Private key used for signing the Verifiable Presentation. |
Sample Request Body:
{
"vcs": [
{
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"id": "DegreeCredential-19c30c4c-8772-4218-94d2-cb66b87c2253",
"type": [
"VerifiableCredential",
"DegreeCredential"
],
"issuer": "did:earthid:testnet:A5kd3bvBdNKv5ucwxnbgqV7Jr5UJi1Hmho3qnKw7Kfom",
"issuanceDate": "2024-10-19T09:39:00.001Z",
"expirationDate": "+020245-10-19T09:39:00.001Z",
"credentialSubject": [
{
"id": "did:earthid:testnet:DLoz9cZjsq1TezAZZZ5JZRe64Dsqb2w1wgq6Evyewurr",
"degreeName": "Bachelor of Computer Science",
"dateOfBirth": "01-01-2000",
"city": "Delhi"
}
],
"proof": {
"type": "Ed25519Signature2018",
"created": "2024-10-19T09:39:00.001Z",
"proofPurpose": "assertionMethod",
"jws": "eyJjcml0IjpbImI2NCJdLCJiNjQiOmZhbHNlLCJhbGciOiJFZERTQSJ9..ODI4YzY2MzFlMmFjNDBmZDk4NjgwYmNlMGQyNWZkMjU1NzA3M2FlODQyYjg2ZTQ3MGY4NTk1MGMyNzIwMTY1ZDBmYWZlYjgwZDE3NzQ0ODFhZDhlYTYxYjdhMGExMjQ2OWZkODIxYTdiNzYwNDUxMTkwZTAxMDgwNDEyYTAzMDA="
}
}
],
"holder": "did:earthid:testnet:DLoz9cZjsq1TezAZZZ5JZRe64Dsqb2w1wgq6Evyewurr",
"selectedAttributes": {
"DegreeCredential-19c30c4c-8772-4218-94d2-cb66b87c2253": [
"city"
]
},
"privateKey": "59a85d6d233ffaf32d25d801dfb83a63dd9d6635ff2b8654b589f827bf95304f"
}
Click Send
and wait for the response.
Response (Success - 200)
Parameter | Type | Description |
---|---|---|
vpToken | object | The Verifiable Presentation token created from the provided VCs. |
vpToken.verifiableCredential | array | The list of Verifiable Credentials included in the presentation. |
vpToken.holder | string | The DID of the holder of the presentation. |
vpToken.presentationAttributes | object | Attributes selected from the VCs to be included in the presentation. |
vpToken.proof | object | The proof of the Verifiable Presentation, including the signature. |
Sample Response Body:
{
"vpToken": {
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"type": [
"VerifiablePresentation"
],
"verifiableCredential": [
{
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"id": "DegreeCredential-19c30c4c-8772-4218-94d2-cb66b87c2253",
"type": [
"VerifiableCredential",
"DegreeCredential"
],
"issuer": "did:earthid:testnet:A5kd3bvBdNKv5ucwxnbgqV7Jr5UJi1Hmho3qnKw7Kfom",
"issuanceDate": "2024-10-19T09:39:00.001Z",
"expirationDate": "+020245-10-19T09:39:00.001Z",
"credentialSubject": [
{
"city": "Delhi"
}
],
"proof": {
"type": "Ed25519Signature2018",
"created": "2024-10-19T09:39:00.001Z",
"proofPurpose": "assertionMethod",
"jws": "eyJjcml0IjpbImI2NCJdLCJiNjQiOmZhbHNlLCJhbGciOiJFZERTQSJ9..ODI4YzY2MzFlMmFjNDBmZDk4NjgwYmNlMGQyNWZkMjU1NzA3M2FlODQyYjg2ZTQ3MGY4NTk1MGMyNzIwMTY1ZDBmYWZlYjgwZDE3NzQ0ODFhZDhlYTYxYjdhMGExMjQ2OWZkODIxYTdiNzYwNDUxMTkwZTAxMDgwNDEyYTAzMDA="
}
}
],
"holder": "did:earthid:testnet:DLoz9cZjsq1TezAZZZ5JZRe64Dsqb2w1wgq6Evyewurr",
"presentationAttributes": {
"DegreeCredential-19c30c4c-8772-4218-94d2-cb66b87c2253": [
"city"
]
},
"issuanceDate": "2024-10-19T11:26:27.900Z",
"proof": {
"type": "EcdsaSecp256k1Signature2019",
"created": "2024-10-19T11:26:27.920Z",
"verificationMethod": "did:earthid:testnet:DLoz9cZjsq1TezAZZZ5JZRe64Dsqb2w1wgq6Evyewurr",
"signatureValue": "304602210099258925cfd3349ae4786ea3cef7e09e34020cc42d4cd2b34b703424b1008fe502210089001f04111316c700ea8515ad7cd4d2c941e54c31471f57994bf04229223566"
}
}
}
Response (Server Error - 500)
Parameter | Type | Description |
---|---|---|
error | string | Describes the error that occurred. |
Sample Response Body:
{
"error": "Server error"
}