> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Send a client chat message

POST https://api.runtype.com/v1/client/chat
Content-Type: application/json

Send a message for a browser client-token chat session. The request streams flow/agent events over Server-Sent Events. `turnId` and `submitMode` are optional and let newer Persona clients suppress stale interrupted responses; older clients can omit both fields. Opt-in `steer` accepts exactly one new user message whose `id` equals `turnId` for visitor-owned native durable agents. A new execution streams SSE; steering an existing execution returns a 202 delivery receipt without replacing its response. `auto` takes the same shape as `steer` and lets a classifier choose while a turn runs: a message that belongs to the running work steers it (202 delivery receipt), and an independent one queues as the next turn (202 queued handle); with nothing running it is an ordinary turn with no route report. A routed or downgraded answer carries `X-Runtype-Busy-Message-Route` and `X-Runtype-Busy-Message-Source` (plus `-Probability` and `-Model` when the classifier answered), repeated as `busyMessageRoute` on JSON bodies. Where `auto` cannot route (another lane, another message shape) it behaves as `normal` and reports source `disabled`. Retry with the same turn and message IDs. Send `voice: { spoken: true }` when the user turn came from a live voice call and the reply will be spoken by a voice model; the turn then runs with a per-turn instruction to lead with a short, speakable answer, which is not stored in the conversation. Only the fields in the request body schema are supported. The schema has no `options` object, so run options such as `options.stepTimeoutMs` and `options.flowTimeoutMs` cannot be set on this route. To set them, call `POST /v1/dispatch` with an API key.

Reference: https://docs.runtype.com/api-reference/runtype-api/client-runtime/send-a-client-chat-message

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Body (application/json)

This endpoint expects an object.

- `messages` (list of V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItems, required)
- `sessionId` (string, required)
- `assistantMessageId` (string, optional)
- `clientTools` (list of V1ClientChatPostRequestBodyContentApplicationJsonSchemaClientToolsItems, optional)
- `clientToolsFingerprint` (string, optional)
- `identityProof` (V1ClientChatPostRequestBodyContentApplicationJsonSchemaIdentityProof, optional) — Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). When Identity Exchange admission is disabled for the caller, the proof is accepted but ignored and confers no trust.
- `inputs` (map from string to any, optional)
- `metadata` (map from string to any, optional)
- `submitMode` (enum, optional)
  - Allowed values: `normal`, `interrupt`, `steer`, `auto`
- `turnId` (string, optional)
- `voice` (V1ClientChatPostRequestBodyContentApplicationJsonSchemaVoice, optional) — Voice context for this turn. Omit for typed chat; behavior is unchanged when absent.

## Response

### 200

SSE stream of chat execution events

- Streaming response of `ExecutionStreamEvent`.
- ExecutionStreamEvent0
- ExecutionStreamEvent1
- ExecutionStreamEvent2
- ExecutionStreamEvent3
- ExecutionStreamEvent4
- ExecutionStreamEvent5
- ExecutionStreamEvent6
- ExecutionStreamEvent7
- ExecutionStreamEvent8
- ExecutionStreamEvent9
- ExecutionStreamEvent10
- ExecutionStreamEvent11
- ExecutionStreamEvent12
- ExecutionStreamEvent13
- ExecutionStreamEvent14
- ExecutionStreamEvent15
- ExecutionStreamEvent16
- ExecutionStreamEvent17
- ExecutionStreamEvent18
- ExecutionStreamEvent19
- ExecutionStreamEvent20
- ExecutionStreamEvent21
- ExecutionStreamEvent22
- ExecutionStreamEvent23
- ExecutionStreamEvent24
- ExecutionStreamEvent25
- ExecutionStreamEvent26
- ExecutionStreamEvent27
- ExecutionStreamEvent28
- ExecutionStreamEvent29
- ExecutionStreamEvent30
- ExecutionStreamEvent31
- ExecutionStreamEvent32
- ExecutionStreamEvent33
- ExecutionStreamEvent34
- ExecutionStreamEvent35
- ExecutionStreamEvent36
- ExecutionStreamEvent37

### 202

Input accepted without a new response stream: a steer receipt from the running execution, or (for `auto`) a queued handle for the next turn

- Streaming response of `Client Runtime_sendAClientChatMessage_Response_202`.
- ClientRuntimeSendAClientChatMessageResponse2020
- ClientRuntimeSendAClientChatMessageResponse2021

## Errors

### 400 Bad Request Error

Validation error

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 401 Unauthorized Error

