# AI Agents | Signal House API Docs

> Create and manage AI agents with the Signal House API: profiles, prompts, voice, and model settings.

Source: https://docs.signalhouse.io/agents

---

## AI Agents

### GET /agent/voices

List the voices an agent can be configured to speak with. The catalog is platform-wide rather than per-account, so this endpoint takes no scope. Use a returned voiceId as the voiceId on a spoken channel's setting.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
[
  {
    "voiceId": "Xb7hH8MSUJpSbSDYk0k2",
    "name": "Alice - Clear, Engaging Educator",
    "description": "Clear and engaging, friendly woman with a British accent suitable for e-learning.",
    "previewUrl": "https://storage.googleapis.com/…/d10f7534.mp3",
    "gender": "female",
    "accent": "british",
    "age": "middle_aged",
    "useCase": "informative_educational",
    "language": "en"
  }
]
```

### GET /agent/profiles

List the AI agent profiles under a group. Results are scoped to groups the authenticated caller can access.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | Group whose agent profiles to list. |
| `subgroupId` | Query Param | Optional | Narrow to the agents this subgroup can use — its own, plus the group-level agents shared with every subgroup. |
| `page` | Query Param | Optional | Page number for pagination. |
| `limit` | Query Param | Optional | Results per page (1–1000). |

#### Example Response 200

Response

```json
[
  {
    "_id": "60f7b2a1c9e77c001a2b3c9a",
    "groupId": "G1234567",
    "subgroupId": null,
    "agentProfileId": "AGP0000001",
    "name": "Support Bot",
    "status": "active",
    "systemPrompt": "You are a helpful support agent for Acme.",
    "greeting": "Hi! How can I help you today?",
    "guardrails": "",
    "sendAuthority": "review",
    "publishStatus": "draft",
    "publishedAt": null,
    "createdAt": "2024-01-15T12:00:00.000Z",
    "updatedAt": "2024-01-15T12:00:00.000Z"
  }
]
```

### GET /agent/profiles/:id

Retrieve a single agent profile by ID.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Agent profile ID. |

#### Example Response 200

Response

```json
[
  {
    "_id": "60f7b2a1c9e77c001a2b3c9a",
    "groupId": "G1234567",
    "subgroupId": null,
    "agentProfileId": "AGP0000001",
    "name": "Support Bot",
    "status": "active",
    "systemPrompt": "You are a helpful support agent for Acme.",
    "greeting": "Hi! How can I help you today?",
    "guardrails": "",
    "sendAuthority": "review",
    "publishStatus": "draft",
    "publishedAt": null,
    "createdAt": "2024-01-15T12:00:00.000Z",
    "updatedAt": "2024-01-15T12:00:00.000Z"
  }
]
```

### POST /agent/profiles

Create a new AI agent profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | String | Required | Parent Group ID. |
| `subgroupId` | String|null | Optional | Subgroup to scope the agent to; omit or null for a group-level agent. |
| `name` | String | Required | Agent name. |
| `status` | String | Optional | Lifecycle status — "active" or "inactive" (defaults to "active"). |
| `systemPrompt` | String | Optional | Base system prompt composed into every conversation. |
| `greeting` | String | Optional | Opening line the agent leads with. |
| `guardrails` | String | Optional | Freeform guardrail instructions appended to the composed prompt. |
| `sendAuthority` | String | Optional | Default send authority: "review" (each reply is held for a person to approve) or "autopilot" (replies are sent). Defaults to "review". A deployment can override it for one subgroup. |

**Read-only, set only by the publish and unpublish endpoints (a new profile starts as publishStatus "draft", publishedAt null):** `publishStatus`, `publishedAt`

#### Example Request

Request

```json
{
  "groupId": "G1234567",
  "name": "Support Bot",
  "systemPrompt": "You are a helpful support agent for Acme.",
  "greeting": "Hi! How can I help you today?"
}
```

#### Example Response 201

Response

```json
{
  "_id": "60f7b2a1c9e77c001a2b3c9a",
  "groupId": "G1234567",
  "subgroupId": null,
  "agentProfileId": "AGP0000001",
  "name": "Support Bot",
  "status": "active",
  "systemPrompt": "You are a helpful support agent for Acme.",
  "greeting": "Hi! How can I help you today?",
  "guardrails": "",
  "sendAuthority": "review",
  "publishStatus": "draft",
  "publishedAt": null,
  "createdAt": "2024-01-15T12:00:00.000Z",
  "updatedAt": "2024-01-15T12:00:00.000Z"
}
```

### PUT /agent/profiles/:id

Update an existing agent profile. The agent's group/subgroup scope is immutable and cannot be changed.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Agent profile ID to update. |
| `name` | String | Optional | Agent name. |
| `status` | String | Optional | Lifecycle status — "active" or "inactive". |
| `systemPrompt` | String | Optional | Base system prompt composed into every conversation. |
| `greeting` | String | Optional | Opening line the agent leads with. |
| `guardrails` | String | Optional | Freeform guardrail instructions appended to the composed prompt. |
| `sendAuthority` | String | Optional | Default send authority: "review" or "autopilot". Deployments with a sendAuthorityOverride keep their override; deployments with a null override inherit this value. |

**Rejected with 400 if sent (read-only, set only by the publish and unpublish endpoints):** `publishStatus`, `publishedAt`

#### Example Request

Request

```json
{
  "name": "Support Bot (v2)",
  "greeting": "Thanks for reaching out — how can I help?"
}
```

#### Example Response 200

Response

```json
{
  "_id": "60f7b2a1c9e77c001a2b3c9a",
  "groupId": "G1234567",
  "subgroupId": null,
  "agentProfileId": "AGP0000001",
  "name": "Support Bot (v2)",
  "status": "active",
  "greeting": "Thanks for reaching out — how can I help?",
  "sendAuthority": "review",
  "publishStatus": "draft",
  "publishedAt": null,
  "updatedAt": "2024-01-16T14:00:00.000Z"
}
```

### DELETE /agent/profiles/:id

Permanently delete an agent profile. Also removes its deployments, its number bindings, its channel settings, and any tools and knowledge scoped to that agent, along with their provider-side counterparts — tools and knowledge shared across the account are untouched. Conversation records are kept: a transcript outlives the agent that produced it. Fails without deleting anything if a provider-side record cannot be removed, so nothing is left stranded.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Agent profile ID to delete. |

#### Example Response 200

Response

```json
{
  "message": "Agent profile AGP0000001 deleted successfully"
}
```

### POST /agent/messages

Send a message to an agent and get its reply — the app-native conversation endpoint for webchat and SMS. Omit conversationId to start a new conversation, or pass one to continue an existing one. The agent's LLM tool loop runs server-side: the reply and any tools it invoked are returned, and the conversation turns are persisted. When the channel has knowledge\_search enabled, the server searches the agent's knowledge with the message before the model runs, so toolInvocations starts with that knowledge\_search entry even if the model made no tool call of its own. check\_business\_hours results carry hoursConfigured, plus isOpen, timezone and hours (the weekly schedule) when hours are set, or a note, the agent's knowledge about hours, and no isOpen when none are.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | String | Required | The agent to talk to. |
| `channel` | String | Required | Conversation channel — "webchat", "sms", or "voice". |
| `message` | String | Required | The user's message. |
| `conversationId` | String | Optional | Continue this conversation; omit to start a new one. |
| `contactIdentifier` | String | Optional | The far-end identifier (webchat visitor ID or sender number). |

#### Example Request

Request

```json
{
  "agentProfileId": "AGP0000001",
  "channel": "webchat",
  "message": "Are you open right now?"
}
```

#### Example Response 200

Response

```json
{
  "conversationId": "CNV0000002",
  "conversationSessionId": "CVS0000004",
  "reply": "Yes, we're open right now! How can we help you today?",
  "toolInvocations": [
    {
      "name": "check_business_hours",
      "input": {},
      "result": {
        "ok": true,
        "hoursConfigured": true,
        "isOpen": true,
        "timezone": "America/New_York",
        "hours": [
          {
            "day": "monday",
            "closed": false,
            "open": "09:00",
            "close": "17:00"
          }
        ],
        "afterHoursMessage": null
      }
    }
  ],
  "ok": true
}
```

### POST /agent/conversations

Start a conversation without sending a message. The counterpart to POST /agent/messages for callers that run the model themselves — a voice runtime, or your own LLM. Those record what was said; /agent/messages decides it. Both write the same conversation records, so a transcript reads identically either way.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | String | Required | The agent this conversation belongs to. |
| `channel` | String | Required | Conversation channel — "webchat", "sms", or "voice". |
| `contactIdentifier` | String | Optional | The far-end identifier (visitor ID or caller number). |
| `callId` | String | Optional | Telephony call ID, for the voice channel. |
| `metadata` | Object | Optional | Arbitrary metadata stored with the conversation. |

#### Example Request

Request

```json
{
  "agentProfileId": "AGP0000001",
  "channel": "voice",
  "contactIdentifier": "+15555550123",
  "callId": "CALL_12345"
}
```

#### Example Response 201

Response

```json
{
  "conversationId": "CNV0000002",
  "conversationSessionId": "CVS0000004",
  "agentProfileId": "AGP0000001",
  "channel": "voice",
  "status": "active",
  "contactIdentifier": "+15555550123",
  "callId": "CALL_12345",
  "messageCount": 0
}
```

### GET /agent/conversations/:conversationId

Read one conversation with a page of its messages, in sequence order. Paged rather than whole — a transcript has no natural ceiling, so omitting limit returns the first 100 messages, not all of them.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `conversationId` | URL Param | Required | The conversation to read. |
| `page` | Number | Optional | Page number; defaults to 1. |
| `limit` | Number | Optional | Messages per page; defaults to 100, capped at 500. |

#### Example Response 200

Response

```json
[
  {
    "conversationId": "CNV0000002",
    "agentProfileId": "AGP0000001",
    "channel": "voice",
    "status": "completed",
    "messageCount": 2,
    "messages": [
      {
        "conversationMessageId": "CVM0000001",
        "sequence": 0,
        "role": "assistant",
        "content": "Thanks for calling — how can I help?"
      },
      {
        "conversationMessageId": "CVM0000002",
        "sequence": 1,
        "role": "user",
        "content": "I'd like to check my order."
      }
    ]
  }
]
```

### POST /agent/conversations/:conversationId/messages

Append one message to a conversation. Records a turn rather than generating one, so role is explicit — an assistant turn your own runtime produced is the normal case here. content is optional, so a tool-only turn needs no prose. Appending to a conversation that has already ended is rejected.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `conversationId` | URL Param | Required | The conversation to append to. |
| `role` | String | Required | "user", "assistant", "system", or "tool". |
| `content` | String | Optional | What was said. Up to 32,000 characters. |
| `toolCalls` | Object\[\] | Optional | Tools invoked on this turn (up to 50). |
| `toolResults` | Object\[\] | Optional | Their results (up to 50). |
| `ttfbMs` | Number | Optional | Time to first byte/audio, in milliseconds. |
| `latencyMs` | Number | Optional | Total turn latency, in milliseconds. |
| `bargeInOccurred` | Boolean | Optional | Whether the far end talked over this turn. |

#### Example Request

Request

```json
{
  "role": "assistant",
  "content": "Thanks for calling — how can I help?",
  "ttfbMs": 420
}
```

#### Example Response 201

Response

```json
{
  "conversationMessageId": "CVM0000001",
  "conversationId": "CNV0000002",
  "conversationSessionId": "CVS0000004",
  "sequence": 0,
  "role": "assistant",
  "content": "Thanks for calling — how can I help?",
  "ttfbMs": 420
}
```

### PUT /agent/conversations/:conversationId

End a conversation, closing its open session. status records HOW it ended and cannot be recovered afterwards, so send the one that actually happened. The transition is conditional on the conversation still being active, so an already-ended conversation is returned unchanged and concurrent retries cannot overwrite the status that landed first. The call that ends it fires AI\_AGENT\_CONVERSATION\_ENDED to every Global webhook subscribed to it, once; a retried end fires nothing. SMS conversations nobody has texted in for 24 hours are ended for you, with endReason idle\_timeout. Voice conversations can't be ended here: the voice service ends each one when its call ends, and their length is what the call's AI Voice Agent charge is based on, so ending one returns 403.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `conversationId` | URL Param | Required | The conversation to end. Not a voice conversation (403). |
| `status` | String | Optional | "completed", "escalated", or "abandoned". Defaults to "completed"; "active" is rejected. |
| `metadata` | Object | Optional | Metadata merged onto the conversation. endReason is passed on as the webhook's endReason. agentSeconds and durationSeconds are reserved for the voice service and are ignored if sent. |

#### Example Request

Request

```json
{
  "status": "escalated",
  "metadata": {
    "endReason": "handed_to_staff"
  }
}
```

#### Example Response 200

Response

```json
{
  "conversationId": "CNV0000002",
  "agentProfileId": "AGP0000001",
  "channel": "webchat",
  "status": "escalated",
  "endedAt": "2026-09-17T18:42:11.000Z",
  "messageCount": 2
}
```

### GET /agent/profiles/:agentProfileId/channels

List an agent's per-channel settings — the tools enabled on each channel, whether the channel is on, and any channel-specific prompt/greeting.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The agent whose channel settings to list. |

#### Example Response 200

Response

```json
[
  {
    "agentChannelSettingId": "ACS0000001",
    "agentProfileId": "AGP0000001",
    "channel": "webchat",
    "allowedTools": [
      "check_business_hours",
      "knowledge_search"
    ],
    "enabled": true,
    "channelPrompt": "",
    "greeting": null,
    "llmProvider": "bedrock",
    "llmModel": null,
    "temperature": 0.7,
    "voiceId": null,
    "speed": null,
    "stability": null,
    "similarityBoost": null,
    "speechModel": null,
    "turnEagerness": null,
    "turnTimeoutSeconds": null,
    "initialWaitSeconds": null,
    "silenceEndCallSeconds": null,
    "maxCallDurationSeconds": null,
    "allowGreetingInterruption": true,
    "keyterms": [],
    "allowedCommitments": [],
    "backgroundSound": null,
    "workflow": null
  }
]
```

### GET /agent/profiles/:agentProfileId/channels/:channel

Get a single per-channel setting for an agent.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The agent the setting belongs to. |
| `channel` | URL Param | Required | Channel — "webchat", "sms", or "voice". |

#### Example Response 200

Response

```json
[
  {
    "agentChannelSettingId": "ACS0000001",
    "agentProfileId": "AGP0000001",
    "channel": "webchat",
    "allowedTools": [
      "check_business_hours"
    ],
    "enabled": true
  }
]
```

### PUT /agent/profiles/:agentProfileId/channels/:channel

Create or update (upsert) an agent's per-channel setting. One row per (agent, channel) — the channel comes from the path, the fields from the body. All body fields are optional; an empty body creates a default-enabled channel with no tools.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The agent the setting belongs to. |
| `channel` | URL Param | Required | Channel — "webchat", "sms", or "voice". |
| `allowedTools` | String\[\] | Optional | Tools enabled on this channel — built-in keys or agentTool ids. Built-in keys: check\_business\_hours, knowledge\_search, escalate\_to\_human (on a call, transfers the caller to a person), send\_sms (texts the caller, voice only) and handoff\_to\_agent (passes the call to another agent, voice only). send\_sms and handoff\_to\_agent on webchat or sms are a 400. escalate\_to\_human and handoff\_to\_agent do nothing on a call unless enabled through an agentTool that carries their config (see POST /agent/tools): enabled by key alone, a transfer tells the agent no one is available. |
| `enabled` | Boolean | Optional | Whether the agent answers on this channel. |
| `channelPrompt` | String | Optional | Channel-specific prompt text appended to the agent's system prompt. |
| `greeting` | String|null | Optional | Channel-specific greeting override. |
| `llmProvider` | String | Optional | LLM backend for this channel — "bedrock", "openai", "anthropic", or "groq" (defaults to "bedrock"). Supported values differ by channel. |
| `llmModel` | String|null | Optional | Concrete model ID for the provider; null for the provider default. |
| `temperature` | Number | Optional | Sampling temperature (0–2). |
| `voiceId` | String|null | Optional | Voice identifier for spoken channels; ignored off the voice channel. |
| `speed` | Number|null | Optional | Spoken channels: speaking rate multiplier (0.7–1.2). |
| `stability` | Number|null | Optional | Spoken channels: voice consistency (0–1). Lower is more expressive and more variable. |
| `similarityBoost` | Number|null | Optional | Spoken channels: how closely synthesis tracks the source voice (0–1). |
| `speechModel` | String|null | Optional | Spoken channels: the speech synthesis model. Separate from llmModel — this decides how the agent is voiced, not what it says. One of eleven\_v3\_conversational (the default for a new channel), eleven\_v4\_turbo, eleven\_v4, eleven\_flash\_v2, eleven\_turbo\_v2 or eleven\_multilingual\_v2; anything else is rejected. Null leaves the default in place. |
| `turnEagerness` | String|null | Optional | Spoken channels: how readily the agent decides the caller has finished — "patient", "normal", or "eager". |
| `turnTimeoutSeconds` | Number|null | Optional | Spoken channels: silence before the agent takes its turn. 1–300, or -1 for no timeout; values between 0 and 1 are rejected. |
| `initialWaitSeconds` | Number|null | Optional | Spoken channels: silence before the agent speaks first. 1–300, or -1 for no timeout. |
| `silenceEndCallSeconds` | Number|null | Optional | Spoken channels: silence before the call is ended outright (10–7200). |
| `maxCallDurationSeconds` | Number|null | Optional | Spoken channels: hard ceiling on one conversation (60–7200). |
| `allowGreetingInterruption` | Boolean | Optional | Spoken channels: whether a caller may talk over the greeting. Defaults to true. |
| `keyterms` | String\[\] | Optional | Spoken channels: words the transcriber is biased toward — names, jargon, unusual spellings. Up to 100. |
| `backgroundSound` | Object|null | Optional | Spoken channels: ambient audio bed as { preset, volume }, where volume is 0.01–1. Null means silence. |
| `allowedCommitments` | Object\[\] | Optional | SMS channel only — a non-empty list on webchat or voice is a 400. The "a person will..." promises the agent may send on autopilot, as { kind, detail }. kind is one of confirm\_booking, call\_back, text\_back, follow\_up, hold\_slot or send\_reminder, each at most once; detail (up to 200 characters, or null) is shown to staff. Any other promise in an autopilot reply is held for review. Defaults to \[\]. |
| `workflow` | Object|null | Optional | Voice channel only — sending one on webchat or sms is a 400. The conversation workflow graph: an object with "nodes" and "edges" keyed by id, plus optional "subgraphs" and "prevent\_subagent\_loops". Each node carries at least a "type" and a "position" ({ x, y }); each edge carries "source" and "target" node ids. Node bodies are defined by the voice runtime and are stored as sent, so a node type this documentation does not list is still accepted. Validated for an entry point under the node key "start\_node" typed "start" (the runtime looks it up by that exact key, so a start node under any other key is rejected), no second "start" node, at most 200 nodes, and every edge endpoint naming a node that exists — a graph failing any of those is rejected rather than stored. Tools are named by our own refs: a node's "additional\_tool\_ids" and a "tool" node's "tools" (\[{ tool\_id }\]) hold built-in keys or agentTool ids, which are stored as sent and swapped for the voice runtime's own tool ids when the workflow is pushed to it; a ref not in this channel's allowedTools is left out of the pushed graph. Paths out of a "tool" node take forward\_condition { type: "result", successful: true|false } — Succeeded or Failed. Null clears a workflow the channel already has. |

#### Example Request

Request

```json
{
  "allowedTools": [
    "check_business_hours",
    "knowledge_search"
  ],
  "enabled": true,
  "llmProvider": "bedrock",
  "temperature": 0.7
}
```

#### Example Response 200

Response

```json
{
  "agentChannelSettingId": "ACS0000001",
  "agentProfileId": "AGP0000001",
  "channel": "webchat",
  "allowedTools": [
    "check_business_hours",
    "knowledge_search"
  ],
  "enabled": true,
  "channelPrompt": "",
  "greeting": null,
  "llmProvider": "bedrock",
  "llmModel": null,
  "temperature": 0.7,
  "voiceId": null,
  "speed": null,
  "stability": null,
  "similarityBoost": null,
  "speechModel": null,
  "turnEagerness": null,
  "turnTimeoutSeconds": null,
  "initialWaitSeconds": null,
  "silenceEndCallSeconds": null,
  "maxCallDurationSeconds": null,
  "allowGreetingInterruption": true,
  "keyterms": [],
  "allowedCommitments": [],
  "backgroundSound": null,
  "workflow": null
}
```

### DELETE /agent/profiles/:agentProfileId/channels/:channel

Delete an agent's per-channel setting.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The agent the setting belongs to. |
| `channel` | URL Param | Required | Channel — "webchat", "sms", or "voice". |

#### Example Response 200

Response

```json
{
  "message": "Channel setting webchat for agent AGP0000001 deleted successfully"
}
```

### GET /agent/profiles/:agentProfileId/deployments

List the subgroups a group-level agent is deployed to, ordered by subgroupId. Each deployment can override the agent's default send authority for its subgroup; a null sendAuthorityOverride means the deployment inherits the profile's sendAuthority. Returns an empty array when the agent is not deployed anywhere.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The agent whose deployments to list. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentProfileNotFoundError` | No agent profile has this agentProfileId. |
| 400 | `ValidationError` | agentProfileId is shorter than 8 characters. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the agent belongs to a group the caller cannot access. |

