> For the complete documentation index, see [llms.txt](https://docs.empe.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.empe.io/develop/wallet-server/api-reference/did-management.md).

# DID Management

## Generate DID documents

> Generates new DID documents for the specified methods.

```json
{"openapi":"3.0.0","info":{"title":"Wallet API","version":"1.0"},"security":[{"oneclick-jwt":[]}],"components":{"securitySchemes":{"oneclick-jwt":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"One-Click access token (Authorization: Bearer <JWT>)"}},"schemas":{"GenerateDidRequestDto":{"type":"object","properties":{"methods":{"description":"DID method which will be used for generate DID documents","type":"array","items":{"type":"string"}}},"required":["methods"]},"DocumentObjectDto":{"type":"object","properties":{"@context":{"type":"string","description":"JSON-LD context for the DID document"},"id":{"type":"string","description":"The DID"},"controller":{"type":"string","description":"The controller of the DID document"},"verificationMethod":{"type":"object","description":"The verification methods associated with the DID document"},"authentication":{"description":"Authentication methods for the DID document","type":"array","items":{"type":"string"}},"assertionMethod":{"description":"Assertion methods for the DID document","type":"array","items":{"type":"string"}},"capabilityInvocation":{"description":"Capability invocation methods","type":"array","items":{"type":"string"}},"capabilityDelegation":{"description":"Capability delegation methods","type":"array","items":{"type":"string"}},"keyAgreement":{"description":"Key agreement methods","type":"array","items":{"type":"string"}},"service":{"description":"Services associated with the DID document","type":"array","items":{"type":"string"}},"alsoKnownAs":{"description":"Alternative identifiers for the DID","type":"array","items":{"type":"string"}}},"required":["@context","id","controller","verificationMethod","authentication","assertionMethod","service"]}}},"paths":{"/did/generate":{"post":{"description":"Generates new DID documents for the specified methods.","operationId":"DidController_didGenerate","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateDidRequestDto"}}}},"responses":{"201":{"description":"The DID documents have been successfully created.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentObjectDto"}}}}},"400":{"description":"Validation error.","content":{"application/json":{}}},"401":{"description":"Missing or invalid authentication token.","content":{"application/json":{}}}},"summary":"Generate DID documents","tags":["DID Management"]}}}}
```

## Import DID documents from mnemonics

> Restores/creates DID documents for the specified methods using a mnemonic phrase.

```json
{"openapi":"3.0.0","info":{"title":"Wallet API","version":"1.0"},"security":[{"oneclick-jwt":[]}],"components":{"securitySchemes":{"oneclick-jwt":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"One-Click access token (Authorization: Bearer <JWT>)"}},"schemas":{"ImportDidRequestDto":{"type":"object","properties":{"methods":{"description":"DID method which will be used for generate DID documents","type":"array","items":{"type":"string"}},"mnemonics":{"type":"string","description":"Mnemonic phrase used to restore the DID(s)."}},"required":["methods","mnemonics"]},"DocumentObjectDto":{"type":"object","properties":{"@context":{"type":"string","description":"JSON-LD context for the DID document"},"id":{"type":"string","description":"The DID"},"controller":{"type":"string","description":"The controller of the DID document"},"verificationMethod":{"type":"object","description":"The verification methods associated with the DID document"},"authentication":{"description":"Authentication methods for the DID document","type":"array","items":{"type":"string"}},"assertionMethod":{"description":"Assertion methods for the DID document","type":"array","items":{"type":"string"}},"capabilityInvocation":{"description":"Capability invocation methods","type":"array","items":{"type":"string"}},"capabilityDelegation":{"description":"Capability delegation methods","type":"array","items":{"type":"string"}},"keyAgreement":{"description":"Key agreement methods","type":"array","items":{"type":"string"}},"service":{"description":"Services associated with the DID document","type":"array","items":{"type":"string"}},"alsoKnownAs":{"description":"Alternative identifiers for the DID","type":"array","items":{"type":"string"}}},"required":["@context","id","controller","verificationMethod","authentication","assertionMethod","service"]}}},"paths":{"/did/import":{"post":{"description":"Restores/creates DID documents for the specified methods using a mnemonic phrase.","operationId":"DidController_didImport","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportDidRequestDto"}}}},"responses":{"201":{"description":"The DID documents have been successfully imported.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentObjectDto"}}}}},"400":{"description":"Validation error.","content":{"application/json":{}}},"401":{"description":"Missing or invalid authentication token.","content":{"application/json":{}}}},"summary":"Import DID documents from mnemonics","tags":["DID Management"]}}}}
```

## Retrieve a DID document by method

> Fetches the existing DID document for the specified method. For EMPE\_TESTNET, the underlying network must be TESTNET.

```json
{"openapi":"3.0.0","info":{"title":"Wallet API","version":"1.0"},"security":[{"oneclick-jwt":[]}],"components":{"securitySchemes":{"oneclick-jwt":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"One-Click access token (Authorization: Bearer <JWT>)"}},"schemas":{"DocumentObjectDto":{"type":"object","properties":{"@context":{"type":"string","description":"JSON-LD context for the DID document"},"id":{"type":"string","description":"The DID"},"controller":{"type":"string","description":"The controller of the DID document"},"verificationMethod":{"type":"object","description":"The verification methods associated with the DID document"},"authentication":{"description":"Authentication methods for the DID document","type":"array","items":{"type":"string"}},"assertionMethod":{"description":"Assertion methods for the DID document","type":"array","items":{"type":"string"}},"capabilityInvocation":{"description":"Capability invocation methods","type":"array","items":{"type":"string"}},"capabilityDelegation":{"description":"Capability delegation methods","type":"array","items":{"type":"string"}},"keyAgreement":{"description":"Key agreement methods","type":"array","items":{"type":"string"}},"service":{"description":"Services associated with the DID document","type":"array","items":{"type":"string"}},"alsoKnownAs":{"description":"Alternative identifiers for the DID","type":"array","items":{"type":"string"}}},"required":["@context","id","controller","verificationMethod","authentication","assertionMethod","service"]}}},"paths":{"/dids/{method}":{"get":{"description":"Fetches the existing DID document for the specified method. For EMPE_TESTNET, the underlying network must be TESTNET.","operationId":"DidController_getDid","parameters":[{"name":"method","required":true,"in":"path","description":"The DID method to resolve.","schema":{"enum":["empe","empe-testnet","web"],"type":"string"}}],"responses":{"200":{"description":"The DID document has been successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentObjectDto"}}}},"400":{"description":"The `method` query parameter is missing or invalid.","content":{"application/json":{}}},"404":{"description":"No DID document exists for the requested method.","content":{"application/json":{}}}},"summary":"Retrieve a DID document by method","tags":["DID Management"]}}}}
```

## Retrieve all DID documents for authenticated user

> Fetches all DID documents from all networks

```json
{"openapi":"3.0.0","info":{"title":"Wallet API","version":"1.0"},"security":[{"oneclick-jwt":[]}],"components":{"securitySchemes":{"oneclick-jwt":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"One-Click access token (Authorization: Bearer <JWT>)"}},"schemas":{"DocumentObjectDto":{"type":"object","properties":{"@context":{"type":"string","description":"JSON-LD context for the DID document"},"id":{"type":"string","description":"The DID"},"controller":{"type":"string","description":"The controller of the DID document"},"verificationMethod":{"type":"object","description":"The verification methods associated with the DID document"},"authentication":{"description":"Authentication methods for the DID document","type":"array","items":{"type":"string"}},"assertionMethod":{"description":"Assertion methods for the DID document","type":"array","items":{"type":"string"}},"capabilityInvocation":{"description":"Capability invocation methods","type":"array","items":{"type":"string"}},"capabilityDelegation":{"description":"Capability delegation methods","type":"array","items":{"type":"string"}},"keyAgreement":{"description":"Key agreement methods","type":"array","items":{"type":"string"}},"service":{"description":"Services associated with the DID document","type":"array","items":{"type":"string"}},"alsoKnownAs":{"description":"Alternative identifiers for the DID","type":"array","items":{"type":"string"}}},"required":["@context","id","controller","verificationMethod","authentication","assertionMethod","service"]}}},"paths":{"/dids":{"get":{"description":"Fetches all DID documents from all networks","operationId":"DidController_getAllDocuments","parameters":[],"responses":{"200":{"description":"The DID documents have been successfully retrieved","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentObjectDto"}}}}}},"summary":"Retrieve all DID documents for authenticated user","tags":["DID Management"]}}}}
```

## GET /did/user/{id}/did.json

> Serve did:web did.json for a given user

```json
{"openapi":"3.0.0","info":{"title":"Wallet API","version":"1.0"},"security":[{"oneclick-jwt":[]}],"components":{"securitySchemes":{"oneclick-jwt":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"One-Click access token (Authorization: Bearer <JWT>)"}}},"paths":{"/did/user/{id}/did.json":{"get":{"operationId":"DidController_getUserDidJson","parameters":[{"name":"id","required":true,"in":"path","description":"User id","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Serve did:web did.json for a given user","tags":["DID Management"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.empe.io/develop/wallet-server/api-reference/did-management.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
