Create agent

POST/v2/agents

Create a support, sales or guidance agent in your workspace by setting its name, instructions, model, language and settings.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Creates an agent in your workspace. Call it when you provision agents from a script, for example one per brand, region or customer.

Request

POST /v2/agents

Body fields:

Name Type Required Description
name string Yes Display name of the agent.
type string No support, sales or guidance. Defaults to support.
instructions string No Plain-language guidance on the role, tone and scope of the agent.
model string No The model the agent answers with. Defaults to the workspace default. The options are listed under Build > Models.
language string No Main reply language as a two-letter code, for example en.
settings object No visibility (public or private), rateLimit, initialMessages and suggestedMessages. Omitted fields use their defaults.

The new agent starts with the status draft. Add knowledge with Create source, then publish the agent in the dashboard under Settings > Versions. The steps are in Your first agent.

Example request

curl -X POST https://api.askocto.co/v2/agents \
  -H "Authorization: Bearer $OCTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sales assistant",
    "type": "sales",
    "language": "en",
    "instructions": "Help visitors pick the right plan and offer to book a demo.",
    "settings": { "initialMessages": ["Hello, want help choosing a plan?"] }
  }'
const response = await fetch("https://api.askocto.co/v2/agents", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Sales assistant",
    type: "sales",
    language: "en",
    instructions: "Help visitors pick the right plan and offer to book a demo.",
    settings: { initialMessages: ["Hello, want help choosing a plan?"] },
  }),
})

const agent = await response.json()
console.log(agent.id, agent.status)

Example response

A successful call returns 201 Created with the new agent.

{
  "id": "agt_2q7w5n",
  "name": "Sales assistant",
  "type": "sales",
  "status": "draft",
  "model": "octo-balanced",
  "instructions": "Help visitors pick the right plan and offer to book a demo.",
  "language": "en",
  "createdAt": "2026-03-18T11:00:00Z",
  "updatedAt": "2026-03-18T11:00:00Z",
  "settings": {
    "visibility": "public",
    "rateLimit": {
      "enabled": true,
      "message": "You are sending messages quickly. Please wait a moment."
    },
    "initialMessages": ["Hello, want help choosing a plan?"],
    "suggestedMessages": []
  }
}

Response fields

The response is an agent object. Its fields are described in the Agents overview. Use the returned id in every call that takes an agentId, such as Update agent.

Errors

Status Code When
400 invalid_request name is missing, or type, language, model or a settings field has an invalid value.
401 unauthorized The API key is missing, malformed or deleted.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

Something unclear or missing? Tell us and we will fix the page.