Define a webhook tool
Create a webhook tool by sending this request body toPOST /v1/agents/tools. The outer fields define the tool and its execution settings. The nested api_schema describes the separate outbound HTTPS request that Cartesia sends to your API when the LLM invokes the tool. In api_schema, supply method and url, plus any path parameters, query parameters, JSON body, headers, or authentication that your API requires.
POST /v1/agents/tools
config.tools. See Tools for the shared execution settings.
api_schema
api_schema.url must use HTTPS, and requests to private and internal network ranges are blocked. api_schema.method supports GET, POST, PUT, PATCH, and DELETE.
api_schema.path_params_schemafills placeholders inapi_schema.url, such as{order_id}. Every{placeholder}inapi_schema.urlmust have an entry with the same case-sensitive name inapi_schema.path_params_schema. Each path parameter is required and may be a string, integer, or number.api_schema.query_params_schemadescribes query parameters withpropertiesand an optionalrequiredlist. Each property name becomes a query-string key; these names do not map to placeholders inapi_schema.url.api_schema.request_body_schemadescribes a JSON object forPOST,PUT, orPATCH. Body properties may be nested.
Parameter descriptions tell the model what value to provide. Use
constant_value for a value the model should not choose, such as an API version. Use dynamic_variable values for per-customer context or values fetched at runtime.
For example, this tool sends the current customer_id with each request:
POST /v1/agents/tools
Last known status: {{order_status}} to the tool description so the model can see the value too.
Headers and authentication
api_schema.request_headers accepts strings, secrets, and dynamic variables. Add headers with PATCH /v1/agents/tools/{tool_id}, using your tool ID and API credential:
PATCH /v1/agents/tools/{tool_id}
authentication adds credentials to the Authorization header at request time. bearer sends Authorization: Bearer <token>, and basic_auth sends Authorization: Basic <base64(username:password)>. Do not also set Authorization in request_headers.
The API never returns saved secret values. When updating a tool, omitted headers and authentication stay unchanged. If you include an existing secret field, use { "type": "secret" } without secret_value to keep its value.
To remove a header, set that header to null inside api_schema.request_headers. To remove authentication, set api_schema.authentication to null.
Cartesia reserves transport headers that it manages itself. Header names must be unique, regardless of capitalization.
Responses and timeouts
For a successful request (2xx) with a textual response body, the body becomes the result given to the LLM. Return only the data the LLM needs. Cartesia limits the body to 4096 bytes and adds[cut off: the response was longer than this tool returns] if it is longer.
Use assignments to save response fields as dynamic variables. For a response such as {"order": {"id": "A-1001", "status": "shipped"}}, the assignments below save the order ID and status. Configure them in the tool’s side panel in the Playground or with PATCH /v1/agents/tools/{tool_id}:
PATCH /v1/agents/tools/{tool_id}
null value leaves the previous variable value unchanged. Objects and lists are saved as JSON text.
The request times out after response_timeout_secs, which defaults to 20 seconds. If the request times out, the endpoint cannot be reached, or the endpoint returns a non-2xx status, Cartesia gives the LLM an error result describing the failure and the conversation continues. Use execution_mode: "async" for requests that do not need to block the current turn.