#### Example Response 200

Response

```json
[
  {
    "_id": "66f7b2a1c9e77c001a2b3d10",
    "groupId": "G1234567",
    "subgroupId": "S1234567",
    "agentDeploymentId": "ADP0000001",
    "agentProfileId": "AGP0000001",
    "sendAuthorityOverride": "autopilot",
    "sendAuthorityChangedBy": "507f1f77bcf86cd799439011",
    "sendAuthorityChangedAt": "2026-09-20T15:04:00.000Z",
    "enabled": true,
    "createdAt": "2026-09-18T12:00:00.000Z",
    "updatedAt": "2026-09-20T15:04:00.000Z"
  },
  {
    "_id": "66f7b2a1c9e77c001a2b3d11",
    "groupId": "G1234567",
    "subgroupId": "S7654321",
    "agentDeploymentId": "ADP0000002",
    "agentProfileId": "AGP0000001",
    "sendAuthorityOverride": null,
    "sendAuthorityChangedBy": null,
    "sendAuthorityChangedAt": null,
    "enabled": true,
    "createdAt": "2026-09-18T12:05:00.000Z",
    "updatedAt": "2026-09-18T12:05:00.000Z"
  }
]
```

### PUT /agent/profiles/:agentProfileId/deployments/:subgroupId

