# Create a DID

## 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"}}}}}}}}}
```


---

# 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/api-reference/dids/create.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.
