# Update a DID

## Update a DID Document.

> This endpoint updates a DID Document. As an input, it can take JUST the sections/parameters that need to be updated in the DID Document (in this scenario, it fetches the current DID Document and applies the updated section). Alternatively, it take the fully-assembled DID Document with updated sections as well as unchanged sections.

```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":{"DidUpdateRequest":{"type":"object","properties":{"did":{"description":"DID identifier to be updated.","type":"string"},"service":{"type":"array","description":"Service section of the DID Document.","items":{"$ref":"#/components/schemas/Service"}},"verificationMethod":{"type":"array","description":"Verification Method section of the DID Document.","items":{"$ref":"#/components/schemas/VerificationMethod"}},"authentication":{"description":"Authentication section of the DID Document.","type":"array","items":{"type":"string"}},"publicKeyHexs":{"description":"List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.","type":"array","items":{"type":"string"}},"didDocument":{"$ref":"#/components/schemas/DidDocument"}}},"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"}}}},"VerificationMethod":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"controller":{"type":"string"},"publicKeyMultibase":{"type":"string"},"publicKeyJwk":{"type":"array","items":{"type":"string"}}}},"DidDocument":{"description":"This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See <a href=\"https://identity.foundation/did-registration/#diddocument\">Universal DID Registrar specification</a>.","type":"object","properties":{"@context":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"controllers":{"type":"array","items":{"type":"string"}},"verificationMethod":{"type":"array","items":{"$ref":"#/components/schemas/VerificationMethod"}},"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"}}}},"DidUpdateResponse":{"type":"object","properties":{"did":{"type":"string"},"controllerKeyId":{"type":"string","description":"The default key id of which is the key associated with the first verificationMethod"},"keys":{"type":"array","description":"The list of keys associated with the list of verificationMethod's of DIDDocument","items":{"type":"object"}},"services":{"type":"array","items":{"$ref":"#/components/schemas/Service"}},"controllerKeyRefs":{"type":"array","description":"The list of keyRefs which were used for signing the transaction","items":{"type":"string"}},"controllerKeys":{"type":"array","description":"The list of all possible keys, inlcuding all controller's keys","items":{"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":{"/did/update":{"post":{"tags":["Decentralized Identifiers (DIDs)"],"summary":"Update a DID Document.","description":"This endpoint updates a DID Document. As an input, it can take JUST the sections/parameters that need to be updated in the DID Document (in this scenario, it fetches the current DID Document and applies the updated section). Alternatively, it take the fully-assembled DID Document with updated sections as well as unchanged sections.","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/DidUpdateRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/DidUpdateRequest"}}}},"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DidUpdateResponse"}}}},"400":{"$ref":"#/components/schemas/InvalidRequest"},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"$ref":"#/components/schemas/InternalError"}}}}}}
```
