Configuration and administration
Integrate data questions into business systems with REST API
Use REST API to integrate data questions and answers into business systems.
REST API is under /v1 on the deployment instance and supports integration into business systems, portals, and automated workflows. The current version requires selecting a data Agent, creating a conversation, sending a question, and reading the result. The old POST /v1/integration/query endpoint has been removed; do not continue sending single queries directly with data source IDs.
Before you begin
- An AskTable deployment instance, its external URL, and a project ID.
- An API Key: use a personal Key to call as yourself, or a system integration Key for a trusted business system. For system integration, use
askerfor questions oradminfor project infrastructure such as data sources and semantic configuration. - Creation location: main navigation → “Agent integration”. The lower section defaults to “Personal Key”; only project owners and administrators can enter “System integration Key”. The full value appears only once at creation. A blank name is generated automatically, and an expiry can be set.
- A data Agent you can use with ready data sources, and its ID.
- Documentation entry: bottom avatar → “Documentation” → “REST API” opens the current instance's Redoc.
Steps
Confirm the API root and documentation URLs
Assume the AskTable URL is https://asktable.example.com:
| Purpose | URL |
|---|---|
| API root | https://asktable.example.com/v1 |
| Interactive documentation (Redoc) | https://asktable.example.com/v1/redoc |
| Swagger UI | https://asktable.example.com/v1/docs |
| OpenAPI specification | https://asktable.example.com/openapi.json |
The current instance's Redoc is authoritative for endpoints and fields. Copy the service URL and current project ID from “Connection details” in “Agent integration”.
Include the authentication header
Use these request headers:
Authorization: Bearer YOUR_API_KEY
X-Project-Id: YOUR_PROJECT_IDA personal Key always uses your current project permissions, Agent access, and data role. Request fields role_id and role_variables cannot override them. Only the owner can view and revoke a personal Key; project administrators cannot view other users' personal Keys.
System integration Keys can call all project Agents and let a trusted server specify a data role and variables. admin adds project infrastructure management, but neither system Key type can read or modify personal configuration.
Ask a question
First list available Agents:
curl 'https://asktable.example.com/v1/data-agents' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'X-Project-Id: YOUR_PROJECT_ID'Choose an Agent ID from the result, then create a conversation. Success returns HTTP 201 and the conversation id:
curl -X POST 'https://asktable.example.com/v1/conversations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'X-Project-Id: YOUR_PROJECT_ID' \
-H 'Content-Type: application/json' \
-d '{"data_agent_id":"00000000-0000-0000-0000-000000000000"}'Replace the sample ID with a real Agent ID. Data source scope comes from the Agent; creating a conversation does not send a question. Once you have the conversation ID, send a message. HTTP 202 with {"status":"accepted"} means execution was accepted:
curl -X POST 'https://asktable.example.com/v1/conversations/YOUR_CONVERSATION_ID/messages' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'X-Project-Id: YOUR_PROJECT_ID' \
-H 'Content-Type: application/json' \
-d '{"question":"Analyze yesterday’s orders and list the main changes"}'If a system integration needs a specific data identity, add role_id and role_variables to the create conversation request:
{
"data_agent_id": "00000000-0000-0000-0000-000000000000",
"role_id": "role_xxxxxxxx",
"role_variables": { "dept_id": "D001" }
}A system Key without a role applies no role filtering, so first confirm the scope is appropriate for its caller. Personal Keys cannot use these fields to switch identities.
Read the response body
Use the same authentication headers to read GET /v1/conversations/YOUR_CONVERSATION_ID, inspecting status, messages, and error_detail. pending and streaming mean execution is ongoing; HTTP 202 does not mean an answer has been generated. For clarifying, submit an answer using the current instance's clarification endpoint or let the user continue on the web.
Answers are in assistant messages within messages, with text in text blocks of the content array. For live analysis updates, use the SSE endpoint in the instance documentation. Set polling intervals and an overall timeout. For follow-ups, send to /messages on the same conversation without creating another one.
Expand to other resource endpoints as needed
The same /v1 root also provides data sources, Agents, skills, roles, policies, dashboards, canvases, model groups, and other resources. Personal resource ownership and sharing are checked separately from system integration infrastructure permissions. The name admin does not imply management of every personal resource. Use the current Redoc for exact paths and authorization conditions.
Prepare for production
- Use a separate Key for each application or environment, granting only the required capabilities.
- Keep Keys in trusted server-side or controlled Agent client secret settings, never webpages, iframes, or code repositories.
- Set timeouts and retry limits; distinguish authentication failure, permission denial, invalid parameters, unready resources, and execution failure.
- Log project, time, duration, HTTP status, and conversation ID without recording complete sensitive questions and answers.
- Let the trusted server choose system integration
role_idandrole_variables; do not accept arbitrary visitor input for them.
Key constraints
| Item | Value or default | Where to change it |
|---|---|---|
| API root path | /v1 | No UI switch |
| Documentation URLs | <your-site>/v1/redoc, <your-site>/v1/docs | Bottom avatar → “Documentation” → “REST API” |
| Authentication | Authorization: Bearer <API-Key>, with the current project ID | Caller |
| New conversation | Requires an accessible data_agent_id; success is 201 | POST /v1/conversations |
| Send a question | question supports up to 4096 characters; accepted execution is 202 | POST /v1/conversations/<id>/messages |
| Member data scope | Uses the current member's data role and variables; requests cannot override them | Project member management |
| System data scope | A system Key can specify role and variables; no role means no role filtering | Trusted calling service |
| Plaintext Key | Shown only once at creation; an expiry can be set | “Agent integration” |
| Old single-query endpoint | POST /v1/integration/query removed | Migrate to the Agent conversation flow |
Troubleshooting
| Symptom | Identifying condition | Resolution |
|---|---|---|
| HTTP 401 | Key is missing, incorrect, expired, or revoked | Check Bearer format, expiry, and the current Key |
| HTTP 403 | Project role, Agent access, or resource ownership disallows the action | For personal calls, check your current permissions; for system management, check Key type and endpoint authorization |
| Old endpoint returns 404 | Still calling /v1/integration/query | Create a conversation with an Agent, send a message, and read details instead |
| Conversation creation reports a parameter error | Missing data_agent_id or incorrect parameter type | List Agents first, then pass an available real ID in the current project |
| Message accepted but no answer | Response is 202; details remain pending, streaming, or clarifying | Wait, answer clarification, or inspect error_detail; do not repeatedly create conversations |
| History is readable but follow-ups fail | Agent access was revoked, or the legacy conversation has no Agent | Create a conversation with an Agent currently available to you |
| Old history remains after permission changes | Changes apply only to subsequent execution | Check that new queries use the current data role; changing permissions does not clear history |
Next steps
- Let AI clients discover and call these capabilities: MCP
- Operate directly in terminals or scripts: Command-line tool
- Configure tools for a Coze bot: Connect Coze