# Issue a Verifiable Credential

Using the `/credential/create` API, it is possible to issue Verifiable Credentials, signed by a cheqd DID, in a few clicks or lines of code.&#x20;

## Step 1: Set up your account

Make sure you have set up your account with cheqd Studio and are logged in, using our guide below:

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Set Up Your Account</strong></mark></td><td>Set up your account with <strong>cheqd Studio</strong> and log in to start using the APIs.</td><td><a href="../../getting-started/studio/set-up-account">set-up-account</a></td></tr></tbody></table>

## Step 2: Create an Issuer DID

Before you can issue a Verifiable Credential, you need to create an Issuer DID which is used to sign the Credential payload. Use the API in the page below to create an Issuer DID:

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Create an Issuer DID</strong></mark></td><td>Create a W3C conformant DID on cheqd using the <code>did:cheqd</code> DID Method.</td><td><a href="../dids/create-did">create-did</a></td></tr></tbody></table>

## (Optional) Step 3: Create a Subject DID

Again, before you issue a Verifiable Credential, you need to know to whom you are issuing it. If you need to create a Subject DID, you can take a look at the page here:

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Create a Subject DID</strong></mark></td><td>Create an off-ledger <code>did:key</code> or <code>did:vda</code> Subject DID to receive a Verifiable Credential.</td><td><a href="../dids/create-subject-did">create-subject-did</a></td></tr><tr><td><mark style="color:blue;"><strong>Setup Verida Wallet</strong></mark></td><td>Learn about setting up your Verida wallet to receive a <code>did:vda</code> address.</td><td><a href="verida">verida</a></td></tr></tbody></table>

{% hint style="info" %}
It is also possible to use a `did:cheqd`  DID for holders and subjects, but this is only recommended when the holder is not a natural person (e.g. is an AI Agent, organisation or object).
{% endhint %}

## Step 4: Compile your Credential body

Within the JSON object of the API request, you will need to input the `issuer` and `subject` information, as well as the `attributes` which you want to issue in the Credential. You may also want to add additional fields such as a `credentialSchema`.

## Issue a Verifiable Credential