Session not found or expired, or an `identityProof` was supplied that failed verification (`invalid_identity_proof`, fail-closed: the turn never runs). Identity-proof rejections carry `errorDescription` naming the reason.

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of V1ClientChatPostResponsesContentApplicationJsonSchemaDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.
- `errorDescription` (string, optional) — Why the supplied `identityProof` was refused (for example an expired assertion, an unknown issuer, or a proof minted for another tenant). Diagnostic text for the embedding site, not a value to branch on.

### 403 Forbidden Error

Forbidden. Either the client token is inactive or the origin is not allowed, or the tenancy lock-down refused the execution: the agent requires an end-user scope and no valid `identityProof` was supplied (`end_user_scope_required`), or this session's conversation record belongs to a different signed-in end user (`conversation_scope_mismatch`; start a new conversation), or a Claude Managed target's conversation is not owned by the visitor making the request (`CLIENT_CONVERSATION_NOT_VISITOR_OWNED`; initialize with `durableRecovery: true` and send `X-Visitor-Token`).

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 404 Not Found Error

Referenced flow or agent not found, or a saved agent with no runnable live version (AGENT_NOT_DEPLOYED)

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 409 Conflict Error

Conflict. Either the client tools registry fingerprint was not found (`client_tools_resend_required`; resend the full `clientTools[]` with the fingerprint), this turn was superseded by a newer interrupting turn before it could start (`turn_superseded`), or a Claude Managed target was refused because the caller has not opted into durable turns (`CLAUDE_MANAGED_DURABLE_TURNS_REQUIRED`; `hint` names the exact opt-in) or the session carries no conversation record (`CLAUDE_MANAGED_CONVERSATION_REQUIRED`). A steer refusal uses `STEER_UNAVAILABLE`.

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 429 Too Many Requests Error

Daily execution limit exceeded

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 500 Internal Server Error

Internal server error

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 501 Not Implemented Error

Approval-gated execution is unsupported because Client Chat has no continuation channel that can deliver an owner-approved result back to the visitor (`APPROVAL_MODE_UNSUPPORTED`).

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

## Types

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItems

- `content` (V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContent, required)
- `role` (enum, required)
  - Allowed values: `user`, `assistant`, `system`
- `displayContent` (string, optional) — The text a human actually saw for this message, when it differs from `content`. Stored beside the model content and returned by the history routes; NEVER read by execution, and never treated as authority. Send it for a message whose visible form is not its model form (a structured payload, a hidden `llmContent` variant, a directive rendered as UI). Absent means no projection was captured; an empty string is a deliberate empty projection, and the two are distinguished on read. For a message id the conversation already stores, only this field is taken — the stored model content wins — which makes a re-sent turn an idempotent repair path for a display-projection finalization that never landed. Plain text or Markdown, never rendered HTML.
- `id` (string, optional)

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaClientToolsItems

- `description` (string, required)
- `name` (string, required)
- `parametersSchema` (V1ClientChatPostRequestBodyContentApplicationJsonSchemaClientToolsItemsParametersSchema, required)
- `annotations` (V1ClientChatPostRequestBodyContentApplicationJsonSchemaClientToolsItemsAnnotations, optional)
- `origin` (enum, optional)
  - Allowed values: `webmcp`, `sdk`
- `pageOrigin` (string, optional)
- `untrustedContentHint` (boolean, optional)

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaIdentityProof

Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). When Identity Exchange admission is disabled for the caller, the proof is accepted but ignored and confers no trust.

- `provider` (string, required)
- `token` (string, required)

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaVoice

Voice context for this turn. Omit for typed chat; behavior is unchanged when absent.

- `priorToolResults` (list of V1ClientChatPostRequestBodyContentApplicationJsonSchemaVoicePriorToolResultsItems, optional) — Page tools the voice call already ran this turn. Replayed to the model as answered calls to the offered `clientTools`, deduplicated by `toolCallId`, so the agent narrates rather than re-calls. At most 8 entries; the JSON `arguments` plus `result` of each entry may total 32,768 characters.
- `spoken` (boolean, optional) — The user turn came from a live voice call and the reply will be spoken by a voice model. The turn runs with a per-turn instruction to lead with a short, speakable answer; the instruction is never stored in the conversation.

### ExecutionStreamEvent0

- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `agent`, `flow`
- `seq` (double, required)
- `startedAt` (string, required)
- `type` (enum, required)
  - Allowed values: `execution_start`