Deploy an agent to a subgroup, or change that deployment (upsert keyed by the subgroup in the path). Only an active, group-level agent (subgroupId null) can be deployed, and the subgroup must belong to the agent's group. Both body fields are optional: an empty body on a new deployment creates an enabled deployment that inherits the agent's default send authority, and on an existing deployment leaves it unchanged. Changing sendAuthorityOverride records who changed it and when (sendAuthorityChangedBy, sendAuthorityChangedAt).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The group-level agent to deploy. |
| `subgroupId` | URL Param | Required | The subgroup to deploy it to. Must start with "S" and be at least 8 characters. |
| `sendAuthorityOverride` | String|null | Optional | "review" or "autopilot" to override the agent's default send authority for this subgroup; null clears the override so the deployment inherits the agent's sendAuthority. Defaults to null on a new deployment. |
| `enabled` | Boolean | Optional | Whether this deployment is live. Defaults to true on a new deployment. Publishing requires at least one enabled deployment. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentProfileNotFoundError` | No agent profile has this agentProfileId. |
| 404 | `SubgroupNotFoundError` | The subgroup does not exist, or it is not under the agent's group. |
| 400 | `ValidationError` | The agent is subgroup-level (only a group-level agent can be deployed), the agent is inactive, a path param is malformed, sendAuthorityOverride is not "review", "autopilot" or null, or the body carries an unknown field. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the agent or subgroup belongs to a group the caller cannot access. |

#### Example Request

Request

```json
{
  "sendAuthorityOverride": "autopilot",
  "enabled": true
}
```

#### Example Response 200

Response

```json
{
  "_id": "66f7b2a1c9e77c001a2b3d10",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentDeploymentId": "ADP0000001",
  "agentProfileId": "AGP0000001",
  "sendAuthorityOverride": "autopilot",
  "sendAuthorityChangedBy": "507f1f77bcf86cd799439011",
  "sendAuthorityChangedAt": "2026-09-20T15:04:00.000Z",
  "enabled": true,
  "createdAt": "2026-09-18T12:00:00.000Z",
  "updatedAt": "2026-09-20T15:04:00.000Z"
}
```

### DELETE /agent/profiles/:agentProfileId/deployments/:subgroupId

Remove an agent's deployment from a subgroup. The removed deployment is returned. The agent's publishStatus is not changed.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The deployed agent. |
| `subgroupId` | URL Param | Required | The subgroup to remove it from. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentProfileNotFoundError` | No agent profile has this agentProfileId. |
| 404 | `AgentDeploymentNotFoundError` | The agent is not deployed to this subgroup. |
| 400 | `ValidationError` | A path param is malformed. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the agent belongs to a group the caller cannot access. |

