Use cases
Custom chatbots
Embed a Connectly AI agent in your own web or mobile interface.
Sales assistants
Guide customers through product discovery and purchase flows programmatically.
Support automation
Resolve common queries without human escalation, integrated into your existing systems.
Session lifecycle
Every Agent Graph interaction follows a three-phase lifecycle:Init
Call POST /agent_graph/init with your
businessId and clientKey. Receive a sessionId that identifies this conversation.Invoke
Call POST /agent_graph/invoke (or
/invoke_sync) with the sessionId and customer inputEvents. Receive the agentβs response. Repeat for each turn in the conversation.Close
Call POST /agent_graph/close when the conversation is complete to release the session and its resources.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /external/v1/ai/agent_graph/init | Start a session β returns sessionId. |
POST | /external/v1/ai/agent_graph/invoke | Send input, receive a streaming NDJSON response. |
POST | /external/v1/ai/agent_graph/invoke_sync | Send input, receive a single aggregated JSON response. |
POST | /external/v1/ai/agent_graph/close | End a session and release its resources. |
POST | /external/v1/ai/agent_graph/health | Check API availability. |
https://api.connectly.ai.
Authentication
Include your API key in thex-api-key header (lowercase):
Required fields
All endpoints (except/init) require these three fields in the request body:
| Field | Description |
|---|---|
businessId | Your Connectly business UUID. |
clientKey | A stable identifier for the customer (e.g. phone number or internal user ID). |
sessionId | The session ID returned by /init. |
Streaming vs sync
The/invoke endpoint returns a streaming NDJSON response β one JSON object per line β so your application can begin processing the agentβs reply progressively rather than waiting for the full response.
Use /invoke_sync when you donβt need streaming β for example, in a backend job that waits for the complete response before proceeding. It returns a single aggregated JSON object and works with a standard response.json() call.
End-to-end example (Python)
Next steps
Init session
Start a conversation and get a
sessionId.Invoke (stream)
Send input events and parse the NDJSON streaming response.
Invoke (sync)
Get a single aggregated response without streaming.
NDJSON streaming
How to correctly parse the streaming response body.