> This endpoint issues a Verifiable Credential. As input it takes the list of issuerDid, subjectDid, attributes, and other parameters of the credential to be issued.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"Verifiable Credentials"}],"servers":[{"url":"https://studio-api.cheqd.net","description":"Main (production) server"},{"url":"https://studio-api-staging.cheqd.net","description":"Staging server for testing"},{"url":"http://localhost:3000","description":"Local server for testing"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"x-api-key","in":"header"}},"schemas":{"CredentialRequest":{"description":"Input fields for the creating a Verifiable Credential.","type":"object","additionalProperties":false,"properties":{"issuerDid":{"description":"DID of the Verifiable Credential issuer. This needs to be a `did:cheqd` DID.","type":"string"},"subjectDid":{"description":"DID of the Verifiable Credential holder/subject. This needs to be a `did:key` DID.","type":"string"},"attributes":{"description":"JSON object containing the attributes to be included in the credential.","type":"object"},"@context":{"description":"Optional properties to be included in the `@context` property of the credential.","type":"array","items":{"type":"string"}},"type":{"description":"Optional properties to be included in the `type` property of the credential.","type":"array","items":{"type":"string"}},"expirationDate":{"description":"Optional expiration date according to the <a href=https://www.w3.org/TR/vc-data-model/#expiration> VC Data Model specification</a>.","type":"string","format":"date-time"},"format":{"description":"Format of the Verifiable Credential. Defaults to VC-JWT.","type":"string","enum":["jwt","jsonld"]},"credentialStatus":{"description":"Optional `credentialStatus` properties for VC revocation or suspension. Takes `statusListName` and `statusListPurpose` as inputs.","type":"object","required":["statusPurpose","statusListName","statusListType"],"properties":{"statusPurpose":{"type":"string","enum":["revocation","suspension"]},"statusListName":{"type":"string"},"statusListType":{"type":"string","enum":["StatusList2021","BitstringStatusList"]},"statusListIndex":{"type":"number"},"statusListVersion":{"type":"string","format":"date-time"},"statusListRangeStart":{"type":"number"},"statusListRangeEnd":{"type":"number"},"indexNotIn":{"type":"number"}}},"termsOfUse":{"description":"Terms of use can be utilized by an issuer or a holder to communicate the terms under which a verifiable credential was issued.","type":"array","items":{"type":"object"}},"refreshService":{"description":"RefreshService property MUST be one or more refresh services that provides enough information to the recipient's software such that the recipient can refresh the verifiable credential.","type":"array","items":{"type":"object"}},"evidence":{"description":"Evidence property MUST be one or more evidence schemes providing enough information for a verifier to determine whether the evidence gathered by the issuer meets its confidence requirements for relying on the credential.","type":"array","items":{"type":"object"}}},"connector":{"type":"string","enum":["verida","resource"]},"required":["issuerDid","subjectDid","attributes"]},"Credential":{"description":"Input fields for revoking/suspending a Verifiable Credential.","type":"object","additionalProperties":false,"properties":{"@context":{"type":"array","items":{"type":"string"}},"type":{"type":"array","items":{"type":"string"}},"expirationDate":{"type":"string","format":"date-time"},"issuer":{"type":"object","properties":{"id":{"type":"string","format":"DID"}}},"credentialSubject":{"type":"object","properties":{"id":{"type":"string","format":"DID"}}},"credentialStatus":{"type":"object","properties":{"id":{"type":"string"},"statusListIndex":{"type":"number"},"statusPurpose":{"type":"string","enum":["revocation","suspension"]},"type":{"type":"string","enum":["StatusList2021Entry","BitstringStatusListEntry"]}}},"issuanceDate":{"type":"string","format":"date-time"},"proof":{"type":"object","properties":{"type":{"type":"string"},"jwt":{"type":"string"}}}}},"InvalidRequest":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}},"UnauthorizedError":{"description":"Access token is missing or invalid","type":"object","properties":{"error":{"type":"string"}}},"InternalError":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/credential/issue":{"post":{"tags":["Verifiable Credentials"],"summary":"Issue a Verifiable Credential","description":"This endpoint issues a Verifiable Credential. As input it takes the list of issuerDid, subjectDid, attributes, and other parameters of the credential to be issued.","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/CredentialRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/CredentialRequest"}}}},"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Credential"}}}},"400":{"$ref":"#/components/schemas/InvalidRequest"},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"$ref":"#/components/schemas/InternalError"}}}}}}
```

Users have two options for compiling the Credential bodies and issuing Verifiable Credentials:

1. **Filling out a simple form** using the `application/x-www-url-form-encoded` option within an API client of your choice.
2. **Compiling a Credential body yourself** using the `application/json` option within an API client of your choice.

### Option 1. Choose from a few variables and we will compile the Credential body for you

This is the easiest way to issue Credentials and is recommended for users who are not overly familiar with compiling JSON objects.&#x20;

Using the `application/x-www-url-form-encoded` option, users are able to choose between the following variables and options to issue Verifiable Credentials:

<details>

<summary><strong>issuerDid (required)</strong></summary>

This is the DID of the Credential issuer, created in [Step 2](#step-2-create-an-issuer-did). This needs to be a `did:cheqd` DID. For example:

```json
did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0
```

</details>

<details>

<summary><strong>subjectDid (required)</strong></summary>

This is the DID of the Credential subject, created in [Step ](#step-2-create-an-issuer-did)[3](#optional-step-3-create-a-subject-did). This needs to be a `did:key` or `did:vda` DID. For example:

```json
did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
```

</details>

<details>

<summary><strong>attributes (required)</strong></summary>

These are the claims or attributes attested to within the Verifiable Credential. This must be a JSON object, following the [syntax defined in the Verifiable Credential Data Model](https://www.w3.org/TR/vc-data-model/). For example:

```json
{
  "name": "Bob",
  "gender": "male"
}
```

</details>

<details>

<summary><strong>credentialSchema (required for Verida wallet)</strong></summary>

This is the Schema which the Credential body takes the form of. For the Verida wallet, to display a credential, it needs to have a schema associated with it.&#x20;

```json
https://common.schemas.verida.io/health/pathology/tests/covid19/pcr/v0.1.0/schema.json
```

</details>

<details>

<summary><strong>@context (optional)</strong></summary>

This is an optional property that defines semantic information about the Credential, conforming to the [@contexts section of the Verifiable Credential Data Model](https://www.w3.org/TR/vc-data-model/#contexts). For example:

```json
https://www.w3.org/2018/credentials/v1
```

</details>

<details>

<summary><strong>type (optional)</strong></summary>

This is an optional property that defines information about the type of Verifiable Credential, conforming to the [types section of the Verifiable Credential Data Model](https://www.w3.org/TR/vc-data-model/#types). For example:

```json
VerifiableCredential
```

</details>

<details>

<summary><strong>expirationDate (optional)</strong></summary>

This is an optional property that defines information about the expiration date of a Verifiable Credential, conforming to the [expiration section of the Verifiable Credentials Data Model](https://www.w3.org/TR/vc-data-model/#expiration). For example:

```json
2023-06-08T13:49:28.000Z
```

</details>

<details>

<summary><strong>format (optional)</strong></summary>

Format of the Verifiable Credential. Defaults to VC-JWT.

* jwt (VC-JWT)
* lds (JSON-LD)

</details>

<details>

<summary><strong>credentialStatus (optional)</strong></summary>

`credentialStatus` properties for VC revocation or suspension. Takes `statusListName` and `statusListPurpose` as inputs. If you have already created a Status List, you can include the same inputs here to map this issued credential within the created bitstring.&#x20;

Note that this is the same for [unencrypted Status Lists](https://docs.cheqd.io/product/studio/status-lists) and for [encrypted Status Lists](https://docs.cheqd.io/product/studio/payments/charge). For example:

```json
{
  "statusPurpose": "revocation",
  "statusListName": "employee-credentials"
}
```

</details>

#### Additional options for specifying credentialStatus bitstring index

Below are a set of examples of alternative input parameters for users to specify the bitstring index of the issued Credential. The bitstring index is where exactly the issued credential will map to within the Status List. This should be noted and stored by the issuer to keep a record of which issued credentials are active, revoked or suspended:

<details>

<summary>Example Request Format: Random Bitstring index</summary>

```json
{
  "statusPurpose": "revocation",
  "statusListName": "employee-credentials"
}

