> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useanima.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# DID Method (did:web)

> Decentralized identifiers for AI agents using the standard did:web method. Document structure, resolution, and key rotation.

# DID Method (did:web)

Anima assigns every agent a globally unique decentralized identifier (DID) using the standard [`did:web`](https://w3c-ccg.github.io/did-method-web/) method — a W3C-registered method that resolves over plain HTTPS, with no bespoke method support required.

## DID Format

```
did:web:agents.useanima.sh:<orgId>:<agentId>
```

For example: `did:web:agents.useanima.sh:cmb1x9k2l0000abcd:cmb1xa3f50001abcd`

## Resolution

Every agent's DID document is world-readable — no API key required — at:

```
GET https://api.useanima.sh/.well-known/did/<orgId>/<agentId>
```

The document is served with the `application/did+json` media type, a 60-second public cache, and open CORS, so agents in other orgs (and third-party tooling) can fetch and verify it. The spec-canonical `did:web` HTTPS mapping (`https://agents.useanima.sh/<orgId>/<agentId>/did.json`) is not yet routed — until it is, fetch the document from the API host above.

### Example DID Document

```json theme={null}
{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/jws-2020/v1"
  ],
  "id": "did:web:agents.useanima.sh:cmb1x9k2l0000abcd:cmb1xa3f50001abcd",
  "verificationMethod": [
    {
      "id": "did:web:agents.useanima.sh:cmb1x9k2l0000abcd:cmb1xa3f50001abcd#key-1",
      "type": "JsonWebKey2020",
      "controller": "did:web:agents.useanima.sh:cmb1x9k2l0000abcd:cmb1xa3f50001abcd",
      "publicKeyJwk": { "kty": "OKP", "crv": "Ed25519", "x": "…" }
    }
  ],
  "authentication": [
    "did:web:agents.useanima.sh:cmb1x9k2l0000abcd:cmb1xa3f50001abcd#key-1"
  ],
  "assertionMethod": [
    "did:web:agents.useanima.sh:cmb1x9k2l0000abcd:cmb1xa3f50001abcd#key-1"
  ]
}
```

The agent's Ed25519 key signs [A2A requests](/a2a/overview); receivers verify the signature against the public key in this document.

## API Reference

DIDs are created automatically when an agent is provisioned — there is no separate "create DID" call.

### Get an agent's DID document

```
GET https://api.useanima.sh/v1/agents/{agentId}/did
```

Returns the same DID document served at the public resolution URL. Readable org-wide with an agent or master key (public discovery works via the `did.json` URL above without any key).

### Rotate keys

```
POST https://api.useanima.sh/v1/agents/{agentId}/did/rotate
```

Generates a new keypair for the agent and republishes the DID document. Master key required. Signatures made with the old key stop verifying once the document no longer lists it — coordinate rotation with any party that pinned the old key.

## Related endpoints

| Endpoint | Method | Description |
| - | - | - |
| `/v1/agents/{agentId}/did` | GET | DID document for an agent |
| `/v1/agents/{agentId}/did/rotate` | POST | Rotate the agent's keypair (master key) |
| `/v1/agents/{agentId}/card` | GET | Public [Agent Card](/identity/agent-cards) |
| `/v1/identity/verify` | POST | Verify a JWT Verifiable Credential |

## Next Steps

* [Verifiable Credentials](/identity/verifiable-credentials) -- Verify and revoke credentials
* [Agent Cards](/identity/agent-cards) -- Machine-readable agent metadata
* [A2A Protocol](/a2a/overview) -- Agent-to-agent communication using DIDs


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.