Skip to main content
Webhooks enable event-driven communication from your LangSmith application to external services. For example, you may want to issue an update to a separate service once an API call to LangSmith has finished running. Many LangSmith endpoints accept a webhook parameter. If this parameter is specified by an endpoint that can accept POST requests, LangSmith will send a request at the completion of a run. When working with LangSmith, you may want to use webhooks to receive updates after an API call completes. Webhooks are useful for triggering actions in your service once a run has finished processing. To implement this, you need to expose an endpoint that can accept POST requests and pass this endpoint as a webhook parameter in your API request. Currently, the SDK does not provide built-in support for defining webhook endpoints, but you can specify them manually using API requests.

Supported endpoints

The following API endpoints accept a webhook parameter: In this guide, we’ll show how to trigger a webhook after streaming a run.

Set up your assistant and thread

Before making API calls, set up your assistant and thread.
Example response:

Use a webhook with a graph run

To use a webhook, specify the webhook parameter in your API request. When the run completes, LangSmith sends a POST request to the specified webhook URL. For example, if your server listens for webhook events at https://my-server.app/my-webhook-endpoint, include this in your request:

Webhook payload

LangSmith sends webhook notifications in the format of a Run. The request payload includes run input, configuration, and other metadata in the kwargs field. In addition to the standard run fields, the webhook payload also includes values, webhook_sent_at, and error fields. The full webhook payload contains the following fields: Example payload:
When a run fails, the error field contains details about the failure:

Secure webhooks

To ensure only authorized requests hit your webhook endpoint, consider adding a security token as a query parameter:
Your server should extract and validate this token before processing requests.

Add headers to webhook requests

Available in langgraph-api>=0.5.36.
You can configure static headers to include with all outbound webhook requests. This is useful for authentication, routing, or passing metadata to your webhook endpoint. Add a webhooks.headers configuration to your langgraph.json file:

Use environment variables in headers

To include secrets or environment-specific values without checking them into your configuration file, use the ${{ env.VAR }} template syntax:
For security, only environment variables starting with LG_WEBHOOK_ can be referenced by default. This prevents accidentally leaking unrelated environment variables. You can customize this prefix using env_prefix:
Missing required environment variables will block server startup, ensuring you don’t deploy with incomplete configuration.

Restrict webhook destinations

Available in langgraph-api>=0.5.36.
For security or compliance purposes, you can restrict which URLs are valid webhook destinations using the webhooks.url configuration:
Available options:

Disable webhooks

As of langgraph-api>=0.2.78, developers can disable webhooks in the langgraph.json file:
This feature is primarily intended for self-hosted deployments, where platform administrators or developers may prefer to disable webhooks to simplify their security posture—especially if they are not configuring firewall rules or other network controls. Disabling webhooks helps prevent untrusted payloads from being sent to internal endpoints. For full configuration details, refer to the configuration file reference.

Test webhooks

You can test your webhook using online services like:
  • Beeceptor – Quickly create a test endpoint and inspect incoming webhook payloads.
  • Webhook.site – View, debug, and log incoming webhook requests in real time.
These tools help you verify that LangSmith is correctly triggering and sending webhooks to your service.