```

</details>

<details>

<summary>Example Request Format: Specified Bitstring index</summary>

```json
{
  "statusPurpose": "revocation",
  "statusListName": "employee-credentials",
  "statusListIndex": 1543
}

```

</details>

<details>

<summary>Example Request Format: Bitstring index within a given range</summary>

```json
{
  "statusPurpose": "revocation",
  "statusListName": "employee-credentials"
  "statusListRangeStart": 1000,
  "statusListRangeEnd": 2000
}
```

</details>

<details>

<summary>Example Request Format: Bitstring including omitted bits </summary>

```json
{
  "statusPurpose": "revocation",
  "statusListName": "employee-credentials"
  "statusListRangeStart": 1000,
  "statusListRangeEnd": 2000,
  "indexNotIn": 1001. 1264. 1268, 1854
}

```

</details>

{% hint style="info" %}
Ensure that the `"statusPurpose"` and `"statusListName"` is the same as the existing Status List on-ledger.
{% endhint %}

### Option 2. Publish a JSON payload yourself

Instead of using simple form variables, you can issue a Verifiable Credential using a JSON payload with the `application/json` option.&#x20;

#### Request format

Below is an example of the request format for issuing a Verifiable Credential using a custom JSON payload, including some of the possible parameters:

```json
{
  "issuerDid": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0",
  "subjectDid": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
  "attributes": {
    "gender": "male",
    "name": "Bob"
  },
  "@context": [
    "https://schema.org"
  ],
  "type": [
    "Person"
  ],
  "credentialSchema": "https://common.schemas.verida.io/identity/kyc/FinClusive/individual-basic/v0.1.0/schema.json",
  "format": "jwt",
  "credentialStatus": {
    "statusPurpose": "revocation",
    "statusListName": "employee-credentials",
    "statusListIndex": 10
  }
}
```

## Step 5: Issue a Credential using the API below

Execute the API below to issue a Verifiable Credential, signed by your issuer DID.

## Issue a Verifiable Credential

> This endpoint issues a Verifiable Credential. As input it takes the list of issuerDid, subjectDid, attributes, and other parameters of the credential to be issued.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"Verifiable Credentials"}],"servers":[{"url":"https://studio-api.cheqd.net","description":"Main (production) server"},{"url":"https://studio-api-staging.cheqd.net","description":"Staging server for testing"},{"url":"http://localhost:3000","description":"Local server for testing"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"x-api-key","in":"header"}},"schemas":{"CredentialRequest":{"description":"Input fields for the creating a Verifiable Credential.","type":"object","additionalProperties":false,"properties":{"issuerDid":{"description":"DID of the Verifiable Credential issuer. This needs to be a `did:cheqd` DID.","type":"string"},"subjectDid":{"description":"DID of the Verifiable Credential holder/subject. This needs to be a `did:key` DID.","type":"string"},"attributes":{"description":"JSON object containing the attributes to be included in the credential.","type":"object"},"@context":{"description":"Optional properties to be included in the `@context` property of the credential.","type":"array","items":{"type":"string"}},"type":{"description":"Optional properties to be included in the `type` property of the credential.","type":"array","items":{"type":"string"}},"expirationDate":{"description":"Optional expiration date according to the <a href=https://www.w3.org/TR/vc-data-model/#expiration> VC Data Model specification</a>.","type":"string","format":"date-time"},"format":{"description":"Format of the Verifiable Credential. Defaults to VC-JWT.","type":"string","enum":["jwt","jsonld"]},"credentialStatus":{"description":"Optional `credentialStatus` properties for VC revocation or suspension. Takes `statusListName` and `statusListPurpose` as inputs.","type":"object","required":["statusPurpose","statusListName","statusListType"],"properties":{"statusPurpose":{"type":"string","enum":["revocation","suspension"]},"statusListName":{"type":"string"},"statusListType":{"type":"string","enum":["StatusList2021","BitstringStatusList"]},"statusListIndex":{"type":"number"},"statusListVersion":{"type":"string","format":"date-time"},"statusListRangeStart":{"type":"number"},"statusListRangeEnd":{"type":"number"},"indexNotIn":{"type":"number"}}},"termsOfUse":{"description":"Terms of use can be utilized by an issuer or a holder to communicate the terms under which a verifiable credential was issued.","type":"array","items":{"type":"object"}},"refreshService":{"description":"RefreshService property MUST be one or more refresh services that provides enough information to the recipient's software such that the recipient can refresh the verifiable credential.","type":"array","items":{"type":"object"}},"evidence":{"description":"Evidence property MUST be one or more evidence schemes providing enough information for a verifier to determine whether the evidence gathered by the issuer meets its confidence requirements for relying on the credential.","type":"array","items":{"type":"object"}}},"connector":{"type":"string","enum":["verida","resource"]},"required":["issuerDid","subjectDid","attributes"]},"Credential":{"description":"Input fields for revoking/suspending a Verifiable Credential.","type":"object","additionalProperties":false,"properties":{"@context":{"type":"array","items":{"type":"string"}},"type":{"type":"array","items":{"type":"string"}},"expirationDate":{"type":"string","format":"date-time"},"issuer":{"type":"object","properties":{"id":{"type":"string","format":"DID"}}},"credentialSubject":{"type":"object","properties":{"id":{"type":"string","format":"DID"}}},"credentialStatus":{"type":"object","properties":{"id":{"type":"string"},"statusListIndex":{"type":"number"},"statusPurpose":{"type":"string","enum":["revocation","suspension"]},"type":{"type":"string","enum":["StatusList2021Entry","BitstringStatusListEntry"]}}},"issuanceDate":{"type":"string","format":"date-time"},"proof":{"type":"object","properties":{"type":{"type":"string"},"jwt":{"type":"string"}}}}},"InvalidRequest":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}},"UnauthorizedError":{"description":"Access token is missing or invalid","type":"object","properties":{"error":{"type":"string"}}},"InternalError":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/credential/issue":{"post":{"tags":["Verifiable Credentials"],"summary":"Issue a Verifiable Credential","description":"This endpoint issues a Verifiable Credential. As input it takes the list of issuerDid, subjectDid, attributes, and other parameters of the credential to be issued.","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/CredentialRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/CredentialRequest"}}}},"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Credential"}}}},"400":{"$ref":"#/components/schemas/InvalidRequest"},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"$ref":"#/components/schemas/InternalError"}}}}}}
```

