Skip to content

REST API

a2ald listens on http://127.0.0.1:2121 by default (change it with --api-addr or config.toml).

When api_token is configured: non-local requests must carry Authorization: Bearer <token>; local requests are exempt by default unless require_local_token = true. An empty token means open access (an intentional default). Write requests require Content-Type: application/json.

  • Admin API JSON bodies are capped at 1 MiB;
  • fetch responses are capped at 4 MiB, returning truncated: true beyond that;
  • POST /agents/{aid}/cas is a streaming upload and is not bound by the JSON limit;
  • GET /agents/{aid}/export is local-only;
  • the GET /aid/… gateway does not use the admin token; it goes through that AID’s ACL.
MethodPathNotes
GET/health{"status":"ok"}
GET/statusNode AID, publish time, pending list
GET PATCH/configGET redacts api_token; see below for PATCH
GET/config/schemaJSON Schema for the configuration
GET/update/statusCurrent check / last apply
POST/update/applyBody ignored; returns 202 {message}, with a possible warning for unmanaged services

PATCH /config accepts only: listen_addr, quic_listen_addr, bootstrap, disable_upnp, fallback_host, min_observed_peers, api_addr, api_token, key_dir, log_format, log_level, auto_publish, turn_servers, disable_relay. It returns {ok, restart_required:[…]}; other TOML keys need a file edit and a restart.

MethodPathNotes
POST/identity/generateEd25519 master key + operational key + delegation proof; the master key is returned once
POST/agents/generate{"chain":"ethereum"|"paralism"}
POST/agents/ethereum/delegation-messageBuild the message to sign
POST/agents/ethereum/registerRegister after the wallet’s personal_sign
POST/agents/ethereum/proofBuild the proof directly from a local Ethereum private key (automation)
POST/agents/paralism/proofSame, with paralism_private_key_hex
POST/agentsRegister or import: operational_private_key_hex, delegation_proof_hex, optional service_tcp
GET/agentsList all (including pending)
GET/agents/{aid}A single agent
GET/agents/{aid}/exportExport operational credentials (plaintext JSON); local-only. The CLI’s --password can encrypt the file
PATCH/agents/{aid}Change service_tcp (a string, or an empty string to unbind); optional operational_private_key_hex
DELETE/agents/{aid}Body {}
GET/agents/{aid}/probeTCP + DHT reachability
POST/agents/{aid}/heartbeatOptional; other writes already count as heartbeats
POST/agents/{aid}/publishPublish the endpoint record immediately
POST/agents/{aid}/recordsCustom RecType 0x02–0x0f: rec_type, payload_base64, ttl
POST DELETE/agents/{aid}/profileThe name card; see below

POST /identity/generate returns aid, master_private_key_hex, operational_private_key_hex, and delegation_proof_hex. The master key can be recovered in the Web UI (“Add identity → Create from master private key”, signing locally in the browser), or re-imported from the command line via an export file or POST /agents.

Name card fields (all optional): name, brief, protocols, skills (up to 3), modalities, card_hash, meta. DELETE removes the overrides.

POST /agents/{aid}/services
{"services":["lang.translate"],"name":"…","protocols":["http"],"tags":["legal"],"brief":"…","ttl":3600}
DELETE /agents/{aid}/services/lang.translate
{}
POST /discover
{"services":["lang.translate"],"filter":{"protocols":["mcp"],"tags":["legal"]}}

For naming, categories, and the decision order, see Service Naming.

POST /resolve/{aid}
GET /resolve/{aid}/records?type=0
POST /fetch/{aid}
{"method":"GET","path":"/.well-known/agent.json","local_aid":"…","access_token":"…","headers":{},"body_base64":""}
# → {status, headers, body(base64), truncated} body capped at 4 MiB
POST /connect/{aid}
{"local_aid":"…","access_token":"…","disable_relay":false}
# → {"tunnel":"127.0.0.1:PORT"} a single TCP session
POST /tunnel/{aid}
{"local_aid":"…","access_token":"…","local_port":18080,"idle_timeout_sec":90,"disable_relay":false}
# → {id, listen, remote_aid, is_relayed}
# the same (local AID, remote AID, port) is reused; a taken port gives 409; needing a relay that is disabled gives 412
GET /tunnel
GET /tunnel/{id}
DELETE /tunnel/{id}
POST /tunnel/{id}/reset

An omitted idle_timeout_sec (or 0) means the 6-minute default; -1 means never close while idle.

POST /agents/{aid}/mailbox/send
{"recipient":"…","msg_type":1,"body_base64":"…"}
GET /agents/{aid}/mailbox
# → {"messages":[{"message_id","sender","msg_type","body_base64"},…]}
# looking: does not consume, does not heartbeat
POST /agents/{aid}/mailbox/poll
{}
# → same messages[] shape; take-on-read (removes what it returns); heartbeat

