Skip to content
AskTable

Documentation feedback

Current pageREST API/en/integrations/openapi

0 / 5,000

Your feedback will be sent to the maintenance team.

Go to console
Go to console

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 asker for questions or admin for 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:

PurposeURL
API roothttps://asktable.example.com/v1
Interactive documentation (Redoc)https://asktable.example.com/v1/redoc
Swagger UIhttps://asktable.example.com/v1/docs
OpenAPI specificationhttps://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_ID

A 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

  1. Use a separate Key for each application or environment, granting only the required capabilities.
  2. Keep Keys in trusted server-side or controlled Agent client secret settings, never webpages, iframes, or code repositories.
  3. Set timeouts and retry limits; distinguish authentication failure, permission denial, invalid parameters, unready resources, and execution failure.
  4. Log project, time, duration, HTTP status, and conversation ID without recording complete sensitive questions and answers.
  5. Let the trusted server choose system integration role_id and role_variables; do not accept arbitrary visitor input for them.

Key constraints

ItemValue or defaultWhere to change it
API root path/v1No UI switch
Documentation URLs<your-site>/v1/redoc, <your-site>/v1/docsBottom avatar → “Documentation” → “REST API”
AuthenticationAuthorization: Bearer <API-Key>, with the current project IDCaller
New conversationRequires an accessible data_agent_id; success is 201POST /v1/conversations
Send a questionquestion supports up to 4096 characters; accepted execution is 202POST /v1/conversations/<id>/messages
Member data scopeUses the current member's data role and variables; requests cannot override themProject member management
System data scopeA system Key can specify role and variables; no role means no role filteringTrusted calling service
Plaintext KeyShown only once at creation; an expiry can be set“Agent integration”
Old single-query endpointPOST /v1/integration/query removedMigrate to the Agent conversation flow

Troubleshooting

SymptomIdentifying conditionResolution
HTTP 401Key is missing, incorrect, expired, or revokedCheck Bearer format, expiry, and the current Key
HTTP 403Project role, Agent access, or resource ownership disallows the actionFor personal calls, check your current permissions; for system management, check Key type and endpoint authorization
Old endpoint returns 404Still calling /v1/integration/queryCreate a conversation with an Agent, send a message, and read details instead
Conversation creation reports a parameter errorMissing data_agent_id or incorrect parameter typeList Agents first, then pass an available real ID in the current project
Message accepted but no answerResponse is 202; details remain pending, streaming, or clarifyingWait, answer clarification, or inspect error_detail; do not repeatedly create conversations
History is readable but follow-ups failAgent access was revoked, or the legacy conversation has no AgentCreate a conversation with an Agent currently available to you
Old history remains after permission changesChanges apply only to subsequent executionCheck 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