Create AI agent
/api/v1/ext/ai-agents
Create an agent. It is a draft unless you send status.
name and role are required. config_metadata is the agent's configuration — the same fields as the AI Agents page:
• model — a reply model id from List AI models; tone; company_info; context_string (extra context).
• ghl_tag — the contact tag that hands a contact to this agent.
• initial_messages — the opening message(s), one is picked per contact; followUps — [{ text, delay: { days, hours, minutes } }] sent while the contact has not replied.
• qualification_enabled and questions — [{ id, text }], asked before the goal; faqs — [{ question, answer }].
• config — the goal: end_goal is "Book Appointment" (with calendar_provider and calendar_id / calendar_ids), "Send booking link" (with booking_link_text: the message, then the URL on the next line) or "Custom call to action" (with call_to_action, and qualification on). disqualify_trigger says when to stop.
• execution_window — the hours it may message in.
A draft does nothing. To switch it on send status: "active" here or later with Update AI agent; the activation check then needs an opening message and a goal with what it needs (a calendar for booking, a URL and message for a booking link, qualifying questions for a call to action) — what is missing comes back as a 400.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| workspace_id | body | number | yes | A workspace of the installer. |
| name | body | string | yes | Agent name, up to 255 characters. |
| role | body | string | yes | What the agent is for. |
| persona | body | string | no | Who it speaks as, and how. |
| status | body | enum | no | active runs the activation check (an opening message, a goal, and what that goal needs). |
| config_metadata | body | object | no | The configuration — see the description above. |
Responses
| Status | When |
|---|---|
201 | Created |
400 | Missing or invalid field |
401 | Missing or invalid token |
403 | Missing scope |
404 | workspace_id does not exist or is not the installer's (same response for both) |
502 | The AI service could not be reached |
Response schema
ai_agentobjectidstringAgent id.
a3f1c2d4-5b6e-4f70-8a91-b2c3d4e5f607namestringAgent name.
ReviverolestringWhat the agent is for — its job, in a sentence or two.
personastringWho it speaks as, and how.
statusstring`draft`, `active` (answering) or `paused`.
draftworkspace_idstringThe workspace it works in.
7config_metadataobjectThe whole configuration: model, tone, opening messages, follow-ups, qualifying questions, FAQs, goal and calendar. See Create AI agent.
created_atstring (ISO 8601)Created.
updated_atstring (ISO 8601)Last saved.
curl -X POST "https://backend.mysmsgateway.app/api/v1/ext/ai-agents" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": 7,
"name": "Revive",
"role": "Reactivate old leads for Harbour Dental and book them in for a check-up.",
"persona": "Sam, a friendly front-desk assistant at Harbour Dental. Short, warm messages.",
"config_metadata": {
"model": "gpt-4.1-mini",
"tone": "Friendly",
"ghl_tag": "revive-2026",
"initial_messages": [
"Hi {{contact.first_name}}, it's Sam from Harbour Dental. It's been a while — would you like to book a check-up?"
],
"followUps": [
{
"text": "Just checking in, {{contact.first_name}} — any time suit you this week?",
"delay": {
"days": 2,
"hours": 0,
"minutes": 0
}
}
],
"config": {
"end_goal": "Book Appointment",
"calendar_provider": "native",
"calendar_id": "12",
"calendar_ids": [
"12"
]
}
}
}'{
"success": true,
"message": "AI agent created",
"data": {
"id": "a3f1c2d4-5b6e-4f70-8a91-b2c3d4e5f607",
"name": "Revive",
"role": "Reactivate old leads for Harbour Dental and book them in for a check-up.",
"persona": "Sam, a friendly front-desk assistant at Harbour Dental. Short, warm messages.",
"status": "draft",
"workspace_id": "7",
"config_metadata": {
"model": "gpt-4.1-mini",
"tone": "Friendly",
"ghl_tag": "revive-2026",
"company_info": "Harbour Dental, Sydney. Check-ups, cleaning, whitening.",
"initial_messages": [
"Hi {{contact.first_name}}, it's Sam from Harbour Dental. It's been a while — would you like to book a check-up?"
],
"followUps": [
{
"text": "Just checking in, {{contact.first_name}} — any time suit you this week?",
"delay": {
"days": 2,
"hours": 0,
"minutes": 0
}
}
],
"qualification_enabled": true,
"questions": [
{
"id": "q1",
"text": "Is it a check-up or something hurting?"
}
],
"faqs": [
{
"question": "Do you take insurance?",
"answer": "Yes, all major funds."
}
],
"config": {
"end_goal": "Book Appointment",
"calendar_provider": "native",
"calendar_id": "12",
"calendar_ids": [
"12"
],
"disqualify_trigger": "Not interested or moved away"
}
},
"created_at": "2026-10-28T09:00:00.000Z",
"updated_at": "2026-10-28T09:00:00.000Z"
}
}« Get AI agent
Update AI agent »