- `agentId` (string, optional)
- `agentName` (string, optional)
- `config` (map from string to any, optional)
- `flowId` (string, optional)
- `flowName` (string, optional)
- `maxTurns` (double, optional)
- `resumed` (boolean, optional)
- `source` (string, optional)
- `totalSteps` (double, optional)

### ExecutionStreamEvent1

- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `agent`, `flow`
- `seq` (double, required)
- `success` (boolean, required)
- `type` (enum, required)
  - Allowed values: `execution_complete`
- `claudeManagedAgentId` (string, optional)
- `completedAt` (string, optional)
- `durationMs` (double, optional)
- `externalAgent` (ExecutionStreamEventOneOf1ExternalAgent, optional)
- `failedSteps` (double, optional)
- `finalOutput` (string, optional)
- `iterations` (double, optional)
- `outcome` (enum, optional) — How the execution ended: `completed`, `error`, or `aborted` (cancelled, interrupted, or superseded by the caller or host). Absent on frames from older producers: treat `execution_error` as `error` and `execution_complete` as `completed`, or `error` when `success` is false.
  - Allowed values: `completed`, `error`, `aborted`
- `stepErrorCount` (double, optional)
- `stopReason` (string, optional)
- `successfulSteps` (double, optional)
- `totalCost` (double, optional)
- `totalSteps` (double, optional)
- `totalTokens` (ExecutionStreamEventOneOf1TotalTokens, optional)
- `totalTokensUsed` (double, optional)

### ExecutionStreamEvent2

- `error` (ExecutionStreamEventOneOf2Error, required)
- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `agent`, `flow`
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `execution_error`
- `blockReason` (string, optional)
- `code` (string, optional)
- `completedAt` (string, optional)
- `finalOutput` (string, optional)
- `outcome` (enum, optional) — How the execution ended: `completed`, `error`, or `aborted` (cancelled, interrupted, or superseded by the caller or host). Absent on frames from older producers: treat `execution_error` as `error` and `execution_complete` as `completed`, or `error` when `success` is false.
  - Allowed values: `completed`, `error`, `aborted`
- `stopReason` (string, optional)
- `upgradeUrl` (string, optional)

### ExecutionStreamEvent3

- `executionId` (string, required)
- `id` (string, required)
- `role` (enum, required)
  - Allowed values: `user`, `assistant`, `system`
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `turn_start`
- `iteration` (double, optional)
- `subagent` (ExecutionStreamEventOneOf3Subagent, optional)
- `turnIndex` (double, optional)

### ExecutionStreamEvent4

- `executionId` (string, required)
- `id` (string, required)
- `role` (enum, required)
  - Allowed values: `user`, `assistant`, `system`
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `turn_complete`
- `attributes` (map from string to ExecutionStreamEventOneOf4Attributes, optional)
- `completedAt` (string, optional)
- `content` (string, optional)
- `cost` (double, optional)
- `estimatedContextBreakdown` (ExecutionStreamEventOneOf4EstimatedContextBreakdown, optional)
- `fallback` (ExecutionStreamEventOneOf4Fallback, optional)
- `iteration` (double, optional)
- `stopReason` (enum, optional)
  - Allowed values: `end_turn`, `max_tool_calls`, `length`, `content_filter`, `error`, `unknown`
- `subagent` (ExecutionStreamEventOneOf4Subagent, optional)
- `tokens` (ExecutionStreamEventOneOf4Tokens, optional)

### ExecutionStreamEvent5

- `executionId` (string, required)
- `id` (string, required)
- `ordinal` (integer, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `model_call_start`
- `iteration` (double, optional)
- `model` (string, optional)
- `provider` (string, optional)
- `startedAt` (string, optional)
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf5Subagent, optional)
- `turnId` (string, optional)

### ExecutionStreamEvent6

