Verify Credential
curl --request POST \
--url https://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"credential": {}
}
'import requests
url = "https://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify"
payload = { "credential": {} }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({credential: {}})
};
fetch('https://staging.crossmint.com/api/v1-alpha1/credentials/verification/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://staging.crossmint.com/api/v1-alpha1/credentials/verification/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([
'credential' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify"
payload := strings.NewReader("{\n \"credential\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"credential\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credential\": {}\n}"
response = http.request(request)
puts response.read_body{
"isValid": true,
"error": null
}
{
"isValid": false,
"error": "Credential Revoked"
}
{
"isValid": false,
"error": "Credential expired at <date>"
}
{
"isValid": false,
"error": "Invalid proof"
}
Verifiable Credentials
Verify Credential
Verify that a verifiable credential is valid.
API scope required credentials.read
POST
/
v1-alpha1
/
credentials
/
verification
/
verify
Verify Credential
curl --request POST \
--url https://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"credential": {}
}
'import requests
url = "https://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify"
payload = { "credential": {} }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({credential: {}})
};
fetch('https://staging.crossmint.com/api/v1-alpha1/credentials/verification/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://staging.crossmint.com/api/v1-alpha1/credentials/verification/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([
'credential' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify"
payload := strings.NewReader("{\n \"credential\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"credential\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credential\": {}\n}"
response = http.request(request)
puts response.read_body{
"isValid": true,
"error": null
}
{
"isValid": false,
"error": "Credential Revoked"
}
{
"isValid": false,
"error": "Credential expired at <date>"
}
{
"isValid": false,
"error": "Invalid proof"
}
This is an alpha API and subject to change.
It is impractical to use the API Playground to verify a credential. Instead you can copy the sample code for your
preferred language in the righthand sidebar and fill in the JSON of the credential you intend to verify.
verifyVC.js
const options = {
method: "POST",
headers: {
"X-API-KEY": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: '{"credential": {"id":"urn:uuid:e31316b6-3be1-49af-a95f-c7f4c3f52aa1","credentialSubject":{"course":"Blockchain 101","passed":true,"id":"did:polygon:0x6C3b3225759Cbda68F96378A9F0277B4374f9F06"},"expirationDate":"2034-02-03","nft":{"tokenId":"1","chain":"polygon","contractAddress":"0xdC444A3F4768185497Dae6250E2F348b99bE89F3"},"issuer":{"id":"did:polygon:0xa22CaDEdE67c11dc1444E507fDdd9b831a67aBd1"},"type":["VerifiableCredential","65c15243e9bee8deac219d57"],"issuanceDate":"2024-02-05T23:21:32.641Z","@context":["https://www.w3.org/2018/credentials/v1","https://github.com/haardikk21/ethereum-eip712-signature-2021-spec/blob/main/index.html","DUMMY_CROSSMINT/65c15243e9bee8deac219d57"],"proof":{"verificationMethod":"did:polygon:0xa22CaDEdE67c11dc1444E507fDdd9b831a67aBd1#ethereumAddress","ethereumAddress":null,"created":"2024-02-05T23:22:24.058Z","proofPurpose":"assertionMethod","type":"EthereumEip712Signature2021","proofValue":"0x748a55d9770cbc6ef16689f0d9547355e288bcce03a8949a32d2aac59244cb9e08cbf54c960bc00d133fc51e6651a4ac1366aeda320dd121777118a4e74980631b","eip712":{"domain":{"name":"Krebit","version":"0.1","chainId":4,"verifyingContract":"0xD8393a735e8b7B6E199db9A537cf27C61Aa74954"},"types":{"VerifiableCredential":[{"name":"@context","type":"string[]"},{"name":"type","type":"string[]"},{"name":"id","type":"string"},{"name":"issuer","type":"Issuer"},{"name":"credentialSubject","type":"CredentialSubject"},{"name":"issuanceDate","type":"string"},{"name":"expirationDate","type":"string"},{"name":"nft","type":"Nft"}],"CredentialSubject":[{"name":"id","type":"string"},{"name":"course","type":"string"},{"name":"passed","type":"bool"}],"Issuer":[{"name":"id","type":"string"}],"Nft":[{"name":"tokenId","type":"string"},{"name":"contractAddress","type":"string"},{"name":"chain","type":"string"}]},"primaryType":"VerifiableCredential"}}}}',
};
// note the gigantic VC JSON string in the body property
fetch("https://staging.crossmint.com/api/v1-alpha1/credentials/verification/verify", options)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
{
"isValid": true,
"error": null
}
{
"isValid": false,
"error": "Credential Revoked"
}
{
"isValid": false,
"error": "Credential expired at <date>"
}
{
"isValid": false,
"error": "Invalid proof"
}
Authorizations
Key obtained from the Crossmint developer console, reflecting the API scope granted.
Body
application/json
The JSON representing a credential.
Was this page helpful?
⌘I

