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

# Callbacks

> Receive notifications when automations complete

Set up callbacks to receive automation results without polling.

## Overview

Optexity sends HTTP POST requests to your callback URL when automations complete.

| Environment | Configuration |
| - | - |
| Local | `LOCAL_CALLBACK_URL` environment variable |
| Production | Set in dashboard |

***

## Local Development

Set the environment variable:

```bash theme={null}
LOCAL_CALLBACK_URL=http://localhost:3000/receive_callback
```

Requirements:

* URL must be accessible from the machine running the automation
* Endpoint must be unauthenticated

***

## Production

Configure in the Optexity dashboard:

* Callback URL must be publicly accessible
* Supports API key authentication
* Supports username/password authentication

***

## Callback Payload

```json theme={null}
{
  "task_id": "abc123",
  "recording_id": "rec456",
  "endpoint_name": "login-flow",
  "status": "success",
  "output_data": [
    {"name": "email", "value": "test@example.com"}
  ],
  "error": null,
  "final_screenshot": "base64_encoded_string",
  "downloads": [
    {"url": "signed_url", "filename": "report.pdf"}
  ],
  "downloads_with_metadata": [
    {
      "url": "signed_url",
      "filename": "report.pdf",
      "metadata": {"doc_id": "123", "kind": "report"}
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `task_id` | `str` | Unique task identifier |
| `status` | `str` | `queued`, `allocated`, `running`, `success`, `failed`, `cancelled` |
| `output_data` | `list` | Extracted data objects |
| `error` | `str \| null` | Error message if failed |
| `final_screenshot` | `str` | Base64 screenshot |
| `downloads` | `list` | Download URLs and filenames |
| `downloads_with_metadata` | `list \| omitted` | All downloads with optional `metadata`; only present when at least one file has metadata |

Set `download_metadata` on `expect_download` actions to populate this. See [Downloads & Files](https://docs.optexity.com/docs/advanced/downloads-files.md).

***

## Authentication

| Type | Fields Required |
| - | - |
| API Key | `api_key` |
| Basic Auth | `username`, `password` |

> [!NOTE]
>
> See [Callback Reference](https://docs.optexity.com/api-reference/callback.md) for complete schema details.


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