AGENTIC
NAME
SERVICE
Critical Infrastructure for Our Agentic Future
Test Drive

API Documentation

Most agents use ANS through the agent MCP tools below — high-level tools the deployed MCP server exposes over POST /mcp with body { "tool": "tool_name", "params": { ... } }. Call ans_authenticate once, then ans_check_permission before each action. Everything beneath that — the trilateral-handshake primitives, the REST surface, and the SDK — is the underlying infrastructure, for building against the low level directly.

The agent-tool reference below is generated directly from the deployed server's tool definitions, so it always matches what the server actually exposes.

4
Agent MCP Tools
5
Onboarding Tools
4
Gateway Primitives
6
Guardian Primitives
Agent MCP Tools Onboarding Tools Underlying: Gateway Underlying: Guardian Coordination Node SDK Error Codes Attestation OpenAPI Specs

Agent MCP Tools

The primary interface most agents use — the tools the deployed ANS MCP server exposes over POST /mcp. ans_authenticate runs the full trilateral handshake for you; you do not call the low-level primitives directly.

POST /mcp tool: "ans_check_permission"
Check whether an action is permitted by the current ANS delegation credential. Returns allowed, escalate, or denied. No network call — evaluation is local.
ParamTypeDescription
servicestringrequiredService key (e.g. 'service:github-mcp' or 'mcp:github:list_repos')
toolstringoptionalOptional tool/action name to check against allowed_actions patterns
contextobjectoptionalOptional context (e.g. { amount: 100, currency: 'USD' })
POST /mcp tool: "ans_authenticate"
Authenticate with a service via the ANS trilateral handshake. Contacts the Gateway and Guardian to obtain a delegation credential. Call this before using ans_check_permission.
ParamTypeDescription
service_namestringrequiredThe service to authenticate with (e.g. 'github-mcp')
POST /mcp tool: "ans_get_session"
Get the current ANS session status. Returns credential metadata if authenticated, or indicates no active session.
POST /mcp tool: "ans_restore_context"
Retrieve prior context checkpoint for an agent+service pair. Returns structured checkpoint data for context recovery before or during a new session. When checkpoint_id is omitted, returns the most recent checkpoint.
ParamTypeDescription
service_namestringrequiredThe service name to restore context for
checkpoint_idstringoptionalOptional: specific checkpoint ID to restore. If omitted, returns the most recent checkpoint.

Onboarding & Catalog Tools

Agent-driven service onboarding and catalog access on the user's gateway. Each requires a delegation chain carrying the noted scope.

POST /mcp tool: "ans.gateway.register_service"
Register a service to the user's gateway. The calling agent must hold a delegation chain with scope 'service:onboard'. Wraps POST /api/services/register on the Gateway.
ParamTypeDescription
agent_didstringrequiredThe calling agent's DID.
issuance_idstringrequiredIssuance ID identifying the signing key on Guardian.
agent_private_key_jwkobjectrequiredAgent's ECDSA P-256 private key in JWK form (d, x, y, kty='EC', crv='P-256').
delegationobjectrequiredAgent's delegation chain (must include user_did, agent_did, issuance_id, scopes).
service_namestringrequiredDisplay name for the service.
service_descriptionstringoptional
minimum_attestation_levelstringoptional
supported_oob_methodsarrayoptional
max_session_duration_secondsnumberoptional
service_callback_urlstringoptional
POST /mcp tool: "ans.gateway.add_service"
Add an already-registered service from the catalog to the user's gateway. The calling agent must hold a delegation chain with scope 'service:add'. Wraps POST /api/services/add on the Gateway.
ParamTypeDescription
agent_didstringrequired
issuance_idstringrequired
agent_private_key_jwkobjectrequired
delegationobjectrequired
service_didstringrequiredDID of the catalog-registered service to add.
POST /mcp tool: "ans.gateway.authorize_service"
Initiate the Authorize-Service ceremony for a registered service on the user's gateway. The calling agent must hold a delegation chain with scope 'service:authorize'. Wraps POST /api/ceremonies/authorize-service/initiate on the Gateway, which pass-throughs to Guardian.
ParamTypeDescription
agent_didstringrequired
issuance_idstringrequired
agent_private_key_jwkobjectrequired
delegationobjectrequired
service_didstringrequired
request_contextobjectoptional
POST /mcp tool: "ans.catalog.list_manifests"
List signed service manifests in the catalog. The calling agent must hold a delegation chain with scope 'catalog:read'. Wraps GET /api/catalog/manifests on the Gateway. Returns paginated entries.
ParamTypeDescription
agent_didstringrequired
issuance_idstringrequired
agent_private_key_jwkobjectrequired
delegationobjectrequired
pagenumberoptional
limitnumberoptional
searchstringoptional
POST /mcp tool: "ans.catalog.get_manifest"
Fetch a single signed service manifest by service_did. The calling agent must hold a delegation chain with scope 'catalog:read'. Wraps GET /api/catalog/manifests/:service_did on the Gateway.
ParamTypeDescription
agent_didstringrequired
issuance_idstringrequired
agent_private_key_jwkobjectrequired
delegationobjectrequired
service_didstringrequired

