> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bland.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Outcome

> Create an outcome script for your organization.

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](https://docs.bland.ai/api-v1/post/calls.md) or [Send SMS](https://docs.bland.ai/api-v1/post/sms-send.md), and they run when the conversation ends. See [Outcomes](https://docs.bland.ai/tutorials/outcomes.md) 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](https://docs.bland.ai/api-v2/get/agents-id-dispositions.md).

### Headers

**authorization** `string` *required*

Your API key for authentication.

### Body Parameters

**name** `string` *required*

A name for the outcome. 1 to 100 characters, letters and underscores only (for example, `appointment_outcome`).

**script** `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:

```js theme={null}
export default {
  async fetch(request) {
    const call = await request.json();
    return Response.json({
      booked: call.summary?.includes("booked") ?? false,
      minutes: call.call_length,
    });
  },
};
```

The request body is the same JSON that [Call Details](https://docs.bland.ai/api-v1/get/calls-id.md) returns for that call. Scripts can't make network calls: a script that uses `fetch()`, `XMLHttpRequest` or `WebSocket` is rejected with a 400.

**metadata** `object` (default: \{})

Any key-value data you want stored with the outcome.

### Response

**data** `object`

The new outcome.

**Outcome fields**

**id** `string`

The outcome ID.

**org\_id** `string`

The organization that owns the outcome.

**name** `string`

The outcome name.

**metadata** `object`

The metadata you stored with the outcome.

**snippet\_id** `string`

The ID of the stored script.

**snippet\_version** `integer`

The script version. Starts at `1` and goes up each time you update the script.

**created\_at** `string`

When the outcome was created (ISO 8601).

**updated\_at** `string`

When the outcome was last updated (ISO 8601).

**errors** `null | array`

`null` on success, otherwise an array of error objects.

```json Response theme={null}
{
  "data": {
    "id": "51b2f9ae-4162-4880-9920-10308352c55f",
    "org_id": "9b51b0fc-4127-446a-9ffb-21b1f006e6b5",
    "name": "appointment_outcome",
    "metadata": {},
    "snippet_id": "44468cc3-d31f-47cd-8cff-94476b904a28",
    "snippet_version": 1,
    "created_at": "2026-10-26T15:04:12.381Z",
    "updated_at": "2026-10-26T15:04:12.381Z"
  },
  "errors": null
}
```

```json Invalid Body theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "BAD_REQUEST",
      "message": "Invalid request body",
      "ext": "{\"errors\":[\"/name: Expected string to match '^[a-zA-Z_]+$'\"]}"
    }
  ]
}
```

***

Docs for agents: [llms.txt](https://docs.bland.ai/llms.txt)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.