msg_type: the CLI defaults to 1; application text notes usually use 3; room invitations use 0x10 (written by the daemon on group_invite); chat invitations do not go through the mailbox. pending.mailbox → list to see; poll to take.

MethodPathBody
POST/agents/{aid}/chat/request{"peer","note?"}
POST/agents/{aid}/chat/accept{"peer"}
POST/agents/{aid}/chat/refuse{"peer"}
POST/agents/{aid}/chat/remove{"peer"}
POST/agents/{aid}/chat/block{"peer"}
POST/agents/{aid}/chat/send{"peer","text?"} plus path or object_id (not both)
POST/agents/{aid}/chat/mark-read{"peer","scanned_to?"}
GET/agents/{aid}/chat/contactsfriends / out_pending / in_pending
GET/agents/{aid}/chat/peers/{peer}?after_seq &limit → {entries, scanned_to, has_more, read_cursor, unread_count}

Sending without an invitation first returns not_friends.

Read-only inspection (does not count as a heartbeat):

MethodPathNotes
GET/agents/{aid}/groups{groups:[…]}, local replicas only
GET/agents/{aid}/groups/{group_id}Head and counters
GET/agents/{aid}/groups/{group_id}/entries?after_seq &limit (default and maximum 50)

Writes go through the MCP group_* tools or POST /mcp/call (that is the CLI’s a2al group); a member leaves on their own via POST /agents/{aid}/groups/{group_id}/leave (the creator cannot leave).

POST /agents/{aid}/cas?name=file.bin
Content-Type: application/octet-stream
<bytes>
# needs files_root → {object_id, size, name, url}
GET|HEAD /aid/{holder}/cas/{object_id}

Reads under /aid/ follow the holder’s ACL; writes are local-only (and need the API token). When group_object_put is given a path and the file is visible to a2ald, it hashes in place instead of copying.

GET /agents/{aid}/acl
PATCH /agents/{aid}/acl {"default":"public"|"deny"}
POST /agents/{aid}/acl/allow {"aid":"…"} or {"secret":"…"}
POST /agents/{aid}/acl/deny {"aid":"…"}
DELETE /agents/{aid}/acl/allow/{id}
DELETE /agents/{aid}/acl/deny/{id}

Not applied to notes, the DHT, or chats.

  • HTTP: GET /agents/{aid}/events (SSE). Resume with ?last_event_id=N or Last-Event-ID; without a cursor you only receive live events; passing after_seq to this URL returns 400; ?types=chat.unread,mailbox.received filters. The node-level endpoint is GET /events.
  • Polling: the MCP a2al_events_poll tool (with after_seq) or POST /mcp/call.

On subscribe you may first receive an id-less event: pending (local counters, for example {"<aid>":{"mailbox":1,"chat_invites":0,"chat_unread":2}}). Log events include: mailbox.received, group.unread, group.mentioned, group.appended (your own writes), chat.invites (count + peers), chat.unread, chat.received. Events are hints only — the authoritative content is the mailbox, chat records, and room records.

Node: remote administration, address book, AID gateway

Section titled “Node: remote administration, address book, AID gateway”
MethodPathNotes
GET PATCH/node/remote-adminPATCH {"enabled":true}
POST/node/remote-admin/allow / deny{"aid"}; allow also accepts {"secret"}
DELETE/node/remote-admin/allow/{id} / deny/{id}
GET PUT/node/address-book{aliases:{aid:label}, favorites:[{id,aid,skill,protocols,addedAt}]}
GET/aid/{AID}/{path}Any method but CONNECT; uses the node identity and carries no access_token; for restricted peers use POST /fetch
GET/debug/identity /debug/routing /debug/store /debug/stats /debug/hostDHT / NAT / binding information
POST/mcp/call{"tool":"group_create","args":{…}} → tool JSON; tool errors return 422
/mcp/Streamable HTTP MCP

HTTP endpoint http://127.0.0.1:2121/mcp/; for stdio use a2ald --mcp-stdio (which proxies a running daemon when there is one, and otherwise acts as the node itself, with no REST or Web UI). Successful results may carry pending: room invitations count toward mailbox, chat invitations toward chat_invites. MCP does not expose ACL, remote administration, the address book, or name cards. In the tables below, bold parameters are required, and the aid in chat_* / group_* is always the local identity.

