# Create a DID

In cheqd Studio, you can easily create and publish a `did:cheqd` DID to the **cheqd testnet or mainnet**, anchoring it on-ledger with associated public keys and metadata. This DID can then be used to:

* Sign and issue verifiable credentials as an 'issuer'.
* Establish a trusted identity on cheqd for entities like organisations, digital products or AI Agents.
* Serve as the parent identifier for DID-Linked Resources (e.g. status lists, trust registries).

This tutorial walks through the process of creating an Issuer DID using cheqd Studio's API or interface, including how to configure your keys, DID Document, and optional service endpoints.

> 🔐 Once registered, the DID becomes publicly resolvable and forms the cryptographic foundation of your identity as an issuer in decentralized ecosystems.

## Step 1: Set up your account

Make sure you have set up your account with **cheqd Studio** and have generated an API key to authenticate with our APIs, using our guides 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 get your API key to start using the APIs.</td><td><a href="../../getting-started/studio/set-up-account">set-up-account</a></td></tr><tr><td><mark style="color:blue;"><strong>Create API Keys</strong></mark></td><td>Create one or more API keys used to authenticate with the cheqd Studio APIs.</td><td><a href="../../getting-started/studio/api-keys">api-keys</a></td></tr></tbody></table>

## Step 2: Create a DID and associated DID Document

Using the `/did/create` API, users have two options for creating a `did:cheqd` DID and associated DID Document on-ledger:

1. **Filling out a simple form** using the `application/x-www-url-form-encoded` or `application/json` option within an API client of your choice.
2. **Compiling a full DID Document body yourself** using the `application/json` option, using already created identity keys, within an API client of your choice.

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

This is the easiest way to create DIDs on cheqd and is recommended for users who are not overly familiar with compiling DID Documents.&#x20;

#### Using application/x-www-url-form-encoded

Using the `application/x-www-url-form-encoded` option, users are able to choose between the following variables to compile your DID:

<details>

<summary>network (required)</summary>

* "testnet" (recommended for testing)
* "mainnet" (recommended for production)

</details>

<details>

<summary>identifierFormatType (required)</summary>

* "uuid" - this is a Universally Unique Identifier (recommended)
* "base58btc" - this is an identifier which is commonly used for Hyperledger Indy transactions

</details>

<details>

<summary>verificationMethodType (required)</summary>

* "Ed25519VerificationKey2018" (recommended)
* "Ed25519VerificationKey2020"
* "JSONWebKey2020"

</details>

<details>

<summary>service (optional)</summary>

This input field contains the required inputs for adding in a `service` section to the DID Document upon creation.

```json
{
  "idFragment": "service-1",
  "type": "LinkedDomains",
  "serviceEndpoint": [
    "https://example.com"
  ]
}
```

</details>

From this request, cheqd Studio **will automatically create and publish a DID and associated DID Document to the ledger** and return it as a response.

<details>

<summary>Expected response format</summary>

```json
{
  "did": "did:cheqd:testnet:ca029356-69dc-4cb4-a4c6-13b959ffaad6",
  "keys": [
    {
      "kid": "1a07cb379cd6f2d9acddf9a6d6af4e930d5696818a38020bde2b6ead5cd85039",
      "kms": "postgres",
      "type": "Ed25519",
      "publicKeyHex": "1a07cb379cd6f2d9acddf9a6d6af4e930d5696818a38020bde2b6ead5cd85039",
      "meta": {
        "algorithms": [
          "EdDSA",
          "Ed25519"
        ]
      },
      "controller": "did:cheqd:testnet:ca029356-69dc-4cb4-a4c6-13b959ffaad6"
    }
  ],
  "services": [],
  "provider": "did:cheqd:testnet",
  "controllerKeyRefs": [
    "1a07cb379cd6f2d9acddf9a6d6af4e930d5696818a38020bde2b6ead5cd85039"
  ],
  "controllerKeys": [
    {
      "kid": "1a07cb379cd6f2d9acddf9a6d6af4e930d5696818a38020bde2b6ead5cd85039",
      "kms": "postgres",
      "type": "Ed25519",
      "publicKeyHex": "1a07cb379cd6f2d9acddf9a6d6af4e930d5696818a38020bde2b6ead5cd85039",
      "meta": {
        "algorithms": [
          "EdDSA",
          "Ed25519"
        ]
      },
      "controller": "did:cheqd:testnet:ca029356-69dc-4cb4-a4c6-13b959ffaad6"
    }
  ],
  "controllerKeyId": "1a07cb379cd6f2d9acddf9a6d6af4e930d5696818a38020bde2b6ead5cd85039"
}
```

</details>

#### Using application/json