- `executionId` (string, required)
- `id` (string, required)
- `ordinal` (integer, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `model_call_complete`
- `attributes` (map from string to ExecutionStreamEventOneOf6Attributes, optional)
- `completedAt` (string, optional)
- `cost` (double, optional)
- `durationMs` (double, optional)
- `finishReason` (string, optional)
- `iteration` (double, optional)
- `model` (string, optional)
- `provider` (string, optional)
- `responseModel` (string, optional)
- `subagent` (ExecutionStreamEventOneOf6Subagent, optional)
- `success` (boolean, optional)
- `tokens` (ExecutionStreamEventOneOf6Tokens, optional)
- `turnId` (string, optional)

### ExecutionStreamEvent7

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `step_start`
- `index` (double, optional)
- `name` (string, optional)
- `outputVariable` (string, optional)
- `startedAt` (string, optional)
- `stepType` (string, optional)
- `subagent` (ExecutionStreamEventOneOf7Subagent, optional)
- `totalSteps` (double, optional)

### ExecutionStreamEvent8

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `step_complete`
- `completedAt` (string, optional)
- `cost` (double, optional)
- `durationMs` (double, optional)
- `error` (string, optional)
- `fallback` (ExecutionStreamEventOneOf8Fallback, optional)
- `name` (string, optional)
- `result` (any, optional)
- `stepType` (string, optional)
- `stopReason` (enum, optional)
  - Allowed values: `end_turn`, `max_tool_calls`, `length`, `content_filter`, `error`, `unknown`
- `subagent` (ExecutionStreamEventOneOf8Subagent, optional)
- `success` (boolean, optional)
- `tokensUsed` (double, optional)
- `unresolvedVariables` (list of string, optional)

### ExecutionStreamEvent9

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `step_skip`
- `index` (double, optional)
- `name` (string, optional)
- `skippedAt` (string, optional)
- `stepType` (string, optional)
- `totalSteps` (double, optional)
- `when` (string, optional)

### ExecutionStreamEvent10

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `text_start`
- `parentToolCallId` (string, optional)
- `role` (enum, optional)
  - Allowed values: `user`, `assistant`, `system`
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf10Subagent, optional)
- `turnId` (string, optional)

### ExecutionStreamEvent11

- `delta` (string, required)
- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `text_delta`
- `subagent` (ExecutionStreamEventOneOf11Subagent, optional)

### ExecutionStreamEvent12

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `text_complete`
- `subagent` (ExecutionStreamEventOneOf12Subagent, optional)
- `text` (string, optional)

### ExecutionStreamEvent13

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `reasoning_start`
- `parentToolCallId` (string, optional)
- `scope` (enum, optional)
  - Allowed values: `turn`, `loop`
- `subagent` (ExecutionStreamEventOneOf13Subagent, optional)

### ExecutionStreamEvent14

- `delta` (string, required)
- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `reasoning_delta`
- `subagent` (ExecutionStreamEventOneOf14Subagent, optional)

### ExecutionStreamEvent15

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `reasoning_complete`
- `scope` (enum, optional)
  - Allowed values: `turn`, `loop`
- `subagent` (ExecutionStreamEventOneOf15Subagent, optional)
- `text` (string, optional)

### ExecutionStreamEvent16

- `executionId` (string, required)
- `id` (string, required)
- `mediaType` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `media_start`
- `role` (enum, optional)
  - Allowed values: `user`, `assistant`, `system`
- `toolCallId` (string, optional)

### ExecutionStreamEvent17

- `delta` (string, required)
- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `media_delta`

### ExecutionStreamEvent18

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `media_complete`
- `data` (string, optional)
- `mediaType` (string, optional)
- `toolCallId` (string, optional)
- `url` (string, optional)

### ExecutionStreamEvent19

- `artifactType` (enum, required)
  - Allowed values: `markdown`, `component`
- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `artifact_start`
- `component` (string, optional)
- `executionId` (string, optional)
- `file` (ExecutionStreamEventOneOf19File, optional)
- `seq` (double, optional)
- `title` (string, optional)

### ExecutionStreamEvent20

- `delta` (string, required)
- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `artifact_delta`
- `executionId` (string, optional)
- `seq` (double, optional)

### ExecutionStreamEvent21

- `component` (string, required)
- `id` (string, required)
- `props` (map from string to any, required)
- `type` (enum, required)
  - Allowed values: `artifact_update`
- `executionId` (string, optional)
- `seq` (double, optional)

### ExecutionStreamEvent22

- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `artifact_complete`
- `executionId` (string, optional)
- `seq` (double, optional)

### ExecutionStreamEvent23

- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `source`
- `id` (string, optional)
- `sourceType` (string, optional)
- `title` (string, optional)
- `url` (string, optional)

### ExecutionStreamEvent24

- `executionId` (string, required)
- `seq` (double, required)
- `state` (map from string to any, required)
- `type` (enum, required)
  - Allowed values: `state_snapshot`
- `iteration` (double, optional)

### ExecutionStreamEvent25

