Skip to main content

POST /chat/confirm

Confirm and execute actions that were planned by the agent but require user approval. This endpoint is used when the agent returns requires_confirmation: true in the chat response or emits a confirmation_required event during streaming.

Authentication

Requires a valid session cookie (session_id) obtained through the OAuth flow.

Request Body

thread_id
string
required
Thread ID of the conversation that requires confirmation. This is the same thread ID returned by the agent when it requested confirmation.
confirmation
string
Optional explicit confirmation text (e.g., “yes”, “confirm”). Currently not used in processing but available for future extensions.

Request Example

{
  "thread_id": "thread_xyz789",
  "confirmation": "yes"
}

Response

thread_id
string
required
Thread ID of the conversation
status
string
required
Execution status - "completed" when actions are successfully executed
response
string
required
The agent’s final response after executing the confirmed actions
results
object
required
Dictionary of execution results, keyed by action ID.Each result contains:
  • tool (string): Tool that was executed
  • success (boolean): Whether execution succeeded
  • result (object, optional): Result data from the tool
  • error (string, optional): Error message if execution failed

Response Example

{
  "thread_id": "thread_xyz789",
  "status": "completed",
  "response": "I've created the meeting 'Project Review' on March 10th at 3 PM.",
  "results": {
    "action_1": {
      "tool": "create_calendar_event",
      "success": true,
      "result": {
        "event_id": "evt_12345",
        "title": "Project Review",
        "start": "2026-03-10T15:00:00",
        "link": "https://calendar.google.com/event?eid=evt_12345"
      },
      "error": null
    }
  }
}

Workflow Example

1. Agent requests confirmation

When using synchronous chat:
// Response from POST /chat
{
  "response": "I can schedule that meeting for you.",
  "thread_id": "thread_xyz789",
  "requires_confirmation": true,
  "confirmation_message": "Should I create a meeting titled 'Project Review' on March 10th at 3 PM?"
}
Or when using streaming:
event: confirmation_required
data: {"event_type":"confirmation_required","data":{"thread_id":"thread_xyz789","message":"Should I create a meeting titled 'Project Review' on March 10th at 3 PM?"}}

2. User confirms

curl -X POST "https://api.example.com/chat/confirm" \
  -H "Content-Type: application/json" \
  -H "Cookie: session_id=your_session_id" \
  -d '{
    "thread_id": "thread_xyz789"
  }'

3. Actions are executed

The agent executes the planned actions and returns the results.

Status Codes

CodeDescription
200Actions confirmed and executed successfully
401Not authenticated - missing or invalid session cookie
429Rate limit exceeded
500Failed to execute actions

Error Response

{
  "error": "execution_error",
  "message": "Failed to execute actions: <error details>"
}

Rate Limiting

Default rate limit: 60 requests per minute per session.

cURL Example

curl -X POST "https://api.example.com/chat/confirm" \
  -H "Content-Type: application/json" \
  -H "Cookie: session_id=your_session_id" \
  -d '{
    "thread_id": "thread_xyz789",
    "confirmation": "yes"
  }'

JavaScript Example

const response = await fetch('https://api.example.com/chat/confirm', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    thread_id: 'thread_xyz789',
    confirmation: 'yes'
  })
});

const result = await response.json();
console.log('Action completed:', result.response);
console.log('Results:', result.results);
If you want to cancel the action instead of confirming it, use the cancel endpoint.

Build docs developers (and LLMs) love