Guide
Agent API — Atlas for AI agents
The Agent API exposes tool execution endpoints that AI agents use to send WhatsApp messages, search knowledge, and track delivery — all scoped to the agent's granted permissions. It is the simplest path for any external AI runtime to interact with Mirai.
Two APIs, one transport layer
Atlas API
For developer integrations — OAuth apps, service accounts, webhook consumers. Full audit log, run history, and fine-grained scopes.
Base: /v1/atlasAgent API
For AI agents — tool execution, manifest discovery, knowledge search. Simplified auth model, single scope gates all operations.
Base: /agent/v1Available tools
send_messageatlas.actions.executeReply to a customer in an existing WhatsApp conversation.
POST /agent/v1/tools/send_message
Body: { conversation_id, text, category? }send_message_to_phoneatlas.actions.executeSend to any phone number — creates or reuses customer and conversation automatically.
POST /agent/v1/tools/send_message_to_phone
Body: { phone_number, text, template_id?, category? }search_knowledgeatlas.knowledge.readSearch the shared knowledge base for grounded answers.
GET /agent/v1/knowledge/search?query=...&top_k=5get_message_statusatlas.actions.executePoll delivery status of a sent message by provider_message_id.
GET /agent/v1/tools/messages/:providerMessageId/statusmanifestatlas.actions.executeDiscover all tools available to this agent from its granted scopes.
GET /agent/v1/tools/manifestThe 24-hour window
WhatsApp allows free-form messages only within 24 hours of a customer's last message. After that window closes, you must use a pre-approved WhatsApp template.
Window open
Send text freely. No template required.
Window closed
Include template_id and set category to match.
Delivery feedback loop
After sending a message, poll for status or subscribe to the agent.message_delivery webhook event to be notified when the message transitions from sent → delivered → read.
GET /agent/v1/tools/messages/:providerMessageId/status
Response:
{ "ok": true, "data": { "status": "delivered", "updated_at": "..." } }
status: sent | delivered | read | failedError handling
UNAUTHORIZEDCheck your Bearer token is valid and not expired.
FORBIDDENYour API key is missing atlas.actions.execute — ask your administrator to add it.
NOT_FOUNDThe conversation_id does not exist or belongs to a different org.
VALIDATION_ERRORRequest body failed validation — check field types and required fields.
CONFLICTIdempotency key reused with a different payload — use a new key.
Quick start
- 1Get an API key with
atlas.actions.executescope from the Developer Console. - 2Call
GET /agent/v1/tools/manifestto see which tools are available. - 3Send messages with
POST /agent/v1/tools/send_messageorPOST /agent/v1/tools/send_message_to_phone. - 4Poll
GET /agent/v1/tools/messages/:id/statusor subscribe toagent.message_deliverywebhooks.