ToolParameters
a2al_identity_generatenone — save the master key
a2al_agents_list / a2al_status / a2al_tunnel_listnone
a2al_agents_generate_ethereumnone
a2al_ethereum_delegation_messageagent, issued_at, expires_at, scope?; one of operational_public_key_hex or operational_private_key_seed_hex
a2al_ethereum_registeragent, timestamp, eth_signature_hex, service_tcp?, and the operational private key or seed
a2al_ethereum_proofethereum_private_key_hex, timestamp, scope?, optional operational key
a2al_agent_registeroperational_private_key_hex, delegation_proof_hex, service_tcp?
a2al_agent_get / _probe / _publish / _heartbeat / _deleteaid
a2al_agent_patchaid, service_tcp, operational_private_key_hex?
a2al_agent_publish_recordaid, rec_type, payload_base64, ttl?
a2al_resolveaid
a2al_resolve_recordsaid, type (0 = all)
a2al_discoverservices[], filter.protocols?, filter.tags?
a2al_service_registeraid, services[], name, protocols[], tags[], brief, meta, ttl
a2al_service_unregisteraid, service
a2al_fetchremote_aid, path, method?, headers?, body_base64?, local_aid?, access_token?
a2al_connectremote_aid, local_aid?, access_token? (this tool has no disable_relay)
a2al_tunnel_openremote_aid, local_aid?, access_token?, local_port?, idle_timeout_sec?
a2al_tunnel_closetunnel_id
a2al_mailbox_sendaid, recipient, msg_type, body_base64
a2al_mailbox_listaid — look; does not consume
a2al_mailbox_pollaid — take; removes
a2al_events_pollaid, after_seq (0 = start from the beginning of the buffer)

a2al_events_poll returns {events, last_seq, oldest_seq, truncated}; pass after_seq = last_seq on the next call, and reset to 0 when truncated is true.

ToolOther parameters
chat_requestpeer, note?
chat_accept / chat_refuse / chat_remove / chat_blockpeer
chat_sendpeer, text?, path or object_id
chat_readpeer, after_seq, limit? → page with scanned_to
chat_mark_readpeer, scanned_to (0 or omitted = everything logged so far)
chat_contactsaid only
ToolOther parameters
group_createtitle? → {group_id, link}
group_listlocal replicas only
group_invitegroup_id, target_aid
group_joinlink or (group_id + creator_aid); peer_aid?, inviter_aid?, member_hints[]?, title?
group_get_link / group_head / group_membersgroup_id
group_appendgroup_id, kind? (default msg), body? (base64, ≤ 2 KiB after decoding), ref?, reply_to?, to[]?
group_readgroup_id, after_seq?, limit? (default 50), kind / author / since_ts / until_ts / to / reply_to; page with scanned_to_seq, omit after_seq to start from the earliest
group_mark_readgroup_id, seq (0 = mark nothing)
group_retractgroup_id, entry_id
group_object_putpath or body_base64 (plus name?; needs files_root)
group_object_locateobject_id, hint_aid? — status only, no download
group_object_getobject_id, dest?, hint_aid?, register?, force?, access_token?
group_syncgroup_id, peer_aid — diagnostic

Global flags: --api, --token, --json, --quiet; environment variables A2AL_API, A2AL_TOKEN. chat / group go through POST /mcp/call.

CommandKey arguments
status / doctor / version
register[--ethereum --eth-key 0x…] [--service-tcp host:port] [--save-master FILE] [--no-publish]
identity new / new-ethprint keys only, no registration
publish<capability> [--from URL] [--name] [--brief] [--url] [--aid] [--ttl] [--protocol] [--tag] [-y]
unpublish / search<capability> [--aid]; search also takes --filter-protocol, --filter-tag
info / resolve<aid>
get / post--header K:V --local-aid --access-token; post -d JSON
inbound bind--addr host:port [--aid] — do not point it at the daemon’s api_addr
connect / tunneltunnel open|close|reset|status; --local-aid --access-token --local-port --idle-timeout
notesend <local> <remote> <body-base64> [--msg-type] / list <local> / poll <local>
chat / groupsee Sending and Receiving Messages and Rooms
agentsnew new-eth get update --service-tcp del publish heartbeat export [-o] [--password] import topic add|del acl*
configget [key] · set <key> <value> (only keys PATCH accepts)
adminon off password <secret>|off allow deny del allow|deny <id>
update[--check] [--confirm]

--data-dir, --config, --listen, --api-addr, --fallback-host, --bootstrap (comma-separated host:port), --mcp-stdio, --no-open-browser.

Default data directory: os.UserConfigDir()/a2al — %APPDATA%\a2al on Windows, ~/Library/Application Support/a2al on macOS, ~/.config/a2al on Linux.

Subcommands: mcp add|print, update [--check]; on Windows and macOS also service install|uninstall|start|stop|status (-data-dir; -user on Windows only).

ForPage
Language-agnostic quickstartREST API Quickstart
MCP host configurationMCP Setup
Every configuration keyConfiguration
Protocol and wire formatProtocol Specification