#### Example Response 200

Response

```json
{
  "_id": "66f7b2a1c9e77c001a2b3d10",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentDeploymentId": "ADP0000001",
  "agentProfileId": "AGP0000001",
  "sendAuthorityOverride": "autopilot",
  "sendAuthorityChangedBy": "507f1f77bcf86cd799439011",
  "sendAuthorityChangedAt": "2026-09-20T15:04:00.000Z",
  "enabled": true,
  "createdAt": "2026-09-18T12:00:00.000Z",
  "updatedAt": "2026-09-20T15:04:00.000Z"
}
```

### GET /agent/endpoints

List the endpoint bindings in a group: which agent answers which number. Each number has at most one agent per channel. Results are ordered by endpointValue, and an empty array is returned when nothing is bound.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | Group whose bindings to list. Must start with "G" and be at least 8 characters. |
| `subgroupId` | Query Param | Optional | Narrow to the bindings of numbers in this subgroup. |
| `agentProfileId` | Query Param | Optional | Narrow to the numbers this agent answers. |
| `channel` | Query Param | Optional | Narrow to one channel — "sms", "webchat", or "voice". Only "sms" bindings can be created today. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 400 | `ValidationError` | groupId is missing or malformed, subgroupId or agentProfileId is malformed, or channel is not "sms", "webchat" or "voice". |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the group is one the caller cannot access. |

#### Example Response 200

Response

```json
[
  {
    "_id": "66f7b2a1c9e77c001a2b3d20",
    "groupId": "G1234567",
    "subgroupId": "S1234567",
    "agentEndpointId": "AEP0000001",
    "channel": "sms",
    "endpointType": "sms_number",
    "endpointValue": "15551234567",
    "agentProfileId": "AGP0000001",
    "answerMode": "all_inbound",
    "overrides": null,
    "enabled": true,
    "createdAt": "2026-10-06T14:00:00.000Z",
    "updatedAt": "2026-10-06T14:00:00.000Z"
  }
]
```

### PUT /agent/endpoints/:channel/:endpointValue

Assign an agent to answer a number (upsert keyed by the channel and number in the path). Assigning again replaces the previous agent, so a number has one agent per channel. Only SMS numbers can be bound today. The number must be in the agent's group and belong to a subgroup, and the agent must be active and usable by that subgroup: either the subgroup's own agent, or a group-level agent with an enabled deployment to the subgroup. The binding is saved whatever the number's campaign state.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `channel` | URL Param | Required | The channel to bind. Must be "sms". |
| `endpointValue` | URL Param | Required | The phone number: 10 to 15 digits, country code included, no "+" (e.g. 15551234567). |
| `agentProfileId` | String | Required | The agent that answers the number. |
| `answerMode` | String | Optional | Which inbound messages the agent answers. "all\_inbound" is the only mode. Defaults to "all\_inbound" on a new binding and keeps the stored value on an existing one. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentProfileNotFoundError` | No agent profile has this agentProfileId. |
| 400 | `NumberNotFoundError` | The number does not exist, or it is not in the agent's group. |
| 400 | `ValidationError` | channel is not "sms", endpointValue is not 10 to 15 digits, agentProfileId is missing, answerMode is not "all\_inbound", the body carries an unknown field, the agent is inactive, the number has no subgroup, the agent belongs to a different subgroup than the number, or a group-level agent is not deployed to the number's subgroup. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the agent or number belongs to a group the caller cannot access. |

#### Example Request

Request

```json
{
  "agentProfileId": "AGP0000001",
  "answerMode": "all_inbound"
}
```

#### Example Response 200

Response

```json
{
  "_id": "66f7b2a1c9e77c001a2b3d20",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentEndpointId": "AEP0000001",
  "channel": "sms",
  "endpointType": "sms_number",
  "endpointValue": "15551234567",
  "agentProfileId": "AGP0000001",
  "answerMode": "all_inbound",
  "overrides": null,
  "enabled": true,
  "createdAt": "2026-10-06T14:00:00.000Z",
  "updatedAt": "2026-10-06T14:00:00.000Z"
}
```

### DELETE /agent/endpoints/:channel/:endpointValue

Remove the agent assigned to a number. The removed binding is returned. The agent and its deployments are not changed.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `channel` | URL Param | Required | The bound channel. Must be "sms". |
| `endpointValue` | URL Param | Required | The phone number: 10 to 15 digits, country code included, no "+". |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentEndpointNotFoundError` | No agent is assigned to this number. |
| 400 | `ValidationError` | channel is not "sms", or endpointValue is not 10 to 15 digits. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the binding belongs to a group the caller cannot access. |

#### Example Response 200

Response

```json
{
  "_id": "66f7b2a1c9e77c001a2b3d20",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentEndpointId": "AEP0000001",
  "channel": "sms",
  "endpointType": "sms_number",
  "endpointValue": "15551234567",
  "agentProfileId": "AGP0000001",
  "answerMode": "all_inbound",
  "overrides": null,
  "enabled": true,
  "createdAt": "2026-10-06T14:00:00.000Z",
  "updatedAt": "2026-10-06T14:00:00.000Z"
}
```

### GET /agent/pauses

List the paused agent conversations in a group, newest first. A conversation is paused when a person takes it over (reason human\_reply or manual) or when the agent asks for a person (reason escalation): the agent does not answer that contact on that number until the conversation is resumed. An empty array is returned when nothing is paused.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | Group whose paused conversations to list. Must start with "G" and be at least 8 characters. |
| `subgroupId` | Query Param | Optional | Narrow to conversations on this subgroup's numbers. |
| `channel` | Query Param | Optional | Narrow to one channel. Must be "sms". |
| `endpointValue` | Query Param | Optional | Narrow to one agent number: 10 to 15 digits, country code included, no "+". |
| `contactIdentifier` | Query Param | Optional | Narrow to one contact number: 10 to 15 digits, country code included, no "+". |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 400 | `ValidationError` | groupId is missing or malformed, subgroupId is malformed, channel is not "sms", or endpointValue or contactIdentifier is not 10 to 15 digits. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the group is one the caller cannot access. |

#### Example Response 200

Response

```json
[
  {
    "_id": "66f7b2a1c9e77c001a2b3d30",
    "groupId": "G1234567",
    "subgroupId": "S1234567",
    "channel": "sms",
    "endpointValue": "15551234567",
    "contactIdentifier": "15557654321",
    "reason": "human_reply",
    "pausedBy": "507f1f77bcf86cd799439011",
    "createdAt": "2026-10-27T15:00:00.000Z",
    "updatedAt": "2026-10-27T15:00:00.000Z"
  }
]
```

### PUT /agent/pauses/:channel/:endpointValue/:contactIdentifier