Underlying infrastructure — the primitives below are wrapped by the agent tools above. Use them directly only if you are building against the underlying protocol (e.g. via the SDK).

Gateway API

The Gateway is the service-side trust anchor. It generates challenges, verifies Guardian signatures, and issues receipts.

Base URL: https://agenticnameservice.ai

Handshake primitives — wrapped by ans_authenticate, not called directly by agents

POST /mcp tool: "get_uns_status"
Returns Gateway operational status.
// Response
{
  "gateway_id": "did:uns:gateway:dev-01",
  "registration_status": "active",
  "version": "0.0.1",
  "supported_attestation_levels": ["session_only", ..., "hardware_key"]
}
POST /mcp tool: "get_service_manifest"
Returns the service manifest for a registered service.
ParamTypeDescription
service_namestringrequiredService slug identifier
POST /mcp tool: "get_uns_challenge"
Generates a cryptographic challenge for the trilateral handshake. Returns nonce + dual Gateway signatures.
ParamTypeDescription
service_namestringrequiredService to authenticate for
service_account_idstringoptionalReturning user's hashed account ID
request_contextobjectoptionalFlat key-value metadata (feature, action, amount, etc.)
dynamic_overrideobjectoptionalPer-request attestation override
// Response
{
  "nonce": "64-char hex",
  "gateway_id": "did:uns:gateway:dev-01",
  "service_name": "my-service",
  "attestation_level_required": "passkey",
  "service_gateway_sig": "hex (5-field canonical)",
  "gateway_sig": "hex (7-field canonical)",
  "issued_at": "ISO 8601",
  "expires_in": 300
}
POST /mcp tool: "submit_signed_token"
Submits the Guardian-signed token. Verifies signature, calls service callback, assembles receipt.
// Response (success)
{ "receipt_id": "uuid", "status": "authorized" }

// Response (error)
{ "error": { "code": "ANS_SIGNATURE_INVALID", "message": "...", "retryable": false } }

REST Endpoints (19)

Health & Info

GET /api/info
Gateway identity, public key, and node ID.
GET /api/health
Operational health check.

Services

GET /api/services
List all registered services.
POST /api/services
Register a new service (service onboarding).
GET /api/services/:name
Get a specific service's details and manifest.

Receipts

GET /api/receipts
Query all receipts. Supports filtering by service_name.
GET /api/receipts/:receipt_id
Get a specific receipt. Requires Authorization header for Guardian receipt sync.

Rules & Stats

GET /api/rules/:service_name
Get attestation rules for a service.
GET /api/stats
Operational statistics (handshake counts, success rates).
GET /api/rule-changes
Rule change audit history.

Onboardings & Admin

GET /api/onboardings
Service onboarding archive (R2-backed).
GET /api/admin/pending-receipts
Receipts awaiting Guardian sync. Admin only.

Guardian API

The Guardian is the user's Identity Guardian — a commercial entity competing on who protects the user's identity best. It verifies challenges, evaluates policy, signs tokens, and manages OOB authentication.

Base URL: https://guardian.agenticnameservice.ai

Signing primitives — internal Guardian tools, wrapped by the agent tools above

POST /mcp tool: "sign_token_request"
Agent relays the Gateway challenge. Guardian verifies signatures, evaluates policy, signs token.
ParamTypeDescription
noncestringFrom challenge
gateway_idstringFrom challenge
service_namestringFrom challenge
attestation_level_requiredstringFrom challenge
service_gateway_sigstringFrom challenge
gateway_sigstringFrom challenge
oob_request_idstringFor polling after OOB approval
// Response (auto-approved)
{ "guardian_sig": "hex", "approval_source": "rule", ... }

