Prerequisites
Before you begin, you’ll need:- A Trellis API key (contact your admin or Trellis support)
- Your organization’s HMAC secret, kept on your backend
- Your organization’s assigned agent UUID, supplied by Trellis and stored in configuration
- A database integration configured in your Trellis organization
Step 1: Authenticate
Exchange your API key for a JWT token. Each call needs both the user’s email and auser_key — an HMAC-derived value your backend computes from the shared secret Trellis issued you. See Authentication for the derivation algorithm and reference snippets.
token from the response—you’ll use it for all subsequent requests.
Step 2: List available integrations
Find out which database integrations are available:id of the integration you want to query.
Also call GET /v1/agents and confirm that your organization’s assigned agent UUID appears in the response. An organization may have a single published, org-scoped agent whose name and is_trellis_default flag are historical metadata; clients must match the configured id exactly rather than selecting by name, order, or flag.
Step 3: Create a chat
Every conversation starts with achat_id. Create one before sending a message:
id as the chat_id. Verify that the returned agent_id exactly matches your configured agent UUID before opening the WebSocket. A mismatch means the chat is bound to a different agent: stop and contact Trellis rather than silently connecting to whichever agent is marked default.
Step 4: Send a query
Chat turns stream over the per-agent WebSocket endpoint atwss://api.trellis.sh/v1/agents/{agent_id}/chats/ws. Connect (authenticating on the upgrade), send a send_message frame, and read the streamed event frames. Every turn frame is wrapped in a durable envelope — read frame["event"] and frame["data"]:
You’ve successfully sent your first query to the Trellis API.
Next steps
Streaming Responses
Learn how to stream chat turns over WebSocket — envelope, interrupt, resume.
Structured Output
Handle charts, tables, and typed panels from the chat stream.
Response Feedback
Collect user feedback on AI responses.
API Reference
Explore all available endpoints.