AI Agent
Authorization
Signed mode: every request is signed with your App Key/Secret. Header set:
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string · header | Required | The account Access Token from the OpenAPI dashboard — passed as the raw token (no Bearer prefix) and included in the signature calculation. |
X-Api-Key | string · header | Required | Your App Key. |
X-Timestamp | string · header | Required | Request timestamp in seconds (Unix epoch). |
X-Api-Signature | string · header | Required | HMAC-SHA256 signature. Format: HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=. |
Ask a question to the specified Agent. You can start a brand-new conversation, or pass the chat_uid of an existing one to continue asking in the same conversation.
The Agent generates the answer using capabilities such as market data and account access. When the Agent needs more information or confirmation from you, the run is interrupted (status is interrupted) — send your answers via Continue Conversation to resume it.
Choose the response mode with the Accept header: text/event-stream streams the run progress and answer via SSE; any other value returns a blocking response with the aggregated final result.
How to find an Agent's UID
Besides querying the Agents in Workspace endpoint, you can also get it directly from the Longbridge website: open the Agent's chat page — the URL looks like https://longbridge.com/en/ai/agents/chatbot/chat, where chatbot is the Agent's UID.
Request
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Required | UID of the target Agent; must be a published Agent |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Required | The user question; must not be empty |
chat_uid | string | Optional | Identifier of an existing conversation. Pass it to continue that conversation; omit to start a new one |
parent_message_id | string | Optional | Parent message ID, taken from the `message_id` in the previous response. Pass it when asking a follow-up in an existing conversation to attach the new message after the specified one, keeping the message stream in order. Only valid together with `chat_uid`, and the parent message must belong to that conversation; must not be set for a new conversation |
Response
Response properties
| Name | Type | Required | Description |
|---|---|---|---|
chat_uid | string | Required | Conversation identifier, used for follow-up questions and troubleshooting |
message_id | string | Required | Message ID of this round (as a string) |
status | string | Required | Final run status: `succeeded` / `interrupted` / `failed` / `stopped` |
answer | string | Optional | Final answer text; valid when `status` is `succeeded` |
references | object[] | Optional | Sources referenced by the answer; `null` if none |
elapsed_time | number | Optional | Run duration in seconds |
interrupt | object | Optional | Present only when `status` is `interrupted` |
└ node_id | string | Required | ID of the node that triggered the interrupt |
└ tool_call_id | string | Required | Tool call ID of this inquiry; used as the answer key when continuing |
└ questions | object[] | Required | Questions you need to answer |
└ ∟ question | string | Required | Question text |
└ ∟ options | object[] | Optional | Options; empty means free-form answer |
└ ∟∟ description | string | Optional | Option text |
└ ∟ multi_select | boolean | Optional | Whether multiple options may be selected |
└ message_id | int64 | Optional | ID of the paused message |
└ chat_id | int64 | Optional | ID of the owning conversation |
error | object | Optional | Present only when the run failed |
└ code | int32 | Optional | Error code |
└ message | string | Optional | Error message |
Response JSON example
{
"code": 0,
"message": "success",
"data": {
"chat_uid": "ct_9f2c1a5b",
"message_id": "42",
"status": "succeeded",
"answer": "Tesla (TSLA.US) recently...",
"references": [
{
"index": 1,
"title": "...",
"url": "..."
}
],
"elapsed_time": 3.21
}
}Error code
See the Error Codes page for the full list of error codes.