Skip to main content
Before you begin, make sure you have a running VyomFlow backend and a valid Clerk session token. The backend defaults to 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 POST request to /api/v1/chats with your Clerk token.
Example response:
Save the 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 content field with the text you want to send.
Example response:
After the message is accepted, the API starts an agent run. The response also includes a runId and a realtimeToken you can use to stream the agent reply.
4

Stream the response

Use the realtimeToken from the previous step with Trigger.dev realtime to subscribe to the agent run output.
As the agent generates tokens, they arrive in real time through this stream. When the run finishes, the stream closes.

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.