Skip to main content
POST
Create Outcome
An outcome is a JavaScript script that reads a finished call or SMS conversation and returns structured data. The API calls outcomes dispositions. Pass outcome IDs in disposition_ids on Send Call or Send SMS, and they run when the conversation ends. See Outcomes for how they work. Outcomes are available on enterprise plans. Creating, updating, deleting and running an outcome requires the Owner, Admin or Operator role. Dispositions on V2 agents are a separate feature with their own endpoints.

Headers

string
required
Your API key for authentication.

Body Parameters

string
required
A name for the outcome. 1 to 100 characters, letters and underscores only (for example, appointment_outcome).
string
required
The JavaScript source, up to 200,000 characters. The script exports a fetch handler, reads the call from the request body and returns a JSON response:
The request body is the same JSON that Call Details returns for that call. Scripts can’t make network calls: a script that uses fetch(), XMLHttpRequest or WebSocket is rejected with a 400.
object
default:"{}"
Any key-value data you want stored with the outcome.

Response

object
The new outcome.
null | array
null on success, otherwise an array of error objects.

Docs for agents: llms.txt