REST API

REST API endpoints for agent registration, queries, and discovery

Self Agent ID exposes REST endpoints for registration workflows, agent queries, and A2A discovery. All endpoints are served from the web app deployment.

The full OpenAPI 3.1 spec is available at openapi.yamlarrow-up-right in the main repository — import it into Postman or use it to generate clients.

For interactive documentation, visit selfagentid.xyz/api-docsarrow-up-right.

Public Query Endpoints

These endpoints require no authentication.

Get Agent Info

GET /api/agent/info/{chainId}/{agentId}

Returns agent registration details, verification status, and credentials.

Example response:

{
  "agentId": 5,
  "chainId": 11142220,
  "agentAddress": "0x83fa4380903fecb801F4e123835664973001ff00",
  "isVerified": true,
  "proofProvider": "0x5E61c3051Bf4115F90AacEAE6212bc419f8aBB6c",
  "verificationStrength": 2,
  "strengthLabel": "Standard",
  "credentials": {
    "nationality": "GBR",
    "olderThan": 18,
    "ofac": [false, false, false]
  },
  "registeredAt": 1740000000,
  "network": "testnet"
}

List Agents by Human Address

Returns all agent IDs registered by a specific human wallet address.

Example response:

Verify Agent Proof-of-Human

Checks whether an agent has valid proof-of-human verification, the proof provider address, verification strength, and Sybil metrics.

Example response:

Get Agent Card

Returns the A2A-compatible agent identity card in JSON format.

Get Reputation Score

Returns the agent's verification strength score from the proof provider.

Example response:

Get Verification Status

Returns real-time proof status and freshness.

Example response:

A2A Discovery

Redirects to the agent card resolver. Compatible with A2A agent discovery protocols.

A2A Protocol (JSON-RPC)

Agent-to-Agent JSON-RPC 2.0 endpoint for programmatic interaction. Agents can register, verify, look up, deregister, and check proof freshness through natural language or structured intents.

Example request:

Supported intents: register, status, lookup, verify, deregister, freshness, help.

All intents default to mainnet. Add network: "testnet" or chainId: 11142220 for Celo Sepolia (mock documents via the Self app — no real passport needed).

Service Discovery

Returns the service discovery document with API base URL, supported networks, registration modes, and capabilities.

Example response:

Registration Endpoints

Used by the dApp and CLI during registration flows. Sessions use encrypted tokens with a 30-minute TTL.

Create Registration Session

Creates a new registration session. Returns session token, QR code data, deep link, and the generated agent address.

Request body:

Modes: linked, wallet-free, ed25519, ed25519-linked, privy, smartwallet. Networks: mainnet (default, real passports via Self app), testnet (mock documents via Self app, no real passport needed).

Example response:

Poll Registration Status

Polls for registration completion. Returns stage: qr-ready, proof-received, completed, or failed.

Example response:

Get QR Code

Returns the QR code payload and deep link for the current session.

Self App Callback

Webhook endpoint called by the Self app after the user scans the QR and submits a passport proof.

Export Agent Private Key

After registration completes, export the agent's private key. Only available for linked, wallet-free, ed25519, and ed25519-linked modes.

Example response:

Deregistration Endpoints

Create Deregistration Session

Creates a deregistration session for an existing agent. The human must re-prove identity to burn the agent NFT.

Request body:

Poll Deregistration Status

Returns current deregistration stage. Once completed, the agent NFT has been burned.

Deregistration Callback

Webhook endpoint for the Self app after the user confirms deregistration.

Demo Endpoints

Used by the live demo page for testing agent verification patterns. All demo endpoints require x-self-agent-* signed headers (produced by SelfAgent.signRequest()).

Verify Agent (Service Pattern)

Accepts a signed agent request, verifies signature and on-chain status, returns agent info and credentials.

Agent-to-Agent

Demo agent endpoint that verifies the caller, checks sameHuman(), and signs its response. Response headers include the demo agent's own x-self-agent-* signature for mutual verification.

Chain Verify (Meta-Transaction)

Relayer endpoint that submits EIP-712 meta-transactions to the AgentDemoVerifier contract. Rate limited to 3 per hour per human nullifier.

Request body:

Census (Aggregated Stats)

Demonstrates agent-gated data contribution and reading.

AI Chat

AI agent chat endpoint backed by a LangChain agent. Signed requests are verified on-chain; unsigned requests are treated as anonymous.

Request body:

AA Proxy Endpoints

Account-abstraction proxy for the smart-wallet registration mode. These endpoints proxy JSON-RPC calls to a Pimlico bundler/paymaster, shielding the API key from the client. Origin-restricted and rate-limited.

Issue AA Proxy Token

Issues a short-lived token required by the bundler and paymaster endpoints. Rate limited to 30 requests per minute per IP.

Example response:

Bundler Proxy

Proxies ERC-4337 bundler JSON-RPC calls. Requires the x-aa-proxy-token header from the token endpoint.

Allowed methods: eth_chainId, eth_supportedEntryPoints, eth_estimateUserOperationGas, eth_sendUserOperation, eth_getUserOperationReceipt, eth_getUserOperationByHash, eth_gasPrice, eth_maxPriorityFeePerGas.

Request body (JSON-RPC 2.0):

Paymaster Proxy

Proxies ERC-4337 paymaster JSON-RPC calls. Requires the x-aa-proxy-token header.

Allowed methods: pm_sponsorUserOperation, pm_getPaymasterData, pm_getPaymasterStubData, eth_chainId.

Authentication

  • Public endpoints (info, agents, verify, cards, reputation, verify-status, discovery): No authentication required

  • Demo endpoints: Require x-self-agent-* headers (signed via SDK)

  • Registration endpoints: Session-based with encrypted tokens, used by dApp/CLI

  • AA Proxy endpoints: Origin-restricted + x-aa-proxy-token header (from /api/aa/token)

Chain ID Parameter

All endpoints that accept a chainId parameter support:

  • 42220 — Celo Mainnet

  • 11142220 — Celo Sepolia Testnet

circle-exclamation

Error Codes

All errors return { "error": "message" } with the appropriate HTTP status.

Code
Meaning

400

Bad request — invalid parameters, missing fields, or wrong mode

401

Invalid or tampered session token / missing auth headers

403

Origin check failed or agent verification failed

404

Agent not found on-chain

409

Operation not available at current session stage / replay detected

410

Session expired (30-minute TTL)

413

Request too large (AA proxy, 200 KB limit)

429

Rate limit exceeded

500

Server error — RPC failure or configuration issue

503

Service not configured (bundler, paymaster, or LangChain)

Last updated