Pause the agent on one conversation: the number it answers and one contact. The agent stops answering that contact on that number until the conversation is resumed; there is no timer. Use it when a person replies to the contact by hand. The conversation's pending replies (see GET /agent/drafts) are rejected, so none is sent after the person's. Pausing a paused conversation keeps the original pause and returns it. An agent must be assigned to the number.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `channel` | URL Param | Required | The channel. Must be "sms". |
| `endpointValue` | URL Param | Required | The agent's number: 10 to 15 digits, country code included, no "+". |
| `contactIdentifier` | URL Param | Required | The contact's number: 10 to 15 digits, country code included, no "+". |
| `reason` | String | Optional | Why the conversation is paused: "human\_reply" (a person replied by hand) or "manual". Defaults to "manual". |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentEndpointNotFoundError` | No agent is assigned to this number. |
| 400 | `ValidationError` | channel is not "sms", endpointValue or contactIdentifier is not 10 to 15 digits, reason is not "human\_reply" or "manual", or the body carries an unknown field. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the number belongs to a group the caller cannot access. |

#### Example Request

Request

```json
{
  "reason": "human_reply"
}
```

#### Example Response 200

Response

```json
{
  "_id": "66f7b2a1c9e77c001a2b3d30",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "channel": "sms",
  "endpointValue": "15551234567",
  "contactIdentifier": "15557654321",
  "reason": "human_reply",
  "pausedBy": "507f1f77bcf86cd799439011",
  "createdAt": "2026-10-27T15:00:00.000Z",
  "updatedAt": "2026-10-27T15:00:00.000Z"
}
```

### DELETE /agent/pauses/:channel/:endpointValue/:contactIdentifier

Resume the agent on a paused conversation, so it answers the contact's next text again. This also ends the hold an escalation put on the conversation. Replies rejected by the pause stay rejected. The removed pause is returned.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `channel` | URL Param | Required | The channel. Must be "sms". |
| `endpointValue` | URL Param | Required | The agent's number: 10 to 15 digits, country code included, no "+". |
| `contactIdentifier` | URL Param | Required | The contact's number: 10 to 15 digits, country code included, no "+". |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentContactPauseNotFoundError` | The agent is not paused on this conversation. |
| 400 | `ValidationError` | channel is not "sms", or endpointValue or contactIdentifier is not 10 to 15 digits. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the pause belongs to a group the caller cannot access. |

#### Example Response 200

Response

```json
{
  "_id": "66f7b2a1c9e77c001a2b3d30",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "channel": "sms",
  "endpointValue": "15551234567",
  "contactIdentifier": "15557654321",
  "reason": "human_reply",
  "pausedBy": "507f1f77bcf86cd799439011",
  "createdAt": "2026-10-27T15:00:00.000Z",
  "updatedAt": "2026-10-27T15:00:00.000Z"
}
```

### GET /agent/drafts

