AI
Query Chat Session
Retrieve information about an existing chat session, returning only messages after the specified cursor position. Messages include run_id to identify generation runs.
api-key<token>
In: header
Path Parameters
sessionId*string
Unique identifier for the session
Query Parameters
cursorPosition?integer
Start cursor position - only messages after this position will be returned
Format
int32Response Body
application/json
curl -X GET "https://example.com/v1/ai/chat/string"{ "context": { "autoConfig": { "executeQuery": true }, "insightConfig": { "executeQuery": true }, "projectOwner": "string", "projectSlug": "string", "scenario": "SCENARIO_UNSPECIFIED", "sqlConfig": { "executeQuery": true }, "version": 0 }, "messages": [ { "isFinal": true, "resources": [ { "blob": "string", "description": "string", "mimeType": "string", "name": "string", "text": "string", "uri": "string" } ], "role": "ROLE_UNSPECIFIED", "runId": "string", "structured": { "error": { "code": "string", "message": "string" }, "insightQuery": { "chartType": "CHART_TYPE_UNSPECIFIED", "explanation": "string", "formulas": [ { "expression": "sum(a)+sum(b)" } ], "queries": [ { "aggregate": null, "alias": "transfer (24h)", "disabled": false, "functions": [ { "arguments": [ { "durationValue": { "unit": "d", "value": 1 } } ], "name": "rollup_sum" } ], "id": "a", "labelSelector": {}, "query": "transfer_sum" } ], "results": [ { "alias": "string", "error": "string", "id": "string", "matrix": { "samples": [ { "metric": { "displayName": "string", "labels": { "property1": "string", "property2": "string" }, "name": "string" }, "values": [ { "timestamp": "string", "value": 0.1 } ] } ], "totalSamples": 0 } } ], "samplesLimit": 0, "timeRange": { "end": "now", "start": "now-1M", "step": 86400, "timezone": "Europe/London" }, "title": "string" }, "sql": { "chartType": "CHART_TYPE_UNSPECIFIED", "error": "string", "explanation": "string", "query": "string", "result": { "columnTypes": { "property1": "STRING", "property2": "STRING" }, "columns": [ "string" ], "cursor": "string", "generatedAt": "2019-08-24T14:15:22Z", "rows": [ {} ] }, "title": "string" }, "type": "CONTENT_TYPE_UNSPECIFIED" }, "text": "string" } ], "preserveSession": true, "streaming": true}Create Chat Session POST
Initialize a new AI chat session. Returns a session_id that can be used with PostSessionMessage to have a conversation with the AI. Messages are generated as part of runs, with is_final indicating run completion.
Post Session Message POST
Add a new message to an existing chat session. This will trigger AI message generation as a run. check is_final to know when all messages for the run have been generated.