Create a procedure
POST/v2/agents/{agentId}/procedures
Add a procedure to an agent: a named list of plain-language steps that tells it how to handle one type of customer request.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Creates a procedure for an agent. Call it to roll out the same handling rules to several agents from a script, or to keep your procedures in a repository and publish them from there.
Request
POST /v2/agents/{agentId}/procedures
Path parameters:
| Name | Type | Required | Description |
|---|---|---|---|
agentId |
string | Yes | The ID of the agent, starting with agt_. |
Body fields:
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | The name of the procedure, for example Refund request. Names are unique within an agent. |
steps |
array of strings | Yes | At least one step, in order. Write each step as a plain sentence. |
description |
string | No | Tells the agent when the procedure applies. |
enabled |
boolean | No | false saves the procedure without using it. Defaults to true. |
Write each step as one instruction, such as "Look up the order." Steps can name an action of the agent, for example "Escalate to a human." Read How procedures run to see how the agent picks and follows a procedure.
Example request
curl -X POST https://api.askocto.co/v2/agents/agt_8f3k2m/procedures \
-H "Authorization: Bearer $OCTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Refund request",
"description": "Use when a customer asks for their money back.",
"steps": [
"Look up the order.",
"If the order is under 30 days old, offer a refund.",
"Otherwise offer store credit and escalate if the customer objects."
]
}'
const response = await fetch("https://api.askocto.co/v2/agents/agt_8f3k2m/procedures", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Refund request",
description: "Use when a customer asks for their money back.",
steps: [
"Look up the order.",
"If the order is under 30 days old, offer a refund.",
"Otherwise offer store credit and escalate if the customer objects.",
],
}),
})
const procedure = await response.json()
console.log(procedure.id, procedure.enabled)
Example response
A successful call returns 201 Created with the new procedure.
{
"id": "prc_3v8k5d",
"agentId": "agt_8f3k2m",
"name": "Refund request",
"description": "Use when a customer asks for their money back.",
"steps": [
"Look up the order.",
"If the order is under 30 days old, offer a refund.",
"Otherwise offer store credit and escalate if the customer objects."
],
"enabled": true,
"createdAt": "2026-03-18T11:20:00Z",
"updatedAt": "2026-03-18T11:20:00Z"
}
Response fields
The response is a procedure object. Its fields are described in List procedures. The agent follows an enabled procedure from its next message. Run a few test conversations in the dashboard under Test > Playground to see which procedure it picked.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request |
name is missing, steps is missing or empty, or a step is not a non-empty string. |
| 401 | unauthorized |
The API key is missing, malformed or deleted. |
| 404 | not_found |
No agent has this ID in your workspace. |
| 409 | conflict |
The agent already has a procedure with this name. |
| 429 | rate_limited |
Too many requests. Wait for the number of seconds in the Retry-After header. |