Create Action

Actions

Create Action

Give the agent a call to your own API, with placeholders it fills from what the customer said. Dotted placeholders are filled by the platform, never the model: {{call.id}} (the id GET /calls lists), {{call.from}}, {{call.to}}, {{call.direction}} (empty outside a call), {{conversation.id}}, {{contact.id}}, {{contact.phone}}, {{agent.id}}, {{workspace.id}} and {{test.chat}} (true during a test chat, empty otherwise) — in the path, query, body or a header value, never the host; an unknown one is refused. Every call also sends X-Call-Id, X-Conversation-Id, X-Agent-Id and X-Workspace-Id when known, and X-Test-Chat: true during a test chat (POST /agents/{id}/test-chat), where the call values are empty and X-Call-Id is absent — so your endpoint can answer without writing anything. A new action is always off: test it with POST …/test, then PATCH enabled: true — sending enabled here is refused. Header values are sealed on arrival and never returned. A build key may do this.

POST/agents/{id}/actions

Path parameters

idstringrequired
The agent's id (ag_…).

Headers

Katexs-Workspacestring
Developers only: the customer workspace this request acts in — its org_… id from POST /customers. Leave it out to act in your own workspace. Refused with 404 (Workspace not found.) when the id is unknown, is not one of your customers, or is not an org_… id; 410 when that customer was deleted (restore it with POST /customers/{id}/restore until it is erased); 403 when the key belongs to one customer workspace (it cannot act as another); 400 when your workspace is not a developer workspace. /customers/* and GET /customers/usage are your own workspace's and refuse the header with 400: call them without it.

Request body

namestringrequired
The tool name the agent sees: 3 to 40 characters, lower case letters, numbers and underscores, starting with a letter. It cannot be one of the agent's built-in tools, and must be unique on this agent.
descriptionstringrequired
When the agent should call it, in a sentence (at least 10 characters). The model decides from this alone.
urlstring (uri)required
An https:// address, with {{placeholders}} for parameters. Every placeholder needs a parameter of that name. Addresses inside private networks are refused when called.
methodstring
The HTTP method; any case is accepted. One of: GET, POST, PUT, PATCH, DELETE. Default: GET.
parametersobject[]
Up to 20 values the agent fills from the conversation. Names must be unique.
parameters[].namestringrequired
The placeholder's name, used as {{name}} in url and bodyTemplate: lower case letters, numbers and underscores, starting with a letter (3 to 40 characters).
parameters[].descriptionstringrequired
What the value is. The model fills it from the conversation using this alone — never leave it vague.
parameters[].requiredboolean
Whether the agent must have this value before it may call. Default: false.
bodyTemplatestring | null
A JSON body with quoted placeholders, e.g. {"id": "{{order_id}}"}. It must still be valid JSON once the blanks are filled.
headersobject
Up to 10 headers, name to value — typically Authorization. Write-only: sealed on arrival; only their names come back, as headerNames. Blank values are dropped.
speakBeforestring | null
On calls, what the agent says while your API is being called.
speakAfterstring | null
On calls, what the agent says while it turns your answer into a reply.

Example request

bash
curl -X POST "https://app.katexs.com/api/v1/agents/{id}/actions" \
  -H "Authorization: Bearer $KATEXS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "get_appointment",
  "description": "Look up a patient'\''s next appointment by their phone number before answering anything about timings.",
  "method": "GET",
  "url": "https://api.sunrisedental.in/appointments?phone={{phone}}",
  "parameters": [
    {
      "name": "phone",
      "description": "The patient'\''s mobile number with country code, e.g. +14155550134",
      "required": true
    }
  ],
  "headers": {
    "Authorization": "Bearer sk_clinic_7Hq2…"
  },
  "speakBefore": "One moment, let me check the diary."
}'

Responses

StatusDescription
201The action, switched off.
400A rule is broken; the sentence says which.
401The key is missing, wrong or revoked. The answer is always the same, whichever it is.
403The key's access level (read-only or build) does not allow this request, the plan does not include it, or a customer's key named another workspace in Katexs-Workspace. code says which: key_scope_read, key_scope_build, workspace_header_forbidden, or forbidden.
404The agent is not in this workspace.
409The agent already has an action of that name.
410The customer named in Katexs-Workspace was deleted. POST /customers/{id}/restore brings it back until its erase date.
429Over a per-minute limit. Wait for Retry-After seconds. code and limit say which limit: rate_limit_resources (240 requests a minute for the workspace), rate_limit_family (2,400 across a developer's customers), rate_limit_calls, rate_limit_messages, rate_limit_codes, rate_limit_code_recipient, concurrent_calls or number_daily_limit.
503Headers were sent and this deployment cannot store credentials.

Response fields

idstringrequired
The action's id (act_…).
agentstringrequired
The agent it belongs to (ag_…).
namestringrequired
The tool name the agent sees.
descriptionstringrequired
When the agent should call it.
methodstringrequired
The HTTP method used. One of: GET, POST, PUT, PATCH, DELETE.
urlstringrequired
The https:// address, with {{placeholders}} — declared parameters, or the platform's dotted ones such as {{call.id}}. The host must be written out: no placeholder before the path.
parametersobject[]required
What the agent fills in.
bodyTemplatestring | nullrequired
The JSON body sent, with quoted placeholders; null for none.
headerNamesstring[]required
The names of the headers sent. Their values are write-only and never returned.
speakBeforestring | nullrequired
On calls, what the agent says while your API is being called.
speakAfterstring | nullrequired
On calls, what the agent says while it turns your answer into a reply.
enabledbooleanrequired
Whether the agent may call it. A new action is always false.
createdAtstring (date-time)required
When it was made.
updatedAtstring (date-time)required
When it last changed.
201 response
{
  "id": "act_9b2f4e17-6c3a-4d81-b5e2-7a0c9d3f1e46",
  "agent": "ag_3f6a9c21-7d4e-4b58-9a1f-0c2e8b7d5a34",
  "name": "get_appointment",
  "description": "Look up a patient's next appointment by their phone number before answering anything about timings.",
  "method": "GET",
  "url": "https://api.sunrisedental.in/appointments?phone={{phone}}",
  "parameters": [
    {
      "name": "phone",
      "description": "The patient's mobile number with country code, e.g. +14155550134",
      "required": true
    }
  ],
  "bodyTemplate": null,
  "headerNames": [
    "Authorization"
  ],
  "speakBefore": "One moment, let me check the diary.",
  "speakAfter": null,
  "enabled": false,
  "createdAt": "2026-10-05T09:41:00.210Z",
  "updatedAt": "2026-10-05T09:41:00.210Z"
}

Last updated November 2026 · Found a problem? Email support@katexs.com