Create an AI agent as a draft
POST /ai_agents
/ai_agentsCreates an AI agent as a DRAFT: it is saved, but nothing runs from it and no automation can use it until it is published with publish_ai_agent. Everything is optional; what is not sent takes its default (no instructions, no tools, limits of 10 tool calls, 120 seconds and 0.25 EUR per task, access for the whole team, no own cap).
When to use: To save a new agent. To start from an idea, call propose_ai_agent first and send its answer here (it has the same keys). To improve an agent that already exists, use update_ai_agent.
When not to use: Do not create a second agent when list_ai_agents shows one with the same purpose: improve that one. Creating does not publish and does not spend anything; to try the draft use run_ai_agent with version: draft.
Side effects: The agent appears in Settings › AI agents of Easymailing as a draft, created by the person who owns the token. Nothing is published, sent or charged. When Maia makes the request, it cannot set a tool that writes in auto (automatic) mode (see the errors).
Permissions: Requires the automations.manage capability. It also needs AI in the plan (maia.access). The account must also have CRM Pro.
Value for the X-Auth-Token header parameter.
In: header
The new AiAgent resource
TypeScript Definitions
Use the request body type in TypeScript.
AI agents of the public API (ADR-0195). Generated from the approved proposal (2026-11-16) by trabajo/2026-11-15-agentes-ia/fase-4-api-publica/tools/gen_ai_agents_api.py; the texts are the proposal's, with the deviations the code imposes (notas.md § 10).
Every operation checks its capability in the provider or processor before the use case ({@see \App\Application\Automation\ApiAiAgentAccess}),
because API Platform evaluates security after the provider; the rules live in the CoreBundle use cases (Service\App\AiAgent), the
same the internal API runs. The definition travels in snake_case ({@see \App\Api\State\Mapper\Automation\AiAgentDefinitionTranslator}).
/ai_agents/actions/propose is propose_ai_agent, not an agent.
Response Body
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://api.easymailing.com/ai_agents" \ -H "X-Auth-Token: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "icon": "agent-spark", "draft": {}, "access": "team", "period_cap": {} }'{ "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f", "name": "string", "description": "string", "icon": "string", "status": "draft", "published_version": 1, "unpublished_changes": true, "access": "team", "period_cap": {}, "tool_types": [ "string" ], "draft": {}, "published": {}, "used_in": 0, "spent_last_30_days": {}, "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4", "updated_by": "deea00dc-b6b6-4412-a483-26ac61e1f6fe", "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "archived_at": "2019-08-24T14:15:22Z"}