> ## 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.

# Verifiable Credentials

> Issue, verify, and revoke W3C Verifiable Credentials for AI agents. Credential types, presentation, and revocation lists.

# Verifiable Credentials

Anima supports W3C Verifiable Credentials (VCs) so agents can prove capabilities, authorizations, and affiliations to other agents or services without exposing underlying secrets.

## Credential Lifecycle

1. **Issuance** -- An issuer (your organization) creates a signed credential for an agent
2. **Holding** -- The agent stores the credential in its identity wallet
3. **Presentation** -- The agent presents the credential to a verifier
4. **Verification** -- The verifier checks the signature, issuer, and revocation status
5. **Revocation** -- The issuer can revoke a credential at any time

## Credential Types

| Type                  | Description                                            |
| --------------------- | ------------------------------------------------------ |
| `AgentAuthorization`  | Grants the agent permission to act on behalf of an org |
| `SpendingLimit`       | Attests to the agent's approved spending budget        |
| `ServiceAccess`       | Grants access to a specific external service           |
| `DomainVerification`  | Proves the agent is authorized for an email domain     |
| `ComplianceClearance` | Attests the agent has passed compliance checks         |

## Issuing Credentials

<Tabs items={["Node.js", "Python", "Go"]}>
  <Tab value="Node.js">
    ```ts theme={null}
    import { Anima } from "@anima-labs/sdk";

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

    const credential = await anima.identity.credentials.issue({
      agentId: "ag_8f3k2m9x1n4p7q6r",
      type: "AgentAuthorization",
      claims: {
        organization: "Acme Corp",
        role: "purchasing-agent",
        maxSpendUsd: 10000,
      },
      expiresAt: "2027-01-01T00:00:00Z",
    });

    console.log(credential.id);        // "vc_3n7k..."
    console.log(credential.proof);     // Ed25519 signature
    ```
  </Tab>

  <Tab value="Python">
    ```python theme={null}
    from anima import Anima

    anima = Anima(api_key="ak_...")

    credential = anima.identity.credentials.issue(
        agent_id="ag_8f3k2m9x1n4p7q6r",
        type="AgentAuthorization",
        claims={
            "organization": "Acme Corp",
            "role": "purchasing-agent",
            "maxSpendUsd": 10000,
        },
        expires_at="2027-01-01T00:00:00Z",
    )

    print(credential.id)
    ```
  </Tab>

  <Tab value="Go">
    ```go theme={null}
    import "github.com/anima-labs-ai/go"

    client := anima.NewClient("ak_...")

    cred, err := client.Identity.Credentials.Issue(ctx, &anima.IssueCredentialParams{
        AgentID: "ag_8f3k2m9x1n4p7q6r",
        Type:    "AgentAuthorization",
        Claims: map[string]any{
            "organization": "Acme Corp",
            "role":         "purchasing-agent",
            "maxSpendUsd":  10000,
        },
        ExpiresAt: "2027-01-01T00:00:00Z",
    })
    ```
  </Tab>
</Tabs>

## Verifying Credentials

```
POST https://api.useanima.sh/api/identity/credentials/verify
```

```json theme={null}
{
  "credential": "<JWT or JSON-LD credential>",
  "checkRevocation": true
}
```

<Tabs items={["Node.js", "Python"]}>
  <Tab value="Node.js">
    ```ts theme={null}
    const result = await anima.identity.credentials.verify({
      credential: credentialJwt,
      checkRevocation: true,
    });

    if (result.valid) {
      console.log("Credential is valid, issued by:", result.issuer);
    } else {
      console.log("Invalid:", result.errors);
    }
    ```
  </Tab>

  <Tab value="Python">
    ```python theme={null}
    result = anima.identity.credentials.verify(
        credential=credential_jwt,
        check_revocation=True,
    )

    if result.valid:
        print(f"Valid, issued by: {result.issuer}")
    else:
        print(f"Invalid: {result.errors}")
    ```
  </Tab>
</Tabs>

## Revoking Credentials

```
POST https://api.useanima.sh/api/identity/credentials/:credentialId/revoke
```

<Tabs items={["Node.js", "Python"]}>
  <Tab value="Node.js">
    ```ts theme={null}
    await anima.identity.credentials.revoke("vc_3n7k...", {
      reason: "Agent decommissioned",
    });
    ```
  </Tab>

  <Tab value="Python">
    ```python theme={null}
    anima.identity.credentials.revoke("vc_3n7k...", reason="Agent decommissioned")
    ```
  </Tab>
</Tabs>

Revoked credentials are added to a StatusList2021 revocation list. Verifiers automatically check this list when `checkRevocation` is enabled.

## API Reference

| Endpoint                                                           | Method | Description             |
| ------------------------------------------------------------------ | ------ | ----------------------- |
| `https://api.useanima.sh/api/identity/credentials`                 | POST   | Issue a new credential  |
| `https://api.useanima.sh/api/identity/credentials/:id`             | GET    | Retrieve a credential   |
| `https://api.useanima.sh/api/identity/credentials/verify`          | POST   | Verify a credential     |
| `https://api.useanima.sh/api/identity/credentials/:id/revoke`      | POST   | Revoke a credential     |
| `https://api.useanima.sh/api/identity/credentials/revocation-list` | GET    | Get the revocation list |

## Configuration

| Variable                    | Default | Description                         |
| --------------------------- | ------- | ----------------------------------- |
| `ANIMA_VC_ISSUER_DID`       | auto    | DID used to sign issued credentials |
| `ANIMA_VC_DEFAULT_EXPIRY`   | `365d`  | Default credential expiration       |
| `ANIMA_VC_REVOCATION_CHECK` | `true`  | Check revocation on verification    |

## Next Steps

* [DID Method](/identity/did-method) -- Understand the underlying DID infrastructure
* [Agent Cards](/identity/agent-cards) -- Publish agent capabilities for discovery
* [Agent Registry](/registry/overview) -- Register agents for public discovery