## Alternatives

Below are a list of alternatives for using Credentials with cheqd support. Each offers a different set of protocols and underlying technical capabilities.

<table data-card-size="large" data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Veramo SDK Plugin</strong></mark></td><td>The <strong>Veramo SDK Plugin</strong> is an extension of the Veramo SDK, a JavaScript framework for Trusted Data, adding support for cheqd functionality.</td><td><a href="../../sdk/veramo">veramo</a></td></tr><tr><td><mark style="color:blue;"><strong>Credo</strong></mark></td><td>Credo is an SDK which <a href="https://hyperledger.github.io/anoncreds-spec/"><strong>supports ZKCreds (AnonCreds)</strong></a> and regular Verifiable Credentials natively with cheqd support. </td><td><a href="../../sdk/credo">credo</a></td></tr><tr><td><mark style="color:blue;"><strong>ACA-Py</strong></mark></td><td>ACA-Py (Aries Cloud Agent Python) is an SDK that can issue AnonCreds, JSON-LD and SD-JWT credentials with full cheqd support.</td><td><a href="../../sdk/aca-py">aca-py</a></td></tr><tr><td><mark style="color:blue;"><strong>Walt.id SSI Kit</strong></mark></td><td>Walt.id SSI Kit is an SDK that supports the <a href="https://digital-strategy.ec.europa.eu/en/library/european-digital-identity-architecture-and-reference-framework-outline"><strong>European Architecture and Reference Framework (ARF)</strong></a> standards for identity, with full cheqd support. </td><td><a href="../../sdk/walt-id">walt-id</a></td></tr></tbody></table>

t
