|
| 1 | +--- |
| 2 | +title: Web Callouts |
| 3 | +description: Trigger an HTTP callout from a trace, observation, or session in Langfuse. |
| 4 | +sidebarTitle: Web Callouts |
| 5 | +--- |
| 6 | + |
| 7 | +# Web Callouts |
| 8 | + |
| 9 | +Web Callouts let project members trigger a configured backend HTTP request from a trace, observation, or session in the Langfuse UI. Use them to connect debugging workflows to internal tools, support systems, incident workflows, or custom investigation services. |
| 10 | + |
| 11 | +Unlike [prompt webhooks](/docs/prompt-management/features/webhooks-slack-integrations), Web Callouts are manually triggered from the UI. Langfuse sends the request synchronously from the backend when the user clicks the action. |
| 12 | + |
| 13 | +<Callout type="info"> |
| 14 | + This feature is currently behind the `env` variable `LANGFUSE_ENABLE_WEB_CALLOUTS`. It will be rolled out to cloud soon, at which point we will remove this variable. |
| 15 | +</Callout> |
| 16 | + |
| 17 | +<Callout type="info"> |
| 18 | + Web Callouts send identifiers only. The request payload only sends the trace/observation/session ID and the project id. |
| 19 | + Fetch additional data from the Langfuse API in your own backend if your workflow needs it. |
| 20 | +</Callout> |
| 21 | + |
| 22 | +## Configure a Web Callout |
| 23 | + |
| 24 | +Open **Project Settings** > **Integrations** > **Web Callouts** and create a callout endpoint. You need `integrations:CRUD` permissions. |
| 25 | +Callouts are configured per project and can be invoked by **all** users in a project. |
| 26 | + |
| 27 | +Configure: |
| 28 | + |
| 29 | +- **Name:** shown in the action menu, for example `Open in Support Tool`. |
| 30 | +- **URL:** HTTP or HTTPS endpoint that accepts `POST` requests. Custom ports are supported. |
| 31 | +- **Success toast message:** shown after your endpoint returns a successful response. |
| 32 | +- **Enabled:** disabled callouts are hidden from the action menu. |
| 33 | +- **Request headers:** optional static headers, for example `Authorization: Bearer <token>`. |
| 34 | + |
| 35 | +## Trigger a Web Callout |
| 36 | + |
| 37 | +After setup, users with project read access can trigger the callout from: |
| 38 | + |
| 39 | +- The action menu on trace details. |
| 40 | +- The action menu on observation details. |
| 41 | +- The session details header. |
| 42 | + |
| 43 | +Langfuse sends the request immediately when the user clicks the action. The UI shows a success toast only after your endpoint returns a 2xx response. |
| 44 | +The request times out after 5 seconds. Calls will not be retried. |
| 45 | + |
| 46 | +## Request Payload |
| 47 | + |
| 48 | +Langfuse sends a JSON `POST` request with this structure: |
| 49 | + |
| 50 | +```json filename="web-callout-payload.json" |
| 51 | +{ |
| 52 | + "version": 1, |
| 53 | + "items": [ |
| 54 | + { |
| 55 | + "projectId": "project-id", |
| 56 | + "traceId": "trace-id", |
| 57 | + "observationId": null, |
| 58 | + "sessionId": "session-id" |
| 59 | + } |
| 60 | + ] |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +Note: all ID fields except for the `projectId` are nullable. |
| 65 | +Langfuse validates that the trace, observation, and session belong to the project before sending the request. |
| 66 | + |
| 67 | +## Endpoint Requirements |
| 68 | + |
| 69 | +Your endpoint must: |
| 70 | + |
| 71 | +- Accept `POST` requests with `Content-Type: application/json`. |
| 72 | +- Return any HTTP 2xx status within 5 seconds. |
| 73 | + |
| 74 | +Langfuse treats non-2xx responses, network errors, invalid URLs, and timeouts as failed callouts and shows an error toast. |
| 75 | + |
| 76 | +Web Callouts are not retried and Langfuse does not keep a delivery log. |
| 77 | + |
| 78 | +## Authentication and Headers |
| 79 | + |
| 80 | +You can configure static request headers for authentication, for example `Authorization` or `X-API-Key`. |
| 81 | +Header values are encrypted at rest and are sent from the Langfuse backend. When editing an existing header without changing its name, leaving the value empty keeps the stored encrypted value. |
| 82 | + |
| 83 | +Langfuse sets `Content-Type: application/json` and `User-Agent: Langfuse/1.0` automatically. |
| 84 | +The following header names cannot be configured: `content-length`, `content-type`, `cookie`, and `host`. |
0 commit comments