List held agent replies (the Pending Replies queue) in a group, newest first. An SMS agent holds a reply instead of sending it when its send authority is "review", and also on auto-pilot when it is unsure (the turn fell back, it asked for a human, or a guardrail flagged the reply) or when it is quiet hours for the contact (reason "quiet\_hours": 8:45 pm to 9 am in the contact's time zone, judged from the area code). Every reply an SMS agent writes to an inbound text is recorded here: a confident auto-pilot reply has reason "autopilot" and is meant to be delivered without waiting for a person, by claiming it and reporting the outcome. An empty array is returned when nothing matches.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | Group whose drafts to list. Must start with "G" and be at least 8 characters. |
| `subgroupId` | Query Param | Optional | Narrow to the drafts of numbers in this subgroup. |
| `agentProfileId` | Query Param | Optional | Narrow to the drafts this agent wrote. |
| `status` | Query Param | Optional | Narrow to one status: "pending", "sending", "sent", "rejected" or "failed". |
| `page` | Query Param | Optional | Page number for pagination (default: 1). |
| `limit` | Query Param | Optional | Results per page (default: 25, max 500). |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 400 | `ValidationError` | groupId is missing or malformed, subgroupId or agentProfileId is malformed, status is not one of the listed values, or page or limit is not a positive integer within range. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the group is one the caller cannot access. |

#### Example Response 200

Response

```json
[
  {
    "_id": "66f8c3b2d0e88d001b3c4e31",
    "groupId": "G1234567",
    "subgroupId": "S1234567",
    "agentReplyDraftId": "ARD0000001",
    "agentProfileId": "AGP0000001",
    "conversationId": "CNV0000001",
    "channel": "sms",
    "endpointValue": "15551234567",
    "contactPhoneNumber": "15557654321",
    "inboundText": "Do you have any openings tomorrow?",
    "draftText": "We have openings at 10am and 2pm tomorrow. Want me to book one?",
    "sentText": null,
    "reason": "review_mode",
    "status": "pending",
    "decidedBy": null,
    "decidedAt": null,
    "sentMessageId": null,
    "deliveredBy": null,
    "failureReason": null,
    "createdAt": "2026-10-06T15:00:00.000Z",
    "updatedAt": "2026-10-06T15:00:00.000Z"
  }
]
```

### POST /agent/drafts/:agentReplyDraftId/approve

Approve a held agent reply and send it from the agent's number to the contact, optionally with edited text. The reply goes through the normal SMS send path, so opt-out, moderation and billing apply. The draft comes back with status "sent" and sentMessageId set, or with status "failed" when the send path accepted nothing (for example, the contact opted out). sentText is the text actually sent. Only a pending draft can be approved. If the send path returns an error, that error is returned and the draft goes back to pending.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentReplyDraftId` | URL Param | Required | The draft to approve ("ARD..."). |
| `text` | String | Optional | Replacement text when a person edited the reply: 1 to 10,000 characters after trimming. Omit it to send the reply as the agent wrote it. No other body fields are accepted. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentReplyDraftNotFoundError` | No draft has this agentReplyDraftId. |
| 409 | `ResourceConflictError` | The draft is no longer pending: it was already approved, rejected, or is being sent by another request. |
| 400 | `ValidationError` | agentReplyDraftId is malformed, text is empty or longer than 10,000 characters, or the body carries an unknown field. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the draft belongs to a group the caller cannot access. |

#### Example Request

Request

```json
{
  "text": "We have openings at 10am and 2pm tomorrow. Reply 1 or 2 to book."
}
```

#### Example Response 200

Response

```json
{
  "_id": "66f8c3b2d0e88d001b3c4e31",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentReplyDraftId": "ARD0000001",
  "agentProfileId": "AGP0000001",
  "conversationId": "CNV0000001",
  "channel": "sms",
  "endpointValue": "15551234567",
  "contactPhoneNumber": "15557654321",
  "inboundText": "Do you have any openings tomorrow?",
  "draftText": "We have openings at 10am and 2pm tomorrow. Want me to book one?",
  "sentText": "We have openings at 10am and 2pm tomorrow. Reply 1 or 2 to book.",
  "reason": "review_mode",
  "status": "sent",
  "decidedBy": "60f7b2a1c9e77c001a2b3c4d",
  "decidedAt": "2026-10-06T15:05:00.000Z",
  "sentMessageId": "66f8c4a0d0e88d001b3c4e40",
  "deliveredBy": "signalhouse",
  "claimId": "0c9d8e7f-6a5b-4c3d-8e2f-1a0b9c8d7e6f",
  "failureReason": null,
  "createdAt": "2026-10-06T15:00:00.000Z",
  "updatedAt": "2026-10-06T15:05:01.000Z"
}
```

### POST /agent/drafts/:agentReplyDraftId/reject

Reject a held agent reply so it is never sent. The rejected draft is returned with status "rejected". Only a pending draft can be rejected. No request body.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentReplyDraftId` | URL Param | Required | The draft to reject ("ARD..."). |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentReplyDraftNotFoundError` | No draft has this agentReplyDraftId. |
| 409 | `ResourceConflictError` | The draft is no longer pending: it was already approved, rejected, or is being sent by another request. |
| 400 | `ValidationError` | agentReplyDraftId is malformed. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the draft belongs to a group the caller cannot access. |

#### Example Response 200

Response

```json
{
  "_id": "66f8c3b2d0e88d001b3c4e31",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentReplyDraftId": "ARD0000001",
  "agentProfileId": "AGP0000001",
  "conversationId": "CNV0000001",
  "channel": "sms",
  "endpointValue": "15551234567",
  "contactPhoneNumber": "15557654321",
  "inboundText": "Do you have any openings tomorrow?",
  "draftText": "We have openings at 10am and 2pm tomorrow. Want me to book one?",
  "sentText": null,
  "reason": "review_mode",
  "status": "rejected",
  "decidedBy": "60f7b2a1c9e77c001a2b3c4d",
  "decidedAt": "2026-10-06T15:05:00.000Z",
  "sentMessageId": null,
  "deliveredBy": null,
  "failureReason": null,
  "createdAt": "2026-10-06T15:00:00.000Z",
  "updatedAt": "2026-10-06T15:05:00.000Z"
}
```

### POST /agent/drafts/:agentReplyDraftId/claim

Claim a held agent reply for delivery through your own channel instead of Signal House's send path. Nothing is sent. The draft becomes "sending" with deliveredBy "external", sentText set to the text you will deliver, and a new claimId, and you then report the outcome with /complete or /release, sending that claimId. The claim means two approvals can never both deliver. Only a pending draft can be claimed. If the agent's number has left the draft's subgroup, the draft is closed as "failed" and a 400 is returned. A claim left unfinished for 30 minutes is closed as "failed" with failureReason "delivery\_unconfirmed", so it is never offered again.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentReplyDraftId` | URL Param | Required | The draft to claim ("ARD..."). |
| `text` | String | Optional | Replacement text when a person edited the reply: 1 to 10,000 characters after trimming. Omit it to deliver the reply as the agent wrote it. No other body fields are accepted. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentReplyDraftNotFoundError` | No draft has this agentReplyDraftId. |
| 409 | `ResourceConflictError` | The draft is no longer pending: it was already approved, rejected, claimed, or is being sent by another request. Also returned for an "autopilot" draft when a person has paused the conversation (the draft is rejected), or when it is quiet hours for the contact, 8:45 pm to 9 am in their time zone (the draft is relabeled "quiet\_hours" and stays pending, so a person can still claim it). |
| 400 | `ValidationError` | agentReplyDraftId is malformed, text is empty or longer than 10,000 characters, the body carries an unknown field, or the agent's number no longer belongs to the draft's subgroup (the draft is closed as failed). |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the draft belongs to a group the caller cannot access. |

#### Example Request

Request

```json
{
  "text": "We have openings at 10am and 2pm tomorrow. Reply 1 or 2 to book."
}
```

#### Example Response 200

Response

```json
{
  "_id": "66f8c3b2d0e88d001b3c4e31",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentReplyDraftId": "ARD0000001",
  "agentProfileId": "AGP0000001",
  "conversationId": "CNV0000001",
  "channel": "sms",
  "endpointValue": "15551234567",
  "contactPhoneNumber": "15557654321",
  "inboundText": "Do you have any openings tomorrow?",
  "draftText": "We have openings at 10am and 2pm tomorrow. Want me to book one?",
  "sentText": "We have openings at 10am and 2pm tomorrow. Reply 1 or 2 to book.",
  "reason": "review_mode",
  "status": "sending",
  "decidedBy": "60f7b2a1c9e77c001a2b3c4d",
  "decidedAt": "2026-10-06T15:05:00.000Z",
  "sentMessageId": null,
  "deliveredBy": "external",
  "claimId": "7b6f1d2e-3c4a-4f5b-9e8d-1a2b3c4d5e6f",
  "failureReason": null,
  "createdAt": "2026-10-06T15:00:00.000Z",
  "updatedAt": "2026-10-06T15:05:01.000Z"
}
```

### POST /agent/drafts/:agentReplyDraftId/complete

Mark a claimed agent reply as sent once your channel accepted it. The draft becomes "sent". Only the claim named by claimId can be completed, so a late call can never settle a newer claim. A completion is also accepted after an unfinished claim was closed as "failed" with failureReason "delivery\_unconfirmed", and turns it into "sent".

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentReplyDraftId` | URL Param | Required | The claimed draft ("ARD..."). |
| `claimId` | String | Required | The claimId returned by /claim. |
| `externalMessageId` | String | Optional | Your channel's id for the sent message, 1 to 256 characters. Stored as sentMessageId. No other body fields are accepted. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentReplyDraftNotFoundError` | No draft has this agentReplyDraftId. |
| 409 | `ResourceConflictError` | The draft is not under this external claim: claimId doesn't match the current claim, the draft is being sent by Signal House, or it was already completed or released. |
| 400 | `ValidationError` | agentReplyDraftId is malformed, claimId is missing, or the body carries an invalid or unknown field. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the draft belongs to a group the caller cannot access. |

#### Example Request

Request

```json
{
  "claimId": "7b6f1d2e-3c4a-4f5b-9e8d-1a2b3c4d5e6f",
  "externalMessageId": "ext-msg-12345"
}
```

#### Example Response 200

Response

```json
{
  "_id": "66f8c3b2d0e88d001b3c4e31",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentReplyDraftId": "ARD0000001",
  "agentProfileId": "AGP0000001",
  "conversationId": "CNV0000001",
  "channel": "sms",
  "endpointValue": "15551234567",
  "contactPhoneNumber": "15557654321",
  "inboundText": "Do you have any openings tomorrow?",
  "draftText": "We have openings at 10am and 2pm tomorrow. Want me to book one?",
  "sentText": "We have openings at 10am and 2pm tomorrow. Reply 1 or 2 to book.",
  "reason": "review_mode",
  "status": "sent",
  "decidedBy": "60f7b2a1c9e77c001a2b3c4d",
  "decidedAt": "2026-10-06T15:05:00.000Z",
  "sentMessageId": "ext-msg-12345",
  "deliveredBy": "external",
  "claimId": "7b6f1d2e-3c4a-4f5b-9e8d-1a2b3c4d5e6f",
  "failureReason": null,
  "createdAt": "2026-10-06T15:00:00.000Z",
  "updatedAt": "2026-10-06T15:05:01.000Z"
}
```

### POST /agent/drafts/:agentReplyDraftId/release

Give back a claim whose reply certainly did not go out. The draft returns to "pending" so it can be approved again, or with permanent set to true it is closed as "failed". If you cannot tell whether the reply went out, do not release it: an unfinished claim is closed after 30 minutes as "failed" with failureReason "delivery\_unconfirmed", so it is never sent twice. Only the claim named by claimId can be released.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentReplyDraftId` | URL Param | Required | The claimed draft ("ARD..."). |
| `claimId` | String | Required | The claimId returned by /claim. |
| `permanent` | Boolean | Optional | true closes the draft as failed (the contact can never be sent this reply). Omit or false to return it to pending. No other body fields are accepted. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentReplyDraftNotFoundError` | No draft has this agentReplyDraftId. |
| 409 | `ResourceConflictError` | The draft is not under this external claim: claimId doesn't match the current claim, the draft is being sent by Signal House, or it was already completed or released. |
| 400 | `ValidationError` | agentReplyDraftId is malformed, claimId is missing, or the body carries an invalid or unknown field. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the draft belongs to a group the caller cannot access. |

#### Example Request

Request

```json
{
  "claimId": "7b6f1d2e-3c4a-4f5b-9e8d-1a2b3c4d5e6f"
}
```

#### Example Response 200

Response

```json
{
  "_id": "66f8c3b2d0e88d001b3c4e31",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "agentReplyDraftId": "ARD0000001",
  "agentProfileId": "AGP0000001",
  "conversationId": "CNV0000001",
  "channel": "sms",
  "endpointValue": "15551234567",
  "contactPhoneNumber": "15557654321",
  "inboundText": "Do you have any openings tomorrow?",
  "draftText": "We have openings at 10am and 2pm tomorrow. Want me to book one?",
  "sentText": null,
  "reason": "review_mode",
  "status": "pending",
  "decidedBy": null,
  "decidedAt": null,
  "sentMessageId": null,
  "deliveredBy": null,
  "failureReason": null,
  "createdAt": "2026-10-06T15:00:00.000Z",
  "updatedAt": "2026-10-06T15:05:01.000Z"
}
```

### POST /agent/profiles/:agentProfileId/publish

Publish an agent profile: sets publishStatus to "published" and publishedAt to now. The agent must be active and have at least one enabled deployment. Publish state is a flag, not a snapshot: later edits apply to the same profile, and an updatedAt later than publishedAt means the profile has unpublished changes. The profile's updatedAt also moves when one of its own channel settings, knowledge items or tools is created, updated or deleted. Group-level knowledge items and tools (no agentProfileId) don't move any profile's updatedAt. Publishing again refreshes publishedAt. No request body.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The agent to publish. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentProfileNotFoundError` | No agent profile has this agentProfileId. |
| 409 | `AgentProfileInactiveError` | The agent's status is "inactive". |
| 400 | `ValidationError` | The agent has no enabled deployment ("Deploy the agent to at least one subgroup before publishing."), or agentProfileId is malformed. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the agent belongs to a group the caller cannot access. |

#### Example Response 200

Response

```json
{
  "_id": "60f7b2a1c9e77c001a2b3c9a",
  "groupId": "G1234567",
  "subgroupId": null,
  "agentProfileId": "AGP0000001",
  "name": "Support Bot",
  "status": "active",
  "systemPrompt": "You are a helpful support agent for Acme.",
  "greeting": "Hi! How can I help you today?",
  "guardrails": "",
  "sendAuthority": "review",
  "publishStatus": "published",
  "publishedAt": "2026-09-21T10:00:00.000Z",
  "createdAt": "2026-09-18T12:00:00.000Z",
  "updatedAt": "2026-09-21T10:00:00.000Z"
}
```

### POST /agent/profiles/:agentProfileId/unpublish

Return an agent profile to draft: sets publishStatus to "draft". publishedAt keeps the time of the last publish, and deployments are kept, so publishing again restores them. No request body.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentProfileId` | URL Param | Required | The agent to unpublish. |

#### Errors

| Status | Error | When |
| --- | --- | --- |
| 404 | `AgentProfileNotFoundError` | No agent profile has this agentProfileId. |
| 400 | `ValidationError` | agentProfileId is malformed. |
| 403 | `AuthorizationError` | The caller's role is not permitted, or the agent belongs to a group the caller cannot access. |

#### Example Response 200

Response

```json
{
  "_id": "60f7b2a1c9e77c001a2b3c9a",
  "groupId": "G1234567",
  "subgroupId": null,
  "agentProfileId": "AGP0000001",
  "name": "Support Bot",
  "status": "active",
  "systemPrompt": "You are a helpful support agent for Acme.",
  "greeting": "Hi! How can I help you today?",
  "guardrails": "",
  "sendAuthority": "review",
  "publishStatus": "draft",
  "publishedAt": "2026-09-21T10:00:00.000Z",
  "createdAt": "2026-09-18T12:00:00.000Z",
  "updatedAt": "2026-09-22T09:30:00.000Z"
}
```

### GET /agent/tenant-settings

Read the tenant AI settings for a scope — brand, tone, timezone, business hours, and after-hours message. Returns the scope's own row only (no group-level fallback), or an empty array when the scope has no settings.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The group. |
| `subgroupId` | Query Param | Optional | The subgroup; omit for the group-level settings. |

#### Example Response 200

Response

```json
[
  {
    "tenantAiSettingsId": "TAS0000001",
    "groupId": "G1234567",
    "subgroupId": null,
    "brandName": "Acme Plumbing",
    "tone": "friendly",
    "timezone": "America/New_York",
    "businessHours": [
      {
        "day": "monday",
        "closed": false,
        "open": "09:00",
        "close": "17:00"
      }
    ],
    "afterHoursMessage": "We're closed — leave a message."
  }
]
```

### PUT /agent/tenant-settings

Create or update (upsert) the tenant AI settings for a scope. The scope is identified by the query params; the body carries the fields. One row per (group, subgroup). All body fields are optional.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The group. |
| `subgroupId` | Query Param | Optional | The subgroup; omit for the group-level settings. |
| `brandName` | String | Optional | Brand/business name the agent represents. |
| `tone` | String | Optional | Freeform tone descriptor (e.g. "professional", "friendly"). |
| `timezone` | String | Optional | IANA timezone the business hours are evaluated in. |
| `businessHours` | Object\[\] | Optional | Per-day windows: { day, closed, open (HH:MM), close (HH:MM) }. |
| `afterHoursMessage` | String | Optional | Message the agent uses outside business hours. |

#### Example Request

Request

```json
{
  "brandName": "Acme Plumbing",
  "timezone": "America/New_York",
  "businessHours": [
    {
      "day": "monday",
      "closed": false,
      "open": "09:00",
      "close": "17:00"
    }
  ],
  "afterHoursMessage": "We're closed — leave a message."
}
```

#### Example Response 200

Response

```json
{
  "tenantAiSettingsId": "TAS0000001",
  "groupId": "G1234567",
  "subgroupId": null,
  "brandName": "Acme Plumbing",
  "timezone": "America/New_York",
  "businessHours": [
    {
      "day": "monday",
      "closed": false,
      "open": "09:00",
      "close": "17:00"
    }
  ],
  "afterHoursMessage": "We're closed — leave a message."
}
```

### DELETE /agent/tenant-settings

Delete the tenant AI settings for a scope.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The group. |
| `subgroupId` | Query Param | Optional | The subgroup; omit for the group-level settings. |

#### Example Response 200

Response

```json
{
  "message": "Tenant AI settings for G1234567 deleted successfully"
}
```

### GET /agent/tools

List the tools defined under a group — custom webhook tools, configured built-ins, and (future) MCP. webhookAuth secrets are redacted in the response (shown as { configured: true }).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The group whose tools to list. |
| `subgroupId` | Query Param | Optional | Narrow to a subgroup. |
| `agentProfileId` | Query Param | Optional | Narrow to one agent. |
| `type` | Query Param | Optional | Narrow to a tool type — "builtin", "webhook", or "mcp". |
| `page` | Query Param | Optional | Page number (1-based) for pagination. |
| `limit` | Query Param | Optional | Items per page (max 100; default 25). |

#### Example Response 200

Response

```json
[
  {
    "agentToolId": "ATL0000001",
    "groupId": "G1234567",
    "subgroupId": null,
    "agentProfileId": null,
    "name": "order_status",
    "description": "Look up the status of a customer order.",
    "type": "webhook",
    "webhookUrl": "https://hooks.acme.io/order-status",
    "webhookAuth": {
      "configured": true
    },
    "channels": [
      "webchat",
      "sms"
    ],
    "enabled": true
  }
]
```

### POST /agent/tools

Create an agent tool. For a webhook tool, webhookUrl must be an https URL that does not target a private/internal address (rejected otherwise). webhookAuth is stored and never returned. Type-specific requirements: webhook → webhookUrl, builtin → builtinKey, mcp → mcpServerUrl. A built-in's config is checked too, and a tool failing a check is a 400 ValidationError: an escalate\_to\_human tool whose channels include "voice" needs config.target, the US or Canada number calls are transferred to (+1 and ten digits; other +1 countries such as Jamaica, and premium-rate numbers, are refused); a handoff\_to\_agent tool needs config.targetAgentProfileId; and send\_sms and handoff\_to\_agent must set channels to \["voice"\].

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | String | Required | The owning group (starts with "G"). |
| `name` | String | Required | Tool name exposed to the LLM. |
| `description` | String | Required | What the tool does; the LLM reads this to decide when to call it. |
| `type` | String | Optional | "builtin", "webhook", or "mcp" (default "builtin"). |
| `builtinKey` | String | Optional | The built-in this configures (required for type "builtin"): check\_business\_hours, knowledge\_search, escalate\_to\_human, send\_sms or handoff\_to\_agent. |
| `webhookUrl` | String | Optional | Public https endpoint the call is relayed to (required for type "webhook"). |
| `webhookAuth` | Object | Optional | Auth config for the webhook call, of the form { headers?: { \[name\]: value }, signingSecret?: string } (other shapes are rejected). headers are sent verbatim on every call; signingSecret makes us send X-SignalHouse-Signature = "sha256=" + HMAC-SHA256(\`${X-SignalHouse-Timestamp}.${rawBody}\`) so you can verify the call and reject replays. Stored, never returned. |
| `mcpServerUrl` | String | Optional | MCP server URL (required for type "mcp"). |
| `parametersSchema` | Object | Optional | JSON Schema for the tool’s parameters. |
| `config` | Object | Optional | Per-tool configuration. escalate\_to\_human: target, the +1 number a call is transferred to (if no one answers, the agent comes back on the line). handoff\_to\_agent: targetAgentProfileId, the agent in the same group the call is passed to; it must be active, have its voice channel on, and be group-level or in the subgroup the call came in on. The model never chooses either. |
| `channels` | String\[\] | Optional | Channels this tool is offered on; empty means every channel. send\_sms and handoff\_to\_agent tools must be \["voice"\]. |
| `enabled` | Boolean | Optional | Whether the tool is available. |
| `subgroupId` | String|null | Optional | Scope to a subgroup; null = group-level. |
| `agentProfileId` | String|null | Optional | Restrict to one agent; null = shared across the tenant’s agents. Must be an agent in the same groupId, otherwise 404 AgentProfileNotFoundError. |

#### Example Request

Request

```json
{
  "groupId": "G1234567",
  "name": "order_status",
  "description": "Look up the status of a customer order.",
  "type": "webhook",
  "webhookUrl": "https://hooks.acme.io/order-status",
  "webhookAuth": {
    "headers": {
      "Authorization": "Bearer s3cr3t"
    },
    "signingSecret": "whsec_your_secret"
  },
  "channels": [
    "webchat"
  ]
}
```

#### Example Response 201

Response

```json
{
  "agentToolId": "ATL0000001",
  "groupId": "G1234567",
  "subgroupId": null,
  "agentProfileId": null,
  "name": "order_status",
  "description": "Look up the status of a customer order.",
  "type": "webhook",
  "webhookUrl": "https://hooks.acme.io/order-status",
  "webhookAuth": {
    "configured": true
  },
  "channels": [
    "webchat",
    "sms"
  ],
  "enabled": true
}
```

### GET /agent/tools/:id

Get a single agent tool by ID (webhookAuth redacted).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Agent tool ID. |

#### Example Response 200

Response

```json
[
  {
    "agentToolId": "ATL0000001",
    "groupId": "G1234567",
    "subgroupId": null,
    "agentProfileId": null,
    "name": "order_status",
    "description": "Look up the status of a customer order.",
    "type": "webhook",
    "webhookUrl": "https://hooks.acme.io/order-status",
    "webhookAuth": {
      "configured": true
    },
    "channels": [
      "webchat",
      "sms"
    ],
    "enabled": true
  }
]
```

### PUT /agent/tools/:id

Update an agent tool. The tool’s scope (group/subgroup/agent) is immutable. A supplied webhookUrl is SSRF-checked.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Agent tool ID to update. |
| `name` | String | Optional | Tool name exposed to the LLM. |
| `description` | String | Optional | What the tool does. |
| `webhookUrl` | String | Optional | Public https endpoint (SSRF-checked). |
| `type` | String | Optional | "builtin", "webhook", or "mcp". Changing it re-checks the per-type required fields. |
| `builtinKey` | String | Optional | The built-in this configures (for type "builtin"): check\_business\_hours, knowledge\_search, escalate\_to\_human, send\_sms or handoff\_to\_agent. The merged tool is checked as on create. |
| `mcpServerUrl` | String | Optional | MCP server URL (public https; for type "mcp"). |
| `parametersSchema` | Object | Optional | JSON Schema for the tool’s parameters. |
| `config` | Object | Optional | Per-tool configuration. escalate\_to\_human: target, the +1 number a call is transferred to (if no one answers, the agent comes back on the line). handoff\_to\_agent: targetAgentProfileId, the agent in the same group the call is passed to; it must be active, have its voice channel on, and be group-level or in the subgroup the call came in on. The model never chooses either. |
| `webhookAuth` | Object | Optional | Auth config: { headers?: { \[name\]: value }, signingSecret?: string } (other shapes rejected). See the POST field for the signing scheme. Stored, never returned. |
| `enabled` | Boolean | Optional | Whether the tool is available. |
| `channels` | String\[\] | Optional | Channels this tool is offered on; empty means every channel. send\_sms and handoff\_to\_agent tools must be \["voice"\]. |

#### Example Request

Request

```json
{
  "enabled": false
}
```

#### Example Response 200

Response

```json
{
  "agentToolId": "ATL0000001",
  "groupId": "G1234567",
  "subgroupId": null,
  "agentProfileId": null,
  "name": "order_status",
  "description": "Look up the status of a customer order.",
  "type": "webhook",
  "webhookUrl": "https://hooks.acme.io/order-status",
  "webhookAuth": {
    "configured": true
  },
  "channels": [
    "webchat",
    "sms"
  ],
  "enabled": true
}
```

### DELETE /agent/tools/:id

Delete an agent tool by its ID.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Agent tool ID to delete. |

#### Example Response 200

Response

```json
{
  "message": "Agent tool ATL0000001 deleted successfully"
}
```

### GET /agent/knowledge

List the knowledge-base items an agent can answer from (RAG). Scoped to a group; optionally narrowed to a subgroup and/or a single agent. The raw text is stored and Atlas Vector Search owns the embedding.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The group whose knowledge to list. |
| `subgroupId` | Query Param | Optional | Narrow to a subgroup. |
| `agentProfileId` | Query Param | Optional | Narrow to one agent. |
| `page` | Query Param | Optional | Page number (1-based) for pagination. |
| `limit` | Query Param | Optional | Items per page (max 100; default 25). |

#### Example Response 200

Response

```json
[
  {
    "knowledgeItemId": "KNW0000001",
    "groupId": "G1234567",
    "subgroupId": null,
    "agentProfileId": null,
    "title": "Business hours",
    "text": "We are open Monday to Friday, 9am to 5pm.",
    "source": "manual",
    "enabled": true
  }
]
```

### POST /agent/knowledge

Create a knowledge item. Store the raw text only — Atlas Vector Search generates and owns the embedding, so there is no vector to supply.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | String | Required | The owning group (starts with "G"). |
| `text` | String | Required | The raw content Atlas auto-embeds and retrieves against. |
| `subgroupId` | String|null | Optional | Scope to a subgroup (starts with "S"); null = group-level. |
| `agentProfileId` | String|null | Optional | Restrict to one agent; null = shared across the tenant’s agents. Must be an agent in the same groupId, otherwise 404 AgentProfileNotFoundError. |
| `title` | String | Optional | Short human label for the item. |
| `source` | String | Optional | How the item was added — "manual", "url", "document", or "import". |
| `enabled` | Boolean | Optional | Whether the item is included in retrieval. |
| `metadata` | Object|null | Optional | Free-form per-item metadata. |

#### Example Request

Request

```json
{
  "groupId": "G1234567",
  "title": "Business hours",
  "text": "We are open Monday to Friday, 9am to 5pm.",
  "source": "manual"
}
```

#### Example Response 201

Response

```json
{
  "knowledgeItemId": "KNW0000001",
  "groupId": "G1234567",
  "subgroupId": null,
  "agentProfileId": null,
  "title": "Business hours",
  "text": "We are open Monday to Friday, 9am to 5pm.",
  "source": "manual",
  "enabled": true
}
```

### GET /agent/knowledge/:id

Get a single knowledge item by ID.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Knowledge item ID. |

#### Example Response 200

Response

```json
[
  {
    "knowledgeItemId": "KNW0000001",
    "groupId": "G1234567",
    "subgroupId": null,
    "agentProfileId": null,
    "title": "Business hours",
    "text": "We are open Monday to Friday, 9am to 5pm.",
    "source": "manual",
    "enabled": true
  }
]
```

### PUT /agent/knowledge/:id

Update a knowledge item. The item’s scope (group/subgroup/agent) is immutable and cannot be changed.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Knowledge item ID to update. |
| `title` | String | Optional | Short human label for the item. |
| `text` | String | Optional | The raw content Atlas auto-embeds and retrieves against. |
| `source` | String | Optional | How the item was added — "manual", "url", "document", or "import". |
| `enabled` | Boolean | Optional | Whether the item is included in retrieval. |
| `metadata` | Object|null | Optional | Free-form per-item metadata. |

#### Example Request

Request

```json
{
  "text": "We are open Monday to Saturday, 8am to 6pm.",
  "enabled": true
}
```

#### Example Response 200

Response

```json
{
  "knowledgeItemId": "KNW0000001",
  "groupId": "G1234567",
  "title": "Business hours",
  "text": "We are open Monday to Saturday, 8am to 6pm.",
  "source": "manual",
  "enabled": true
}
```

### DELETE /agent/knowledge/:id

Delete a knowledge item by its ID.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Knowledge item ID to delete. |

#### Example Response 200

Response

```json
{
  "message": "Knowledge item KNW0000001 deleted successfully"
}
```
