latestOpenAPI 3.1.0MITraw.githubusercontent.com2026-08-142528921.8 MB

a884f7dcbfc3

AI Webhooks

AI post-prompt callback

Sent to your ai.post_prompt_url when the AI session ends. It carries the agent's answer to your post_prompt alongside the full record of the call: the conversation, the tool calls, the timings, and the token counts. This is the one report you get per call, so store the body verbatim and extract only the fields you query. Nothing you return in the response is read.

Read action first. It is post_conversation on the end-of-call report described here. The same URL also receives fetch_conversation when the agent starts with a stored conversation (save_conversation with a conversation_id), asking your endpoint to return that conversation; that request carries the call and session fields but none of the summary fields. Answer it with the stored conversation_summary.

The conversation appears three times. call_log is the filtered view, with interrupted segments consolidated. raw_call_log is unfiltered and append-only, and is the only place barge-in detail survives. call_timeline is a flat stream of typed events aligned to raw_call_log.

amazon_bedrock agents send a different report. Write your handler against the Bedrock post-prompt callback instead.

postWebhookaiPostPromptCallback

Payload

project_idstring

Your project ID, when available.

space_idstring

Your Space ID, when available.

content_typestring required

The content type of the request body. Always text/json.

content_dispositionstring required

How the body is delivered. agent.summary on the end-of-call report, agent.load_conversation on a request for a stored conversation.

conversation_typestring required

The kind of conversation the agent ran. Always voice.

call_idstring required

The ID of the call.

app_namestring required

The name of your AI application.

ai_session_idstring required

The ID of the AI session on the call.

ai_id_tagstring

A stable fingerprint of the model the agent ran. Two calls that used the same model share it, so you can group reports by model without recording the model name. Omitted when the session had no model.

conversation_idstring

The conversation ID, when the agent was configured with one.

action'post_conversation' | 'fetch_conversation' required

What the request is asking of you. post_conversation is the end-of-call report; fetch_conversation asks your endpoint to return a stored conversation.

hard_timeoutboolean

Always true when present, meaning the session ended because it hit its configured time limit rather than finishing on its own. Omitted otherwise.

call_start_dateinteger

When the call was created, as a Unix timestamp in microseconds.

call_answer_dateinteger

When the call was answered, as a Unix timestamp in microseconds. 0 when it never was.

call_end_dateinteger

When the call ended, as a Unix timestamp in microseconds.

ai_start_dateinteger

When the AI session started, as a Unix timestamp in microseconds.

call_ended_bystring

Who or what ended the call. Included when the session recorded it.

ai_end_dateinteger

When the AI session ended, as a Unix timestamp in microseconds. Omitted when the session was still running.

caller_id_namestring

The caller's name, when available.

caller_id_numberstring

The caller's number, when available.

SWMLVarsobject

SWML variables for the call. Included when the call carries SWML state.

SWMLCallobject

SWML call state. Included when the call carries SWML state.

global_dataobject

The session's final global_data. Alongside anything you seeded, the session adds caller_id_name and caller_id_number when the call carries them. Included when action is post_conversation.

total_minutesinteger

The number of billable minutes, rounded up to at least one. Included when you enable enable_accounting.

total_input_tokensinteger

Input tokens the session consumed. Included when you enable enable_accounting.

total_output_tokensinteger

Output tokens the session produced. Included when you enable enable_accounting.

total_wire_input_tokensinteger

Input tokens counted against the model, which differs from total_input_tokens when the conversation was trimmed. Included when you enable enable_accounting.

total_wire_input_tokens_per_minutenumber

total_wire_input_tokens divided by total_minutes. Included when you enable enable_accounting.

total_wire_output_tokensinteger

Output tokens counted against the model. Included when you enable enable_accounting.

total_wire_output_tokens_per_minutenumber

total_wire_output_tokens divided by total_minutes. Included when you enable enable_accounting.

total_tts_charsinteger

Characters sent to text-to-speech. Included when you enable enable_accounting.

total_tts_chars_per_minnumber

total_tts_chars divided by total_minutes. Included when you enable enable_accounting.

total_asr_minutesnumber

Minutes of audio sent to speech recognition. Included when you enable enable_accounting.

total_asr_cost_factornumber

total_asr_minutes divided by total_minutes. Included when you enable enable_accounting.

conversation_summarystring

A plain-language summary of the conversation, for storing against conversation_id and handing back on the next fetch_conversation. Included when you enable save_conversation and set a conversation_id.

Example payload

{
  "project_id": "4d0d6f16-5881-4fcc-92a4-02c51a91954d",
  "space_id": "451ed9ff-e568-4222-8af9-4f9ab7428d09",
  "content_type": "text/json",
  "content_disposition": "agent.summary",
  "conversation_type": "voice",
  "call_id": "2e1e66e5-5d07-413d-9668-55542992eec0",
  "app_name": "ai",
  "ai_session_id": "a0d4e6e5-5d07-413d-9668-55542992eec0",
  "ai_id_tag": "d742c5d1d969d9fdbbd9bd1c52499f2d",
  "conversation_id": "support-thread-4821",
  "action": "post_conversation",
  "call_log": [
    {
      "role": "system",
      "content": "You dispatch taxis."
    },
    {
      "role": "user",
      "content": "I need a ride to the airport."
    }
  ],
  "raw_call_log": [
    {
      "role": "assistant",
      "content": "Your ride is booked for 6pm.",
      "timestamp": 1694541297950440
    }
  ],
  "call_timeline": [
    {
      "type": "ai_response",
      "ts": 1694541297950440
    }
  ],
  "hard_timeout": true,
  "call_start_date": 1694541295773508,
  "call_answer_date": 1694541296799504,
  "call_end_date": 1694541335435503,
  "ai_start_date": 1694541297950440,
  "call_ended_by": "assistant",
  "ai_end_date": 1694541335425164,
  "caller_id_name": "Jane Doe",
  "caller_id_number": "+15555550100",
  "times": [
    {
      "response": "Your ride is booked for 6pm.",
      "response_word_count": 6,
      "answer_time": 1.42,
      "token_time": 0.31,
      "tokens": 53,
      "avg_tps": 37.3,
      "tps": 41.2
    }
  ],
  "post_prompt_data": {
    "parsed": [
      {
        "intent": "book_ride",
        "resolved": true
      }
    ],
    "raw": "{\"intent\":\"book_ride\",\"resolved\":true}",
    "substituted": "Caller booked a ride to the airport."
  },
  "global_data": {
    "customer_tier": "premium",
    "pickup_address": "123 Main St, Springfield"
  },
  "swaig_log": [
    {
      "command_name": "get_weather",
      "command_arg": "{\"city\":\"San Francisco\"}",
      "epoch_time": 1694541334,
      "native": true,
      "url": "https://example.com/tools/get_weather",
      "mcp_error": true
    }
  ],
  "total_minutes": 3,
  "total_input_tokens": 5627,
  "total_output_tokens": 119,
  "total_wire_input_tokens": 5627,
  "total_wire_input_tokens_per_minute": 1875.67,
  "total_wire_output_tokens": 119,
  "total_wire_output_tokens_per_minute": 39.67,
  "total_tts_chars": 842,
  "total_tts_chars_per_min": 280.67,
  "total_asr_minutes": 2.41,
  "total_asr_cost_factor": 0.8,
  "conversation_summary": "Caller booked a ride from 123 Main St to the airport for 6pm."
}

Response

Webhook received