API Documentation
Complete reference for the AY Agent Identity API. Create agents with verifiable W3C DID identities, manage guardrails, and verify credentials — all via REST.
https://api.aytwin.aiQuickstart
Create your first agent in 3 steps. Each agent gets a W3C DID, Ed25519 keypair, API key, and a Verifiable Credential — automatically.
Sign up and get an access token
Create an account on aytwin.ai. Authenticate via OIDC to get a Bearer token for the management API.
Create an Agent
curl -X POST https://api.aytwin.ai/api/v1/agents \
-H "Authorization: Bearer <your-oidc-token>" \
-H "Content-Type: application/json" \
-d '{
"name": "My Commerce Agent",
"type": "commerce",
"description": "Handles product search and recommendations",
"service_endpoint": "https://my-agent.example.com",
"skills": [
{ "id": "product-search", "name": "Product Search", "description": "Search products by query" }
]
}'Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Commerce Agent",
"type": "commerce",
"did": "did:webvh:QmeSsqqj...:api.aytwin.ai:agents:550e8400-e29b-41d4-a716-446655440000",
"did_document": { ... },
"passport_vc": "eyJhbGciOiJFZERTQSIsInR5cCI6InZjK2p3dCJ9...",
"api_key": "ay_agent_a1b2c3d4e5f6...",
"created_at": "2026-04-07T12:00:00.000Z"
}api_key is shown only once. Store it securely.Verify your agent is alive
curl https://api.aytwin.ai/api/v1/agents/me \
-H "Authorization: Bearer ay_agent_a1b2c3d4e5f6..."Authentication
Two authentication methods depending on the caller:
User Management
OIDC Bearer Token
For creating and managing agents
Authorization: Bearer eyJhbG...Agent Self-Auth
API Key
For agent self-identification
Authorization: Bearer ay_agent_...Agents API
/api/v1/agentsCreate a new agent with DID identity, API key, and Verifiable Credential.
Request Body
{
"name": "string (3-100 chars, required)",
"type": "general | commerce | support | data-processor | iot | creative",
"description": "string (max 500 chars, optional)",
"service_endpoint": "URL where your agent runs (optional)",
"skills": [{ "id": "string", "name": "string", "description": "string" }]
}Response (201)
Returns agent details including the one-time API key and signed Verifiable Credential.
/api/v1/agentsList all agents owned by the authenticated user.
/api/v1/agents/:idGet agent details including daily spending.
/api/v1/agents/:id/configUpdate agent guardrails: kill switch, spending limits.
{
"kill_switch": true,
"daily_limit_eur": 50.00,
"max_spend_per_tx_eur": 10.00
}/api/v1/agents/:idDeactivate an agent. Revokes API key, marks DID as deactivated.
/api/v1/agents/meAgent self-identification. Returns agent info, daily spend, and config.
curl https://api.aytwin.ai/api/v1/agents/me \
-H "Authorization: Bearer ay_agent_a1b2c3d4..."DID Identity
Every agent gets a W3C Decentralized Identifier (DID) using the did:webvh method — the same approach used by the Swiss government e-ID (swiyu). Each DID has a cryptographically verifiable history log, making it tamper-evident without a blockchain.
Identity Hierarchy
Human
did:webvh:...:users:uuidSecure Enclave P-256Twin
did:webvh:...:twins:uuidKMS Ed25519Agent
did:webvh:...:agents:uuidKMS Ed25519Fetch DID Document
curl https://api.aytwin.ai/agents/<agent-id>/did.jsonFetch did:webvh Log (verifiable history)
curl https://api.aytwin.ai/agents/<agent-id>/did.jsonlReturns a JSONL file where each line is a log entry. Entries are hash-chained — modifying any entry breaks the chain. Each entry contains a DataIntegrityProof signed with eddsa-jcs-2022.
Public Endpoints — No Auth Required
Verifiable Credentials
Every agent receives a Verifiable Credential (VC) at creation — an EdDSA-signed JWT that proves the agent's identity. Anyone with AY's public key can verify it offline, no API call needed.
Decode the VC
The passport_vc is a standard JWT with 3 base64url-encoded parts (header.payload.signature):
# Decode the payload (middle part)
echo "eyJpc3Mi..." | base64 -d | jq .
# Result:
{
"iss": "did:webvh:Qm...:api.aytwin.ai",
"sub": "did:webvh:Qm...:agents:550e8400...",
"vct": "AgentPassport",
"name": "My Commerce Agent",
"type": "commerce",
"owner": "did:webvh:Qm...:users:7c9e6679...",
"skills": ["product-search"],
"iat": 1743897600,
"exp": 1775433600
}Verify the Signature
// Node.js — verify with @noble/curves (zero deps beyond this)
import { ed25519 } from '@noble/curves/ed25519';
const [header, payload, signature] = vc_jwt.split('.');
const sigBytes = Buffer.from(signature, 'base64url');
const dataBytes = new TextEncoder().encode(header + '.' + payload);
// Fetch AY's public key from DID Document
const didDoc = await fetch('https://api.aytwin.ai/.well-known/did.json').then(r => r.json());
const publicKeyB64 = didDoc.verificationMethod[0].publicKeyJwk.x;
const publicKey = Buffer.from(publicKeyB64, 'base64url');
const isValid = ed25519.verify(sigBytes, dataBytes, publicKey);
console.log('VC is valid:', isValid);Token Status List
Check if an agent's credential has been revoked or suspended:
curl https://api.aytwin.ai/api/v1/identity/status-list
# Response:
{
"status_list": "<DEFLATE compressed, base64url encoded>",
"bits": 2,
"total": 42
}
# Status values (2 bits per agent):
# 0 = VALID
# 1 = SUSPENDED (kill_switch active, reversible)
# 2 = REVOKED (agent deleted, permanent)Rate Limits
/agents/did/session/did/register/agents/me/:id/did.json(l)/identity/status-list