// Response (OOB required)
{ "status": "pending_approval", "oob_request_id": "oob_xxx" }
POST /mcp tool: "register_service_account"
retired Direct write path retired — use the ans.gateway.register_service agent tool above.
ParamTypeDescription
gateway_idstringGateway DID
service_namestringService slug
gateway_endpointstringGateway URL
manifestobjectService manifest (optional, avoids Worker-to-Worker fetch)
POST /mcp tool: "refetch_manifest"
Agent triggers manifest re-fetch from Gateway. Updates cached attestation levels and OOB methods.
ParamTypeDescription
gateway_idstringGateway DID
service_namestringService slug
POST /mcp tool: "configure_rules"
User configures per-service delegation rules (auto-approve thresholds, spending limits).
POST /mcp tool: "query_receipts"
Query user's authentication receipts with filtering.

REST Endpoints (48)

Info & Sessions

GET /api/info
Guardian identity, brand name, and public key.
GET /api/session/status
Current session status (authenticated, user_id, display_name).

Authentication

POST /api/signup
Create a Guardian account. Requires display_name + email or phone.
POST /api/signin/options + /api/signin/complete
WebAuthn passkey authentication flow. Returns session cookie (24h, HttpOnly).
POST /api/signout
Clear session cookie.

Passkeys (WebAuthn)

GET /api/passkeys
List user's registered passkeys. Requires session.
POST /api/passkey/register/options + /api/passkey/register/complete
Register a new passkey (WebAuthn registration ceremony).
POST /api/passkey/authenticate/options + /api/passkey/authenticate/complete
Authenticate with passkey (WebAuthn assertion).

TOTP (Authenticator App)

GET /api/totp/status
Check if TOTP is enrolled for the user.
POST /api/totp/setup
Generate TOTP secret and QR code URI.
POST /api/totp/verify-setup
Confirm TOTP enrollment with a verification code.

Agents

POST /api/agents/register
Enlist a new agent with the Guardian.
GET /api/agents
List user's enlisted agents.
GET / DELETE /api/agents/:agent_id
Get or revoke a specific agent.

OOB Approval

GET /api/oob/pending
Get pending OOB approval request. Requires session.
POST /api/oob/send
Trigger OOB notification to user.
POST /api/oob/verify
Verify OOB approval (passkey assertion).
POST /api/oob/reject
Reject pending OOB request.
POST /api/oob/verify-totp
Verify OOB approval via TOTP code.
POST /api/oob/preference
Record user's preferred OOB method (demand signal).

Services & Registrations

GET /api/services
List user's registered service accounts.
GET /api/services/:name
Get service account details. Supports block/unblock/revoke sub-paths.
POST /api/services/:name/block / unblock
Block (reversible) or unblock a service. (Revoke moved to POST /internal/services/:name/revoke — HMAC-gated; see WO-495.)

Devices

GET /api/devices
List enrolled devices.
POST /api/devices/enroll
Enroll a new device.
GET / DELETE /api/devices/:device_id
Get or remove a device.

Registrations & Enlistments

GET /api/registrations
List service account registrations.
POST /api/registrations/check
Check if a service is registered (by gateway_id + service_name).
GET /api/registrations/archived / :id
Archived (revoked) registrations.
GET /api/enlistments / :id
Agent enlistment records (R2-archived).

Account & Verification

GET /api/account
Get user account details.
POST /api/verify
Verify email or phone.

Ceremonies & Receipts

POST /api/ceremony/run
Server-side ceremony execution (used by visualization). Requires session.
POST /api/ceremony/complete
Complete a pending ceremony (after OOB approval).
GET /api/receipts
Query user's receipts.
GET /api/receipts/:receipt_id
Get specific receipt. Also accepts Gateway HTTP Signature for receipt sync.
POST /api/receipts/notify
Gateway notifies Guardian of completed receipt (receipt sync).

QA & Diagnostics

GET /api/qa/ceremonies
List ceremony traces with filtering (outcome, service, date range).
GET /api/qa/ceremonies/:id
Get full ceremony trace JSON (per-step payloads, verification checks).
POST /api/qa/ceremonies/client-trace
Submit client-side ceremony trace (captures network failures invisible to server).
GET /api/tests/results
Test suite results for QA dashboard.

Coordination Node API

The Coordination Node is the DNS-like directory. Single shared instance serving all environments. Stores public keys and endpoints for Gateways and Guardians.

Base URL: https://cn.agenticnameservice.ai

GET /lookup/:node_id
Public key lookup. No auth required. 5-minute cache, 24-hour stale fallback.
// GET /lookup/did:uns:gateway:dev-01
{
  "node_id": "did:uns:gateway:dev-01",
  "public_key": "04...",
  "endpoint_url": "https://...",
  "node_type": "gateway",
  "status": "active"
}
POST /register
Register a Gateway or Guardian. Requires X-UNS-Admin-Key + mandatory proof_of_possession.
POST /rotate
Key rotation. Proof of possession with NEW key. 24-hour transition window.
GET /resolve/did:uns:*
DID resolution. Returns same data as /lookup.
GET /api/admin/nodes
List all registered nodes. Requires X-UNS-Admin-Key header.

