By default, Titan API requests wait for the operation to complete before returning a response. For most calls this is fine, but when you’re sending a high volume of messages, running bulk operations, or simply don’t need to wait for the result, the synchronous pattern becomes a bottleneck. Async mode flips this: Titan acknowledges your request immediately and delivers the result to your webhook once the operation finishes.Documentation Index
Fetch the complete documentation index at: https://docs.usetitan.app/llms.txt
Use this file to discover all available pages before exploring further.
How it works
Add thePrefer: respond-async header to any API request. Instead of waiting for the result, Titan returns 202 Accepted with a correlation ID. When the operation completes, Titan sends a command.result webhook event containing the result and the same correlation ID so you can match it to the original request.
Sending an async request
202 Accepted:
correlationId. You’ll use it to match the incoming webhook event to this specific request.
The command.result webhook event
When the operation completes, Titan delivers a command.result event to your registered webhook:
correlationId in the webhook payload matches the one returned by the 202 response. The result object contains the same data you would have received synchronously.
If the operation fails, success will be false and result will contain the error details.
When to use async mode
Bulk message sending
Bulk message sending
When you need to send messages to hundreds or thousands of recipients, async mode lets you fire all the requests without blocking on each one. Your webhook handler receives results as they complete.
Long-running operations
Long-running operations
Some operations — like QR code pairing that waits for a scan — can take seconds or longer. Async mode frees your request thread immediately.
Decoupled architectures
Decoupled architectures
If your application uses a queue-based architecture, async commands map cleanly onto that pattern: enqueue the API call, process results from the
command.result queue.Async mode works with any API endpoint that forwards commands to the Titan runner. The
Prefer: respond-async header is ignored on endpoints that return data directly without forwarding a command (for example, read-only GET requests).Correlating requests to results
A typical pattern is to store thecorrelationId alongside the job in your own database when you fire the request, then look up the job when the webhook arrives:
Fire the request and store the correlation ID
Send the API request with
Prefer: respond-async. Save the returned correlationId in your database alongside any context you need (user ID, job type, etc.).Receive the webhook
When the
command.result event arrives at your webhook endpoint, extract the correlationId from data.correlationId.Webhook setup
Register a webhook that subscribes tocommand.result if you haven’t already: