Skip to main content
Every agent on Anima is assigned a globally unique decentralized identifier (DID) using the did:anima method. A DID is a self-sovereign identifier — it is not controlled by any central authority and can be cryptographically verified by anyone.

DID format

Anima DIDs follow the W3C DID specification:
did:anima:<agent-id>
For example: did:anima:ag_8f3k2m9x1n4p7q6r The <agent-id> portion is the same ID you use when calling the Anima API. Your DID is created automatically when you provision an agent — no extra setup required.

DID documents

Every DID resolves to a DID Document: a JSON-LD object that lists the agent’s public keys, authentication methods, and service endpoints. Anyone can fetch this document to verify your agent’s identity without contacting Anima.
{
  "@context": ["https://www.w3.org/ns/did/v1"],
  "id": "did:anima:ag_8f3k2m9x1n4p7q6r",
  "verificationMethod": [
    {
      "id": "did:anima:ag_8f3k2m9x1n4p7q6r#key-1",
      "type": "Ed25519VerificationKey2020",
      "controller": "did:anima:ag_8f3k2m9x1n4p7q6r",
      "publicKeyMultibase": "z6Mkf5rG..."
    }
  ],
  "authentication": ["did:anima:ag_8f3k2m9x1n4p7q6r#key-1"],
  "service": [
    {
      "id": "did:anima:ag_8f3k2m9x1n4p7q6r#email",
      "type": "AgentEmail",
      "serviceEndpoint": "mailto:agent@useanima.sh"
    },
    {
      "id": "did:anima:ag_8f3k2m9x1n4p7q6r#a2a",
      "type": "AgentToAgent",
      "serviceEndpoint": "https://api.useanima.sh/a2a/ag_8f3k2m9x1n4p7q6r"
    }
  ]
}
The verificationMethod entry contains your agent’s Ed25519 public key. When your agent signs a message, the recipient resolves this document to confirm the signature is authentic.

Resolve a DID

Use identity.resolveDid to fetch the DID Document for any did:anima identifier:
import { Anima } from "@anima-labs/sdk";

const anima = new Anima({ apiKey: "ak_..." });

const doc = await anima.identity.resolveDid("did:anima:ag_8f3k2m9x1n4p7q6r");
console.log(doc);
You can also call the REST endpoint directly:
GET /api/identity/did/:did
ParameterTypeDescription
didstringThe full DID, e.g. did:anima:ag_...

Rotate keys

If a key is compromised or you need to cycle credentials, rotate the agent’s verification key:
POST /api/identity/did/:did/rotate
After rotation, the previous key enters a grace period (72 hours by default) before expiring. During this window both keys are valid, giving time for any in-flight messages signed with the old key to be verified. Contact support to adjust the grace period for your organization.

API reference

EndpointMethodDescription
GET /api/identity/did/:didGETResolve a DID to its document
POST /api/identity/didPOSTCreate a DID for an agent
POST /api/identity/did/:did/rotatePOSTRotate the agent’s verification key
To explicitly create a DID (or specify the key type), POST to /api/identity/did:
{
  "agentId": "ag_8f3k2m9x1n4p7q6r",
  "keyType": "Ed25519"
}