SDK — underlying infrastructure

Most agents should use the agent MCP tools above. The SDK is the client for developers building directly against the underlying trilateral handshake. Install: npm install @agentic-name-service/sdk · npm

import { AgentClient } from "@agentic-name-service/sdk";

const agent = new AgentClient({
  gatewayUrl: "https://agenticnameservice.ai",
  guardianUrl: "https://guardian.agenticnameservice.ai",
});

// Authenticate — runs the full trilateral handshake against the primitives below
const receipt = await agent.authenticate("my-service", {
  requestContext: { feature: "transfer", amount: 500 },
  onOobRequired: (id, url) => {
    console.log("User must approve at:", url);
  },
});

console.log("Authorized:", receipt.receipt_id);

Error Codes

All errors follow the format: { "error": { "code": "ANS_...", "message": "...", "retryable": bool, "timestamp": "ISO 8601" } }

CodeHTTPRetryableDescription
ANS_INVALID_REQUEST400NoMalformed request
ANS_UNAUTHORIZED401NoMissing auth
ANS_SIGNATURE_INVALID401NoSig verification failed
ANS_IDENTITY_INVALID503YesNode identity self-check failed
ANS_ATTESTATION_LEVEL_MISMATCH403YesProvided < required
ANS_SERVICE_NOT_REGISTERED404NoService not in Guardian
ANS_SERVICE_BLOCKED403NoUser blocked service
ANS_NONCE_EXPIRED410NoNonce TTL exceeded (5 min)
ANS_NONCE_REPLAY409NoNonce already consumed
ANS_OOB_FAILED401YesOOB auth failed
ANS_USER_DECLINED403NoUser rejected request
ANS_DYNAMIC_OVERRIDE_BELOW_FLOOR400NoOverride below minimum
ANS_SERVICE_CALLBACK_TIMEOUT504YesService callback >10s
ANS_SERVICE_CALLBACK_ERROR502YesService callback 5xx
ANS_MANIFEST_SIGNATURE_INVALID403NoManifest signature verification failed
ANS_MANIFEST_CHANGED409YesManifest changed during handshake
ANS_RATE_LIMITED429YesRate limit exceeded
ANS_NODE_NOT_FOUND404NoNode not in CN registry
ANS_ROTATION_IN_PROGRESS409YesKey rotation already in progress

Full catalog: 28+ error codes. See packages/protocol-types/src/errors.ts.

Attestation Hierarchy

8 levels, weakest to strongest. Stronger satisfies weaker.

LevelIndexDescription
session_only0No user interaction
email_confirmation1Email code
sms_otp2SMS code via Twilio Verify
totp3Authenticator app (RFC 6238)
device_signature4Software keypair signature
passkey5WebAuthn/FIDO2 (UP flag set, may use PIN)
biometric6WebAuthn with UV=true (Touch ID, Face ID)
hardware_key7FIDO2 hardware security key

Note: passkey does NOT satisfy biometric. A passkey assertion with UV=true (User Verified) maps to biometric level. On devices without biometric hardware, passkeys may be approved with only a password.

Integration Guides

GuideDescription
Cloudflare WorkerAdd ANS authentication to your Cloudflare Worker in 15 minutes. Auth middleware, receipt verification, attestation-level gating.
LangChainUse ANS receipts as tool authorization in LangChain. Python and TypeScript examples with custom BaseTool pattern.
Custom GuardianBuild a custom Identity Guardian. 6 MCP tools, D1/KV/R2 infrastructure, key generation, canonical signing, OOB authentication.
First Handshake Tutorial"Register Your First Service" — zero to a working receipt in under 30 minutes.

Full guides available in the docs/guides/ directory.

OpenAPI Specifications

Machine-readable API definitions in OpenAPI 3.1 format:

SpecDescription
api/gateway/openapi.yamlGateway REST API (19 endpoints)
api/gateway/mcp-tools.yamlGateway MCP tools (4 tools)
api/guardian/openapi.yamlGuardian REST API (48 endpoints)
api/guardian/mcp-tools.yamlGuardian MCP tools (6 tools)
api/coordination-node/openapi.yamlCoordination Node public API
api/coordination-node/openapi-admin.yamlCoordination Node admin API
api/shared/schemas.yamlShared schema definitions (71 schemas)

Generated MCP tool catalogs (JSON): api/generated/gateway-mcp-tools.json and api/generated/guardian-mcp-tools.json. Regenerate with pnpm generate:mcp.