Skip to content

Chat API & Conversational Trigger

Conversational agent graphs can be called from your own code in two ways:

Option Use it to
Chat API (a channel) Connect your own app or backend to Phinite over a REST chat API
Conversational Trigger Start a conversation in a chosen channel integration (for example Slack, Teams, or WhatsApp) using a specified agent graph

Both run the build assigned to the environment you call. Authenticate with a workspace API key (Keys → API Keys):

Terminal window
Authorization: Bearer <YOUR_WORKSPACE_API_KEY>

{environment} is development, uat, or production.


  1. Create a Chat API configuration In Graph Studio, click Deploy, select a build, and choose Deploy as Chat API (or open Integrations → Channels → Chat API). Add a connection, assign the build, and configure Development, UAT, and Production separately.

  2. Copy the endpoint Copy the Chat API URL for your target environment from the Connections tab. Each environment has its own URL with the channel’s integration_id.

  3. Integrate from your backend POST to start or continue conversations with your workspace API key and the integration ID. Call the Chat API from a backend, never from a public client, so the API key stays private.

    Chat API connections

POST https://app.phinite.ai/api/v1/ai/chat_api/{integration_id}/{environment}

No request body. Optional header unique-id: <your-session-id> sets the session ID yourself; otherwise a UUID is generated. Phinite starts the agent graph with an initial hi message and returns its greeting:

{
"response": { "query": "Hello! How can I assist you today?" },
"session_id": "be3df76d-a03e-4e9d-bcef-05d2b6a6a451",
"status": "resolved"
}
POST https://app.phinite.ai/api/v1/ai/chat_api/{session_id}
{
"message": "Where is my latest order?"
}

To send files, add image, audio, video, or document (URL lists).

The reply is streamed as NDJSON (application/x-ndjson): one JSON object per line, sent as soon as it is produced.

{"response":{"query":"Sure! Let me check that for you."},"status":"processing"}
{"response":{"query":"Your order shipped yesterday."},"status":"completed"}
Status Meaning
processing The agent graph is still running
completed Final response for this turn
transferred The conversation was handed to a human agent
error Something went wrong
Code Body Cause
401 {"detail": "Unauthorized"} Missing or invalid workspace API key
404 {"detail": "Session not found"} Unknown or expired session_id
500 {"detail": "Failed to initialize conversation session"} The session could not start

A Conversational Trigger starts a conversation in a chosen channel integration using a specified agent graph. It is API-only, with one endpoint per environment. Use it to hand off to a channel: for example, a backend event starts a Slack or WhatsApp conversation with the user.

  1. Create the trigger Go to Integrations → Triggers and create a Conversational Trigger.

  2. Choose the channel and graph Select the channel integration and the conversational agent graph.

  3. Assign a build Make sure a build of the graph is assigned to the environment you will call.

  4. Call the endpoint Copy the endpoint for the environment and call it with your workspace API key.