- `executionId` (string, required)
- `patch` (list of ExecutionStreamEventOneOf25PatchItems, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `state_delta`
- `iteration` (double, optional)

### ExecutionStreamEvent26

- `executionId` (string, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `toolName` (string, required)
- `toolType` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_start`
- `annotations` (ExecutionStreamEventOneOf26Annotations, optional)
- `hiddenParameterNames` (list of string, optional)
- `iteration` (double, optional)
- `origin` (enum, optional)
  - Allowed values: `webmcp`, `sdk`
- `pageOrigin` (string, optional)
- `parameters` (map from string to any, optional)
- `startedAt` (string, optional)
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf26Subagent, optional)

### ExecutionStreamEvent27

- `delta` (string, required)
- `executionId` (string, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_input_delta`
- `subagent` (ExecutionStreamEventOneOf27Subagent, optional)

### ExecutionStreamEvent28

- `executionId` (string, required)
- `parameters` (map from string to any, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_input_complete`
- `hiddenParameterNames` (list of string, optional)
- `subagent` (ExecutionStreamEventOneOf28Subagent, optional)
- `toolName` (string, optional)

### ExecutionStreamEvent29

- `delta` (string, required)
- `executionId` (string, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_output_delta`

### ExecutionStreamEvent30

- `executionId` (string, required)
- `seq` (double, required)
- `success` (boolean, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_complete`
- `error` (string, optional)
- `executionTime` (double, optional)
- `iteration` (double, optional)
- `result` (any, optional)
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf30Subagent, optional)
- `toolCost` (double, optional)
- `toolName` (string, optional)

### ExecutionStreamEvent31

- `approvalId` (string, required)
- `executionId` (string, required)
- `seq` (double, required)
- `toolName` (string, required)
- `type` (enum, required)
  - Allowed values: `approval_start`
- `description` (string, optional)
- `externalAgent` (ExecutionStreamEventOneOf31ExternalAgent, optional)
- `iteration` (double, optional)
- `parameters` (map from string to any, optional)
- `reason` (string, optional)
- `startedAt` (string, optional)
- `subagent` (ExecutionStreamEventOneOf31Subagent, optional)
- `timeout` (double, optional)
- `toolCallId` (string, optional)
- `toolType` (string, optional)

### ExecutionStreamEvent32

- `approvalId` (string, required)
- `decision` (enum, required)
  - Allowed values: `approved`, `denied`, `timeout`
- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `approval_complete`
- `completedAt` (string, optional)
- `resolvedBy` (enum, optional)
  - Allowed values: `user`, `system`

### ExecutionStreamEvent33

- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `await`
- `annotations` (ExecutionStreamEventOneOf33Annotations, optional)
- `awaitReason` (string, optional)
- `awaitedAt` (string, optional)
- `crawlId` (string, optional)
- `elicitation` (ExecutionStreamEventOneOf33Elicitation, optional)
- `externalAgent` (ExecutionStreamEventOneOf33ExternalAgent, optional)
- `origin` (enum, optional)
  - Allowed values: `webmcp`, `sdk`
- `pageOrigin` (string, optional)
- `parameters` (map from string to any, optional)
- `stepId` (string, optional)
- `toolCallId` (string, optional)
- `toolId` (string, optional)
- `toolName` (string, optional)

### ExecutionStreamEvent34

- `error` (ExecutionStreamEventOneOf34Error, required)
- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `error`
- `recoverable` (boolean, optional)

### ExecutionStreamEvent35

- `epoch` (integer, required)
- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `compaction`
- `phase` (enum, required)
  - Allowed values: `start`, `complete`
- `reason` (enum, required)
  - Allowed values: `threshold`, `overflow`, `manual`, `surface_policy`, `provider_mismatch`
- `seq` (double, required)
- `strategy` (enum, required)
  - Allowed values: `provider_native`, `summary`
- `tier` (integer, required)
- `type` (enum, required)
  - Allowed values: `context_notice`
- `outcome` (enum, optional)
  - Allowed values: `ok`, `failed`, `gap`, `skipped`
- `tokensAfter` (double, optional)
- `tokensBefore` (double, optional)

### ExecutionStreamEvent36

- `executionId` (string, required)
- `seq` (double, required)
- `timestamp` (string, required)
- `type` (enum, required)
  - Allowed values: `ping`

### ExecutionStreamEvent37

- `name` (string, required)
- `type` (enum, required)
  - Allowed values: `custom`
- `executionId` (string, optional)
- `seq` (double, optional)
- `value` (any, optional)

### ClientRuntimeSendAClientChatMessageResponse2020

- `accepted` (boolean, required)
- `conversationId` (string, required)
- `deliveryId` (string, required)
- `deliveryStatus` (enum, required)
  - Allowed values: `pending`, `applied`, `settled`, `not_applied`
- `deliveryStatusUrl` (string, required)
- `eventsUrl` (string, required)
- `executionId` (string, required)
- `busyMessageRoute` (BusyMessageRouteReport, optional)

### ClientRuntimeSendAClientChatMessageResponse2021

- `busyMessageRoute` (BusyMessageRouteReport, required)
- `executionId` (string, required) — The queued execution, distinct from the running one.
- `status` (string, required) — `queued` until the running execution finishes.

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### V1ClientChatPostResponsesContentApplicationJsonSchemaDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContent

- string
- list of V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaClientToolsItemsParametersSchema

- `type` (enum, required)
  - Allowed values: `object`

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaClientToolsItemsAnnotations

- `consequentialHint` (boolean, optional)
- `debugging` (boolean, optional)
- `destructiveHint` (boolean, optional)
- `idempotentHint` (boolean, optional)
- `openWorldHint` (boolean, optional)
- `readOnlyHint` (boolean, optional)
- `untrustedContentHint` (boolean, optional)

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaVoicePriorToolResultsItems

- `arguments` (map from string to any, required)
- `name` (string, required)
- `toolCallId` (string, required)
- `result` (any, optional)

### ExecutionStreamEventOneOf1ExternalAgent

- `contextId` (string, optional)
- `taskId` (string, optional)

### ExecutionStreamEventOneOf1TotalTokens

- `input` (double, required)
- `output` (double, required)

### ExecutionStreamEventOneOf2Error

- string
- ExecutionStreamEventOneOf2Error1

### ExecutionStreamEventOneOf3Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf4Attributes

- string
- double
- boolean

### ExecutionStreamEventOneOf4EstimatedContextBreakdown

- `categories` (map from string to ExecutionStreamEventOneOf4EstimatedContextBreakdownCategories, required)
- `estimatedTotalTokens` (double, required)
- `contextWindowSize` (double, optional)
- `estimatedUtilizationPercent` (double, optional)

### ExecutionStreamEventOneOf4Fallback

- `attempts` (list of ExecutionStreamEventOneOf4FallbackAttemptsItems, required)
- `exhausted` (boolean, required)
- `used` (boolean, required)
- `model` (string, optional)
- `reason` (string, optional, nullable)

### ExecutionStreamEventOneOf4Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf4Tokens

- `input` (double, required)
- `output` (double, required)

### ExecutionStreamEventOneOf5Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf6Attributes

- string
- double
- boolean

### ExecutionStreamEventOneOf6Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf6Tokens

- `input` (double, required)
- `output` (double, required)
- `cacheRead` (double, optional)
- `cacheWrite` (double, optional)
- `reasoning` (double, optional)

### ExecutionStreamEventOneOf7Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf8Fallback

- `attempts` (list of ExecutionStreamEventOneOf8FallbackAttemptsItems, required)
- `exhausted` (boolean, required)
- `used` (boolean, required)
- `model` (string, optional)
- `reason` (string, optional, nullable)

### ExecutionStreamEventOneOf8Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf10Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf11Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf12Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf13Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf14Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf15Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf19File

- `mimeType` (string, required)
- `path` (string, required)
- `language` (string, optional)

### ExecutionStreamEventOneOf25PatchItems

- `op` (enum, required)
  - Allowed values: `add`, `remove`, `replace`, `move`, `copy`, `test`
- `path` (string, required)
- `from` (string, optional)
- `value` (any, optional)

### ExecutionStreamEventOneOf26Annotations

- `consequentialHint` (boolean, optional)
- `debugging` (boolean, optional)
- `destructiveHint` (boolean, optional)
- `idempotentHint` (boolean, optional)
- `openWorldHint` (boolean, optional)
- `readOnlyHint` (boolean, optional)
- `untrustedContentHint` (boolean, optional)

### ExecutionStreamEventOneOf26Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf27Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf28Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf30Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf31ExternalAgent

- `contextId` (string, optional)
- `taskId` (string, optional)

### ExecutionStreamEventOneOf31Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf33Annotations

- `consequentialHint` (boolean, optional)
- `debugging` (boolean, optional)
- `destructiveHint` (boolean, optional)
- `idempotentHint` (boolean, optional)
- `openWorldHint` (boolean, optional)
- `readOnlyHint` (boolean, optional)
- `untrustedContentHint` (boolean, optional)

### ExecutionStreamEventOneOf33Elicitation

- `message` (string, required)
- `mode` (enum, required)
  - Allowed values: `form`, `url`
- `pauseCount` (double, optional)
- `requestedSchema` (map from string to any, optional)
- `requests` (list of ExecutionStreamEventOneOf33ElicitationRequestsItems, optional)
- `serverName` (string, optional)
- `url` (string, optional)

### ExecutionStreamEventOneOf33ExternalAgent

- `contextId` (string, optional)
- `taskId` (string, optional)

### ExecutionStreamEventOneOf34Error

- string
- ExecutionStreamEventOneOf34Error1

### BusyMessageRouteReport

- `route` (enum, required) — Where the message went: into the running execution, or after it.
  - Allowed values: `steer`, `queue`
- `source` (enum, required) — Why this route applied.
  - Allowed values: `classifier`, `abstained`, `timeout`, `error`, `unanswered`, `circuit_open`, `disabled`
- `model` (string, optional) — The decision model that answered.
- `probability` (double, optional) — Probability the message belongs to the running work (classifier only).
- `steerUnavailable` (boolean, optional) — The classifier chose steer but the running execution could no longer take input.

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items

- V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items0
- V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items1
- V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items2
- V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items3

### ExecutionStreamEventOneOf2Error1

- `code` (string, required)
- `message` (string, required)
- `details` (map from string to any, optional)

### ExecutionStreamEventOneOf4EstimatedContextBreakdownCategories

- `chars` (double, required)
- `estimatedTokens` (double, required)

### ExecutionStreamEventOneOf4FallbackAttemptsItems

- `attempt` (double, required)
- `success` (boolean, required)
- `type` (enum, required)
  - Allowed values: `retry`, `model`, `message`, `flow`
- `error` (string, optional)
- `model` (string, optional)

### ExecutionStreamEventOneOf8FallbackAttemptsItems

- `attempt` (double, required)
- `success` (boolean, required)
- `type` (enum, required)
  - Allowed values: `retry`, `model`, `message`, `flow`
- `error` (string, optional)
- `model` (string, optional)

### ExecutionStreamEventOneOf33ElicitationRequestsItems

- `message` (string, required)
- `mode` (enum, required)
  - Allowed values: `form`, `url`
- `name` (string, required)
- `requestedSchema` (map from string to any, optional)
- `url` (string, optional)

### ExecutionStreamEventOneOf34Error1

- `code` (string, required)
- `message` (string, required)
- `details` (map from string to any, optional)

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items0

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `text`

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items1

- `image` (string, required)
- `type` (enum, required)
  - Allowed values: `image`
- `mimeType` (string, optional)

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items2

- `data` (string, required)
- `filename` (string, required)
- `mimeType` (string, required)
- `type` (enum, required)
  - Allowed values: `file`

### V1ClientChatPostRequestBodyContentApplicationJsonSchemaMessagesItemsContentOneOf1Items3

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `reasoning`
- `providerOptions` (map from string to any, optional)

## Examples

### Interrupt a running turn

**Request**

```json
{
  "messages": [
    {
      "content": "Actually, do this first.",
      "role": "user",
      "id": "msg_user_2"
    }
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_2",
  "submitMode": "interrupt",
  "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
}
```

**SDK Code**

```python Interrupt a running turn
import requests

url = "https://api.runtype.com/v1/client/chat"

payload = {
    "messages": [
        {
            "content": "Actually, do this first.",
            "role": "user",
            "id": "msg_user_2"
        }
    ],
    "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
    "assistantMessageId": "msg_assistant_2",
    "submitMode": "interrupt",
    "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Interrupt a running turn
const url = 'https://api.runtype.com/v1/client/chat';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"content":"Actually, do this first.","role":"user","id":"msg_user_2"}],"sessionId":"cs_01jq8z6k2re9v0w1m3n5p7s9t2","assistantMessageId":"msg_assistant_2","submitMode":"interrupt","turnId":"turn_01jq8z6k3rb1c2d3e4f5g6h7j8"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Interrupt a running turn
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/client/chat"

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Interrupt a running turn
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/client/chat")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}"

response = http.request(request)
puts response.read_body
```

```java Interrupt a running turn
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/client/chat")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}")
  .asString();
```

```php Interrupt a running turn
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/client/chat', [
  'body' => '{
  "messages": [
    {
      "content": "Actually, do this first.",
      "role": "user",
      "id": "msg_user_2"
    }
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_2",
  "submitMode": "interrupt",
  "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Interrupt a running turn
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/client/chat");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Interrupt a running turn
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "messages": [
    [
      "content": "Actually, do this first.",
      "role": "user",
      "id": "msg_user_2"
    ]
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_2",
  "submitMode": "interrupt",
  "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/client/chat")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Interrupt a running turn

**Request**

```json
{
  "messages": [
    {
      "content": "Actually, do this first.",
      "role": "user",
      "id": "msg_user_2"
    }
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_2",
  "submitMode": "interrupt",
  "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
}
```

**SDK Code**

```python Interrupt a running turn
import requests

url = "https://api.runtype.com/v1/client/chat"

payload = {
    "messages": [
        {
            "content": "Actually, do this first.",
            "role": "user",
            "id": "msg_user_2"
        }
    ],
    "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
    "assistantMessageId": "msg_assistant_2",
    "submitMode": "interrupt",
    "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Interrupt a running turn
const url = 'https://api.runtype.com/v1/client/chat';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"content":"Actually, do this first.","role":"user","id":"msg_user_2"}],"sessionId":"cs_01jq8z6k2re9v0w1m3n5p7s9t2","assistantMessageId":"msg_assistant_2","submitMode":"interrupt","turnId":"turn_01jq8z6k3rb1c2d3e4f5g6h7j8"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Interrupt a running turn
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/client/chat"

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Interrupt a running turn
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/client/chat")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}"

response = http.request(request)
puts response.read_body
```

```java Interrupt a running turn
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/client/chat")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}")
  .asString();
```

```php Interrupt a running turn
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/client/chat', [
  'body' => '{
  "messages": [
    {
      "content": "Actually, do this first.",
      "role": "user",
      "id": "msg_user_2"
    }
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_2",
  "submitMode": "interrupt",
  "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Interrupt a running turn
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/client/chat");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"content\": \"Actually, do this first.\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_2\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_2\",\n  \"submitMode\": \"interrupt\",\n  \"turnId\": \"turn_01jq8z6k3rb1c2d3e4f5g6h7j8\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Interrupt a running turn
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "messages": [
    [
      "content": "Actually, do this first.",
      "role": "user",
      "id": "msg_user_2"
    ]
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_2",
  "submitMode": "interrupt",
  "turnId": "turn_01jq8z6k3rb1c2d3e4f5g6h7j8"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/client/chat")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Normal chat turn

**Request**

```json
{
  "messages": [
    {
      "content": "Can you help me?",
      "role": "user",
      "id": "msg_user_1"
    }
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_1"
}
```

**SDK Code**

```python Normal chat turn
import requests

url = "https://api.runtype.com/v1/client/chat"

payload = {
    "messages": [
        {
            "content": "Can you help me?",
            "role": "user",
            "id": "msg_user_1"
        }
    ],
    "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
    "assistantMessageId": "msg_assistant_1"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Normal chat turn
const url = 'https://api.runtype.com/v1/client/chat';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"content":"Can you help me?","role":"user","id":"msg_user_1"}],"sessionId":"cs_01jq8z6k2re9v0w1m3n5p7s9t2","assistantMessageId":"msg_assistant_1"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Normal chat turn
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/client/chat"

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"content\": \"Can you help me?\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_1\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_1\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Normal chat turn
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/client/chat")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"content\": \"Can you help me?\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_1\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_1\"\n}"

response = http.request(request)
puts response.read_body
```

```java Normal chat turn
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/client/chat")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"content\": \"Can you help me?\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_1\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_1\"\n}")
  .asString();
```

```php Normal chat turn
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/client/chat', [
  'body' => '{
  "messages": [
    {
      "content": "Can you help me?",
      "role": "user",
      "id": "msg_user_1"
    }
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_1"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Normal chat turn
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/client/chat");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"content\": \"Can you help me?\",\n      \"role\": \"user\",\n      \"id\": \"msg_user_1\"\n    }\n  ],\n  \"sessionId\": \"cs_01jq8z6k2re9v0w1m3n5p7s9t2\",\n  \"assistantMessageId\": \"msg_assistant_1\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Normal chat turn
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "messages": [
    [
      "content": "Can you help me?",
      "role": "user",
      "id": "msg_user_1"
    ]
  ],
  "sessionId": "cs_01jq8z6k2re9v0w1m3n5p7s9t2",
  "assistantMessageId": "msg_assistant_1"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/client/chat")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```