> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify Credential

> Verify that a verifiable credential is valid.

**API scope required** `credentials.read`


<Snippet file="alpha-api-note.mdx" />

<Warning>
  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.
</Warning>

Here is an example of how to verify a credential using javascript:

```javascript verifyVC.js theme={null}
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));
```

<ResponseExample>
  ```json 200 valid theme={null}
  {
      "isValid": true,
      "error": null
  }
  ```

  ```json 200 revoked theme={null}
  {
      "isValid": false,
      "error": "Credential Revoked"
  }
  ```

  ```json 200 expired theme={null}
  {
      "isValid": false,
      "error": "Credential expired at <date>"
  }
  ```

  ```json 200 invalid_proof theme={null}
  {
      "isValid": false,
      "error": "Invalid proof"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml post /v1-alpha1/credentials/verification/verify
openapi: 3.0.1
info:
  description: N/A
  version: 1.0.0
  title: Verifiable Credentials
  contact:
    name: Crossmint Verifiable Credentials APIs
    url: https://www.crossmint.com
    email: support@crossmint.com
servers:
  - url: https://staging.crossmint.com/api
    description: Staging environment (testnets)
  - url: https://www.crossmint.com/api
    description: Production environment (mainnets)
security:
  - apiKey: []
paths:
  /v1-alpha1/credentials/verification/verify:
    post:
      tags:
        - Verifiable Credentials
      summary: Verify Credential
      description: |
        Verify that a verifiable credential is valid.

        **API scope required** `credentials.read`
      operationId: verify-credential
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                credential:
                  description: The JSON representing a credential.
                  type: object
              required:
                - credential
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  isValid:
                    type: boolean
                    example: true/false
                  error:
                    type: string
                    nullable: true
                    example: null / "error message"
              examples:
                valid:
                  description: Valid credential
                  value:
                    isValid: true
                    error: null
                invalid revoked:
                  description: Revoked credential
                  value:
                    isValid: false
                    error: Credential Revoked
                invalid expired:
                  description: Credential expired
                  value:
                    isValid: false
                    error: Credential expired at <date>
                invalid proof:
                  description: Invalid proof
                  value:
                    isValid: false
                    error: Invalid proof
        '400':
          description: Bad Request
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Key obtained from the Crossmint developer console, reflecting the API
        scope granted.

````