http://localhost:3000, and every request must include an Authorization: Bearer <token> header.
1
Get your Clerk session token
Your frontend authenticates users with Clerk. Retrieve the current session token from the Clerk JS SDK so you can include it in API requests:Pass this token as a Bearer token in the
Authorization header on every call.2
Create a chat
Start by creating a new chat session. Send a Example response:Save the
POST request to /api/v1/chats with your Clerk token.id value. You will use it in the next step.3
Send a message
Post a message to the chat you just created. The request body needs a Example response:After the message is accepted, the API starts an agent run. The response also includes a
content field with the text you want to send.runId and a realtimeToken you can use to stream the agent reply.4
Stream the response
Use the As the agent generates tokens, they arrive in real time through this stream. When the run finishes, the stream closes.
realtimeToken from the previous step with Trigger.dev realtime to subscribe to the agent run output.Next steps
Authentication
Learn how Clerk tokens work and how to handle auth errors.
Core Concepts
Explore chats, runs, waitpoints, and attachments in depth.
API Reference
Browse the full endpoint list and request/response schemas.