Skip to main content
POST
/
credentials
/
verify
Verify Credential
curl --request POST \
  --url https://api.example.com/credentials/verify \
  --header 'Content-Type: application/json' \
  --data '
{
  "verifiableCredential": {
    "@context": [
      "https://www.w3.org/2018/credentials/v1",
      "https://www.w3.org/2018/credentials/examples/v1"
    ],
    "id": "http://example.gov/credentials/3732",
    "type": [
      "VerifiableCredential",
      "UniversityDegreeCredential"
    ],
    "issuer": "did:example:123",
    "issuanceDate": "2020-03-16T22:37:26.544Z",
    "expirationDate": "2021-03-16T22:37:26.544Z",
    "credentialSubject": {
      "id": "did:example:123",
      "degree": {
        "type": "BachelorDegree",
        "name": "Bachelor of Science and Arts"
      }
    },
    "proof": {
      "type": "<string>",
      "created": "<string>",
      "verificationMethod": "<string>",
      "proofPurpose": "<string>",
      "jws": "<string>"
    }
  },
  "options": {
    "verificationMethod": "did:example:123#z6MksHh7qHWvybLg5QTPPdG2DgEjjduBDArV9EF9mRiRzMBN",
    "proofPurpose": "assertionMethod",
    "created": "2020-04-02T18:48:36Z",
    "challenge": "d436f0c8-fbd9-4e48-bbb2-55fc5d0920a8",
    "domain": "example.com"
  }
}
'
import requests

url = "https://api.example.com/credentials/verify"

payload = {
"verifiableCredential": {
"@context": ["https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/examples/v1"],
"id": "http://example.gov/credentials/3732",
"type": ["VerifiableCredential", "UniversityDegreeCredential"],
"issuer": "did:example:123",
"issuanceDate": "2020-03-16T22:37:26.544Z",
"expirationDate": "2021-03-16T22:37:26.544Z",
"credentialSubject": {
"id": "did:example:123",
"degree": {
"type": "BachelorDegree",
"name": "Bachelor of Science and Arts"
}
},
"proof": {
"type": "<string>",
"created": "<string>",
"verificationMethod": "<string>",
"proofPurpose": "<string>",
"jws": "<string>"
}
},
"options": {
"verificationMethod": "did:example:123#z6MksHh7qHWvybLg5QTPPdG2DgEjjduBDArV9EF9mRiRzMBN",
"proofPurpose": "assertionMethod",
"created": "2020-04-02T18:48:36Z",
"challenge": "d436f0c8-fbd9-4e48-bbb2-55fc5d0920a8",
"domain": "example.com"
}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
verifiableCredential: {
'@context': [
'https://www.w3.org/2018/credentials/v1',
'https://www.w3.org/2018/credentials/examples/v1'
],
id: 'http://example.gov/credentials/3732',
type: ['VerifiableCredential', 'UniversityDegreeCredential'],
issuer: 'did:example:123',
issuanceDate: '2020-03-16T22:37:26.544Z',
expirationDate: '2021-03-16T22:37:26.544Z',
credentialSubject: {
id: 'did:example:123',
degree: {type: 'BachelorDegree', name: 'Bachelor of Science and Arts'}
},
proof: {
type: '<string>',
created: '<string>',
verificationMethod: '<string>',
proofPurpose: '<string>',
jws: '<string>'
}
},
options: {
verificationMethod: 'did:example:123#z6MksHh7qHWvybLg5QTPPdG2DgEjjduBDArV9EF9mRiRzMBN',
proofPurpose: 'assertionMethod',
created: '2020-04-02T18:48:36Z',
challenge: 'd436f0c8-fbd9-4e48-bbb2-55fc5d0920a8',
domain: 'example.com'
}
})
};

fetch('https://api.example.com/credentials/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/credentials/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'verifiableCredential' => [
'@context' => [
'https://www.w3.org/2018/credentials/v1',
'https://www.w3.org/2018/credentials/examples/v1'
],
'id' => 'http://example.gov/credentials/3732',
'type' => [
'VerifiableCredential',
'UniversityDegreeCredential'
],
'issuer' => 'did:example:123',
'issuanceDate' => '2020-03-16T22:37:26.544Z',
'expirationDate' => '2021-03-16T22:37:26.544Z',
'credentialSubject' => [
'id' => 'did:example:123',
'degree' => [
'type' => 'BachelorDegree',
'name' => 'Bachelor of Science and Arts'
]
],
'proof' => [
'type' => '<string>',
'created' => '<string>',
'verificationMethod' => '<string>',
'proofPurpose' => '<string>',
'jws' => '<string>'
]
],
'options' => [
'verificationMethod' => 'did:example:123#z6MksHh7qHWvybLg5QTPPdG2DgEjjduBDArV9EF9mRiRzMBN',
'proofPurpose' => 'assertionMethod',
'created' => '2020-04-02T18:48:36Z',
'challenge' => 'd436f0c8-fbd9-4e48-bbb2-55fc5d0920a8',
'domain' => 'example.com'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/credentials/verify"

payload := strings.NewReader("{\n \"verifiableCredential\": {\n \"@context\": [\n \"https://www.w3.org/2018/credentials/v1\",\n \"https://www.w3.org/2018/credentials/examples/v1\"\n ],\n \"id\": \"http://example.gov/credentials/3732\",\n \"type\": [\n \"VerifiableCredential\",\n \"UniversityDegreeCredential\"\n ],\n \"issuer\": \"did:example:123\",\n \"issuanceDate\": \"2020-03-16T22:37:26.544Z\",\n \"expirationDate\": \"2021-03-16T22:37:26.544Z\",\n \"credentialSubject\": {\n \"id\": \"did:example:123\",\n \"degree\": {\n \"type\": \"BachelorDegree\",\n \"name\": \"Bachelor of Science and Arts\"\n }\n },\n \"proof\": {\n \"type\": \"<string>\",\n \"created\": \"<string>\",\n \"verificationMethod\": \"<string>\",\n \"proofPurpose\": \"<string>\",\n \"jws\": \"<string>\"\n }\n },\n \"options\": {\n \"verificationMethod\": \"did:example:123#z6MksHh7qHWvybLg5QTPPdG2DgEjjduBDArV9EF9mRiRzMBN\",\n \"proofPurpose\": \"assertionMethod\",\n \"created\": \"2020-04-02T18:48:36Z\",\n \"challenge\": \"d436f0c8-fbd9-4e48-bbb2-55fc5d0920a8\",\n \"domain\": \"example.com\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/credentials/verify")
.header("Content-Type", "application/json")
.body("{\n \"verifiableCredential\": {\n \"@context\": [\n \"https://www.w3.org/2018/credentials/v1\",\n \"https://www.w3.org/2018/credentials/examples/v1\"\n ],\n \"id\": \"http://example.gov/credentials/3732\",\n \"type\": [\n \"VerifiableCredential\",\n \"UniversityDegreeCredential\"\n ],\n \"issuer\": \"did:example:123\",\n \"issuanceDate\": \"2020-03-16T22:37:26.544Z\",\n \"expirationDate\": \"2021-03-16T22:37:26.544Z\",\n \"credentialSubject\": {\n \"id\": \"did:example:123\",\n \"degree\": {\n \"type\": \"BachelorDegree\",\n \"name\": \"Bachelor of Science and Arts\"\n }\n },\n \"proof\": {\n \"type\": \"<string>\",\n \"created\": \"<string>\",\n \"verificationMethod\": \"<string>\",\n \"proofPurpose\": \"<string>\",\n \"jws\": \"<string>\"\n }\n },\n \"options\": {\n \"verificationMethod\": \"did:example:123#z6MksHh7qHWvybLg5QTPPdG2DgEjjduBDArV9EF9mRiRzMBN\",\n \"proofPurpose\": \"assertionMethod\",\n \"created\": \"2020-04-02T18:48:36Z\",\n \"challenge\": \"d436f0c8-fbd9-4e48-bbb2-55fc5d0920a8\",\n \"domain\": \"example.com\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/credentials/verify")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"verifiableCredential\": {\n \"@context\": [\n \"https://www.w3.org/2018/credentials/v1\",\n \"https://www.w3.org/2018/credentials/examples/v1\"\n ],\n \"id\": \"http://example.gov/credentials/3732\",\n \"type\": [\n \"VerifiableCredential\",\n \"UniversityDegreeCredential\"\n ],\n \"issuer\": \"did:example:123\",\n \"issuanceDate\": \"2020-03-16T22:37:26.544Z\",\n \"expirationDate\": \"2021-03-16T22:37:26.544Z\",\n \"credentialSubject\": {\n \"id\": \"did:example:123\",\n \"degree\": {\n \"type\": \"BachelorDegree\",\n \"name\": \"Bachelor of Science and Arts\"\n }\n },\n \"proof\": {\n \"type\": \"<string>\",\n \"created\": \"<string>\",\n \"verificationMethod\": \"<string>\",\n \"proofPurpose\": \"<string>\",\n \"jws\": \"<string>\"\n }\n },\n \"options\": {\n \"verificationMethod\": \"did:example:123#z6MksHh7qHWvybLg5QTPPdG2DgEjjduBDArV9EF9mRiRzMBN\",\n \"proofPurpose\": \"assertionMethod\",\n \"created\": \"2020-04-02T18:48:36Z\",\n \"challenge\": \"d436f0c8-fbd9-4e48-bbb2-55fc5d0920a8\",\n \"domain\": \"example.com\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "checks": [
    "proof"
  ],
  "warnings": [],
  "errors": []
}

Body

application/json
verifiableCredential
object
required
options
object

Options for specifying how the LinkedDataProof is created.

Response

Verifiable Credential successfully verified!

checks
array[]
required

The checks performed

Example:
["proof"]
warnings
array[]
required

Warnings

Example:
[]
errors
array[]
required

Errors

Example:
[]