Alternatively, you can use the `application/json` option and pass only a few specific inputs, for example:

```json
{
  "network": "testnet",
  "identifierFormatType": "uuid",
  "options": {
    "verificationMethodType": "Ed25519VerificationKey2018"
  }
}
```

Or, if you have [created a keypair already](https://docs.cheqd.io/product/studio/dids/create-identity-keys) that you want to use, you can reference the created key ID, `kid`,  in the request:

```json
{
  "network": "testnet",
  "identifierFormatType": "uuid",
  "options": {
    "key": "8255ddadd75695e01f3d98fcec8ccc7861a030b317d4326b0e48a4d579ddc43a", // Pass kid if you have created a key separately
    "verificationMethodType": "Ed25519VerificationKey2018"
  }
}
```

{% hint style="info" %}
Note that if you are passing a `kid` that is already created, you must also specify the `verificationMethodType` within `options`.
{% endhint %}

Using the `application/json` option, users are able to choose between the following variables to compile your DID:

<details>

<summary>network (required)</summary>

* "testnet" (recommended for testing)
* "mainnet" (recommended for production)

</details>

<details>

<summary>identifierFormatType (required)</summary>

* "uuid" - this is a Universally Unique Identifier (recommended)
* "base58btc" - this is an identifier which is commonly used for Hyperledger Indy transactions

</details>

<details>

<summary>verificationMethodType (required)</summary>

* "Ed25519VerificationKey2018" (recommended)
* "Ed25519VerificationKey2020"
* "JSONWebKey2020"

*Note that this should be nested under `options`*

</details>

<details>

<summary>key (optional)</summary>

* "8255ddadd75695e01f3d98fcec8ccc7861a030b317d4326b0e48a4d579ddc43a"
* This is a `kid` that should have been created using our [Key Create API](https://docs.cheqd.io/product/studio/dids/create-identity-keys).

*Note that this should be nested under `options`*

</details>

### Option 2. Publish a fully compiled DID Document body yourself

Instead of generating a DID Document using simple parameters, you can create a fully formatted DID Document yourself. Before, submitting a manually created DID, you will need to have [created a set of identity keys](https://docs.cheqd.io/product/studio/dids/create-subject-did) to input the key material into the DID document.

#### Step 1: Create a new keypair

Use the [`/key/create` API](https://docs.cheqd.io/product/studio/dids/create-subject-did) to generate a new keypair within the Credential Service key management store. Copy the `publicKeyHex`.&#x20;

#### Step 2 (option 1): Utilise the DID Document template helper&#x20;

To simplify this process of formatting a DID Document using your own keys, we've created a [Helper Tool in our DID Registrar here](https://did-registrar.cheqd.net/api-docs/#/Cheqd%20Helpers/get_did_document). Simply paste in your `publicKeyHex` and choose the variables to compile your DID Document template.

#### Step 3: Paste the response

Within the `/did/create` JSON payload, paste the response of your DID Document template, with your own signing keys.&#x20;

**Request format:**

```json
{
  "didDocument": {
    "id": "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63",
    "controller": [
      "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63"
    ],
    "verificationMethod": [
      {
        "id": "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63#key-1",
        "type": "JsonWebKey2020",
        "controller": "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63",
        "publicKeyJwk": {
          "crv": "Ed25519",
          "kty": "OKP",
          "x": "BFSLOxwMJgpmWRtTUuo0JAvz6VXGp4WDDcN0dFfCQKo"
        }
      }
    ],
    "authentication": [
      "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63#key-1"
    ]
  }
}

```

#### Step 2 (option 2) Use application/json options

Alternatively, you can use the `application/json` request format below.&#x20;

You can use the `kid` created from Step 1 within the options section, and then compile the remainder of tour DID Document.

```json
"options": {
    "key": "8255ddadd75695e01f3d98fcec8ccc7861a030b317d4326b0e48a4d579ddc43a",
    "verificationMethodType": "Ed25519VerificationKey2018"
  },
  "didDocument": {
    "@context": [
      "https://www.w3.org/ns/did/v1"
    ],
    "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0",
    "controller": [
      "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0"
    ],
    "authentication": [
      "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1"
    ],
    "service": [
      {
        "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1",
        "type": "LinkedDomains",
        "serviceEndpoint": [
          "https://example.com"
        ]
      }
    ]
  }
}
```

## Step 3: Hit execute on the API

Hit execute on the API below to create your `did:cheqd` DID and associated DID Document.

## Create a DID Document.

> This endpoint creates a DID and associated DID Document. As input, it can take the DID Document parameters via a form, or the fully-assembled DID Document itself.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"Decentralized Identifiers (DIDs)"}],"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":{"DidCreateRequestFormBased":{"type":"object","properties":{"network":{"description":"Network to create the DID on (testnet or mainnet)","type":"string","enum":["testnet","mainnet"]},"providerId":{"description":"Identity Provider to create the DID","type":"string","required":false},"identifierFormatType":{"description":"Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See <a href=\"https://docs.cheqd.io/identity/architecture/adr-list/adr-001-cheqd-did-method#cheqd-did-method-did-cheqd\">cheqd DID method documentation</a> for more details.","type":"string","enum":["uuid","base58btc"]},"verificationMethodType":{"description":"Type of verification method to use for the DID. See <a href=\"https://www.w3.org/TR/did-core/#verification-methods\">DID Core specification</a> for more details. Only the types listed below are supported.","type":"string","enum":["Ed25519VerificationKey2018","JsonWebKey2020","Ed25519VerificationKey2020"]},"service":{"description":"It's a list of special objects which are designed to build the actual service. It's almost the same as in <a href=\"https://www.w3.org/TR/did-core/#services\">DID Core specification</a>, but instead of `id` it utilises `idFragment` field for making the right `id` for each service. !!! WARN. Cause swagger-ui does not handle x-ww-form based arrays correctly, please frame all your services in brackets while using swagger UI. !!!","type":"array","items":{"type":"object","properties":{"idFragment":{"type":"string"},"type":{"type":"string"},"serviceEndpoint":{"type":"array","items":{"type":"string"}}}}},"key":{"description":"The unique identifier in hexadecimal public key format used in the verification method to create the DID.","type":"string"},"@context":{"type":"array","items":{"type":"string"}}}},"DidCreateRequestJson":{"type":"object","properties":{"network":{"description":"Network to create the DID on (testnet or mainnet)","type":"string","enum":["testnet","mainnet"]},"providerId":{"description":"Identity Provider to create the DID","type":"string","required":false},"identifierFormatType":{"description":"Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See <a href=\"https://docs.cheqd.io/identity/architecture/adr-list/adr-001-cheqd-did-method#cheqd-did-method-did-cheqd\">cheqd DID method documentation</a> for more details.","type":"string","enum":["uuid","base58btc"]},"options":{"type":"object","properties":{"key":{"type":"string"},"verificationMethodType":{"description":"Type of verification method to use for the DID. See <a href=\"https://www.w3.org/TR/did-core/#verification-methods\">DID Core specification</a> for more details. Only the types listed below are supported.","type":"string","enum":["Ed25519VerificationKey2018","JsonWebKey2020","Ed25519VerificationKey2020"]}}},"didDocument":{"$ref":"#/components/schemas/DidDocumentWithoutVerificationMethod"}}},"DidDocumentWithoutVerificationMethod":{"type":"object","properties":{"@context":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"controllers":{"type":"array","items":{"type":"string"}},"service":{"type":"array","items":{"$ref":"#/components/schemas/Service"}},"authentication":{"type":"array","items":{"type":"string"}},"assertionMethod":{"type":"array","items":{"type":"string"}},"capabilityInvocation":{"type":"array","items":{"type":"string"}},"capabilityDelegation":{"type":"array","items":{"type":"string"}},"keyAgreement":{"type":"array","items":{"type":"string"}}}},"Service":{"description":"Communicating or interacting with the DID subject or associated entities via one or more service endpoints. See <a href=\"https://www.w3.org/TR/did-core/#services\">DID Core specification</a> for more details.","type":"object","properties":{"id":{"description":"DID appended with Service fragment ID (e.g., `#service-1` in `did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1`)","type":"string"},"type":{"description":"Service type as defined in <a href=\"https://www.w3.org/TR/did-spec-registries/#service-types\">DID Specification Registries</a>.","type":"string"},"serviceEndpoint":{"description":"Service endpoint as defined in <a href=\"https://www.w3.org/TR/did-core/#services\">DID Core Specification</a>.","type":"array","items":{"type":"string"}},"priority":{"description":"(Optional) Priority of the service endpoint, used for distinction when multiple did-communication service endpoints are present in a single DID document.","type":"integer"},"recipientKeys":{"description":"(Optional) List of recipient keys used to denote the default recipients of an endpoint.","type":"array","items":{"type":"string"}},"routingKeys":{"description":"(Optional) List of routing keys used to used to denote the individual routing hops in between the sender and recipients.","type":"array","items":{"type":"string"}},"accept":{"description":"(Optional) List of media types that the service endpoint accepts.","type":"array","items":{"type":"string"}}}},"DidResult":{"type":"object","properties":{"did":{"type":"string"},"controllerKeyId":{"type":"string"},"keys":{"type":"array","items":{"type":"object"}},"services":{"type":"array","items":{"$ref":"#/components/schemas/Service"}}}},"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"}}}}},"paths":{"/did/create":{"post":{"tags":["Decentralized Identifiers (DIDs)"],"summary":"Create a DID Document.","description":"This endpoint creates a DID and associated DID Document. As input, it can take the DID Document parameters via a form, or the fully-assembled DID Document itself.","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/DidCreateRequestFormBased"}},"application/json":{"schema":{"$ref":"#/components/schemas/DidCreateRequestJson"}}}},"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DidResult"}}}},"400":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRequest"}}}}}}}}}
```

## List DIDs associated with your account

After creating a DID or multiple DIDs, users can list all the created DIDs associated with their account. Using the `/did/list` API.&#x20;

{% openapi src="<https://raw.githubusercontent.com/cheqd/credential-service/main/src/static/swagger-api.json>" path="/did/list" method="get" expanded="true" %}
<https://raw.githubusercontent.com/cheqd/credential-service/main/src/static/swagger-api.json>
{% endopenapi %}

## Alternatives

Below are a list of alternatives for creating cheqd DIDs.

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Credo</strong></mark></td><td>Credo is an SDK which <strong>supports the European Architecture and Reference Framework (ARF)</strong> <strong>standards as well as AnonCreds</strong> with full cheqd support for DIDs. </td><td><a href="../../sdk/credo">credo</a></td><td><a href="https://3569764573-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPVAMvpKH7PYzvXA6u6Cn%2Fuploads%2Fgit-blob-60c84f7d53e6eb6e675e8cd8b00e4920ad335ca0%2FCredo.png?alt=media">Credo.png</a></td></tr><tr><td><mark style="color:blue;"><strong>ACA-Py</strong></mark></td><td>ACA-Py plugin supports full cheqd support for DIDs as well as Verifiable Credentials. </td><td><a href="../../sdk/aca-py">aca-py</a></td><td><a href="https://3569764573-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPVAMvpKH7PYzvXA6u6Cn%2Fuploads%2Fgit-blob-7c6e984dea8a819980980f97ae804f943838ce62%2FACA-Py.png?alt=media">ACA-Py.png</a></td></tr><tr><td><mark style="color:blue;"><strong>Veramo</strong></mark></td><td>The <strong>Veramo SDK Plugin</strong> supports JSON, JSON-LD credentials as well as cheqd Credential Payments in an SDK.</td><td><a href="../../sdk/veramo">veramo</a></td><td><a href="https://3569764573-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPVAMvpKH7PYzvXA6u6Cn%2Fuploads%2Fgit-blob-031af91fab341ad25703bd5d5924bda95df8e5fe%2Fveramo%20logo.png?alt=media">veramo logo.png</a></td></tr><tr><td><mark style="color:blue;"><strong>DID Registrar</strong></mark></td><td>Simple setup for building cheqd DIDs into existing applications using REST APIs, building into the Universal Registrar.</td><td><a href="../../advanced/did-registrar">did-registrar</a></td><td><a href="https://3569764573-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPVAMvpKH7PYzvXA6u6Cn%2Fuploads%2Fgit-blob-7f1ffe5c0546f0ee4f106ac1a71308c5ee5ad7c8%2Fcheqd_logo_card.jpg?alt=media">cheqd_logo_card.jpg</a></td></tr><tr><td><mark style="color:blue;"><strong>Walt.id Community Stack</strong></mark></td><td>Walt.id Community Stack is an SDK that supports the <strong>European Architecture and Reference Framework (ARF)</strong> standards for identity, with full cheqd support. </td><td><a href="../../sdk/walt-id">walt-id</a></td><td><a href="https://3569764573-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPVAMvpKH7PYzvXA6u6Cn%2Fuploads%2Fgit-blob-13fffb32e0b3f04983f4984cd455a441c3111b7f%2Fwalt.id%20logo.png?alt=media">walt.id logo.png</a></td></tr><tr><td><mark style="color:blue;"><strong>cheqd Cosmos CLI</strong></mark></td><td>Cosmos CLI which directly communicates with the cheqd network. This should only be used for testing environments.</td><td><a href="../../advanced/tooling/cheqd-node-cli">cheqd-node-cli</a></td><td><a href="https://3569764573-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPVAMvpKH7PYzvXA6u6Cn%2Fuploads%2Fgit-blob-fab3a1d3aa7f3c99241ea3ab060ec02d66ce2c7c%2Fcosmos%20and%20cheqd.png?alt=media">cosmos and cheqd.png</a></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cheqd.io/product/studio/dids/create-did.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
