Skip to main content

Databend Cloud API for Agents

These pages list the Databend Cloud console APIs that an account API token can call. Use these APIs to build agents and scripts that manage data sources and data integration tasks, read task flows, query history, warehouses, catalog metadata, and billing, and work with support tickets.

These pages are for people and for AI agents. All endpoints use the same layout: method and path, access level, parameters, and examples. If the endpoints of a page use enums or objects, the page ends with a Types section that describes them.

This API is for Databend Cloud only. It does not apply to self-hosted Databend.

The Changelog lists the changes to these endpoints. Read it when you update an agent, a skill, or a script that calls them.

Before You Start​

You need these values:

ValueWhere to find itExample
API originUse https://api.databend.com for the global site. Use https://api.databend.cn for the China site.https://api.databend.com
API tokenCloud console → Account API Tokens → Access Tokens → Generate New Token.dbc_xxxxxxxxxxxx
Organization IDCloud console → Admin → Organization Profile, or List My Organizations. The API calls this value orgSlug.acme-prod
WarehouseThe warehouse that runs SQL. Only the Query API needs it.default

Authentication​

Send the token in the X-DATABENDCLOUD-TOKEN header on every request.

HeaderRequiredDescription
X-DATABENDCLOUD-TOKENYesThe account API token.
X-DATABENDCLOUD-ORGNoThe Organization ID. If you send it, it must be equal to the organization in the path or in the body. For account endpoints, it selects the organization that the request acts in. Default: the default organization of your account.
X-DATABENDCLOUD-WAREHOUSEQuery API onlyThe warehouse name. Default: default.
Content-TypeRequests with a bodyapplication/json

Rules:

  • Do not send an Authorization header or cookies with the token. The server rejects a request that has two credentials.
  • The token acts as your account. It uses your current role in the organization. A role change applies to the next request.
  • You can access only organizations in which your account is an active member.
  • The token IP allowlist applies to all endpoints in this section.
  • The server rejects endpoints that are not in this section with HTTP 403.

Example request:

curl --request POST 'https://api.databend.com/api/v2/data-integration/datasources' \
--header 'X-DATABENDCLOUD-TOKEN: <api-token>' \
--header 'Content-Type: application/json' \
--data '{"orgSlug":"<organization-id>","page":1,"perPage":20}'

Request Conventions​

The API has two styles:

StylePath prefixOrganization IDParameters
v1/api/v1/...In the path, as {orgSlug}.Path, query string, or JSON body.
v2/api/v2/...In the JSON body, as orgSlug. This field is required.JSON body. All v2 endpoints use POST. Some v2 endpoints also have path parameters.

v2 JSON Rules​

  • Field names use lowerCamelCase.
  • Enums: send the number. The name is also accepted. Responses always return the number.
  • 64-bit integers (int64, uint64) are JSON strings in responses, for example "orgId": "1024". Requests accept a string or a number.
  • Responses omit fields that have a zero value (0, false, "", or an empty list). Treat a missing field as its zero value.
  • Timestamps are RFC 3339 strings in UTC, for example "2026-11-09T08:00:00Z".
  • Do not send unknown fields. The server rejects them with HTTP 400.
  • If a field is a path parameter, do not also send it in the body. The path value has priority.

v1 JSON Rules​

  • Field names are as documented for each endpoint. Some task run responses use snake_case.
  • Timestamps are RFC 3339 strings.

Pagination​

StyleRequest fieldsResponse fieldsUsed by
Page numberpage (starts at 1, default 1), perPage (default 20)total, page, perPage, listMost v2 lists
Cursorsize, cursorstotal, cursors, listQuery history
Page tokennextPageToken, previousPageTokennextPageToken, previousPageTokenTask runs, task flow run history

Use a page size of 100 or less. For page tokens, a missing nextPageToken in the response means that there is no next page. Send page tokens as strings.

Responses and Errors​

A successful response has HTTP 200 and "success": true. Most endpoints put the result in data. Some v2 endpoints put fields at the top level, for example id, tables, or objects. The response example of each endpoint shows the shape.

Credential fields in responses never contain a secret in clear text. The server replaces each secret value with ******. SQL text is not masked. See Credential Masking.

Error shapes:

v1 error
{ "error": "PermissionDenied", "message": "auth: client ip 203.0.113.10 is not in the allowlist of this API token" }
v2 error
{ "success": false, "message": "[CLIENT-5001] param err: check request failed: param [orgSlug, datasourceId, name] required" }

v2 messages start with [<KIND>-<CODE>]. CLIENT-5001 is a parameter error (HTTP 400). SERVER-* and THIRDPARTY-* codes use HTTP 500.

HTTP statusMeaningRetry
400A parameter is missing or not valid.No. Fix the request.
401The token is not valid, is disabled, or was deleted.No.
403The client IP is not in the token allowlist, the account is not an active member, the role is not sufficient, or the endpoint is not open to API tokens.No.
404The resource does not exist.No.
429The request exceeds a rate limit or a quota.Yes, with backoff.
500A server error. Some v2 business errors also use 500, for example [SERVER-6000] server err: name orders_sync exists or [SERVER-6000] server err: datasource 12 not found.Read message first. Retry only if the cause is temporary.
503, 504A dependency is not available, or the request timed out.Yes, with backoff.

Access Levels​

Each endpoint has an access level. The server checks it on every request.

LevelWho can call
SelfThe account that owns the token. The endpoint returns only the data of that account.
MemberAny active member of the organization.
CreatorThe account that created the resource.
Creator or AdminThe account that created the resource, or an organization admin.
ExportA member who has the export permission.

Catalog and warehouse endpoints also apply the SQL privileges of your account. A member can see only the objects that the member's SQL role can see.

Endpoint Index​

Type Read does not change any resource. Type Write creates, changes, starts, stops, or deletes a resource. Type Probe connects to an external system from Databend Cloud.

CategoryMethodPathTypeAccess
Query APIPOST/v1/queryWriteMember
GET/v1/query/{queryId}ReadMember
GET/v1/query/{queryId}/page/{pageNum}ReadMember
GET/v1/query/{queryId}/finalReadMember
POST/v1/query/{queryId}/killWriteMember
Query resultsGET/api/v1/query/orgs/{orgSlug}/worksheet-query-results/{queryId}ReadMember
GET/api/v1/orgs/{orgSlug}/query/{queryId}/downloadReadExport
GET/api/v1/orgs/{orgSlug}/query/{queryId}/download-excelReadExport
Query historyPOST/api/v1/query/orgs/{orgSlug}/query-history/queryReadMember
POST/api/v1/query/orgs/{orgSlug}/query-history/countReadMember
GET/api/v1/query/orgs/{orgSlug}/query-history/{queryId}/detailReadMember
GET/api/v1/query/orgs/{orgSlug}/query-history/{queryId}/profileReadMember
GET/api/v1/query/orgs/{orgSlug}/query-history/sql-usersReadMember
WarehousesGET/api/v1/orgs/{orgSlug}/tenant/warehousesReadMember
GET/api/v1/orgs/{orgSlug}/tenant/warehouses/{warehouseName}ReadMember
GET/api/v1/orgs/{orgSlug}/tenant/warehouses/{warehouseName}/processesReadMember
GET/api/v1/orgs/{orgSlug}/tenant/warehouse-history/{warehouseName}ReadMember
GET/api/v1/orgs/{orgSlug}/warehouse-sizesReadMember
Organization and metricsGET/api/v1/orgs/{orgSlug}/tenantReadMember
GET/api/v1/orgs/{orgSlug}/tenant/metrics/{queryType}ReadMember
CatalogGET/api/v1/orgs/{orgSlug}/tenant/databasesReadMember
GET/api/v1/orgs/{orgSlug}/tenant/databases/{database}/tablesReadMember
GET/api/v1/orgs/{orgSlug}/tenant/databases/{database}/tables/{table}ReadMember
GET/api/v1/orgs/{orgSlug}/tenant/databases/{database}/tables/{table}/fieldsReadMember
GET/api/v1/orgs/{orgSlug}/tenant/databases/{database}/tables/{table}/configReadMember
GET/api/v1/orgs/{orgSlug}/tenant/databases/{database}/streamsReadMember
GET/api/v1/orgs/{orgSlug}/tenant/database-objectsReadMember
SQL tasksGET/api/v1/orgs/{orgSlug}/tenant/tasks/{taskName}ReadMember
POST/api/v1/orgs/{orgSlug}/tenant/tasks-runs/queryReadMember
AccountGET/api/v1/account/infoReadSelf
GET/api/v1/my/orgsReadSelf
GET/api/v1/my/org-membership-requestsReadSelf
OrganizationGET/api/v1/orgs/{orgSlug}ReadMember
GET/api/v1/orgs/{orgSlug}/membersReadMember
BillingGET/api/v1/billing/orgs/{orgSlug}/billing-historiesReadMember
GET/api/v1/billing/orgs/{orgSlug}/billing-histories/{billingHistoryId}ReadMember
GET/api/v1/billing/orgs/{orgSlug}/billing-histories/{billingHistoryId}/details-v2ReadMember
GET/api/v1/orgs/{orgSlug}/daily-usagesReadMember
Support ticketsGET/api/v1/tickets/category-optionsReadSelf
POST/api/v1/orgs/{orgSlug}/tickets/queryReadCreator
GET/api/v1/orgs/{orgSlug}/tickets/{ticketId}ReadCreator
GET/api/v1/orgs/{orgSlug}/tickets/{ticketId}/commentsReadCreator
POST/api/v1/orgs/{orgSlug}/ticketsWriteMember
POST/api/v1/orgs/{orgSlug}/tickets/{ticketId}/commentsWriteCreator
POST/api/v1/orgs/{orgSlug}/tickets/{ticketId}/{status}WriteCreator
CategoryMethodPathTypeAccess
Task flowsPOST/api/v2/taskflowReadMember
POST/api/v2/taskflow/namesReadMember
POST/api/v2/taskflow/dagReadMember
POST/api/v2/taskflow/{taskflowId}/infoReadMember
POST/api/v2/taskflow/versionsReadMember
POST/api/v2/taskflow/versions/{taskflowId}ReadMember
POST/api/v2/taskflow/versions/{taskflowId}/{version}ReadMember
POST/api/v2/taskflow/historiesReadMember
POST/api/v2/taskflow/histories/{taskflowId}ReadMember
Data sourcesPOST/api/v2/data-integration/datasourcesReadMember
POST/api/v2/data-integration/datasource/{datasourceId}/infoReadMember
POST/api/v2/data-integration/datasource/testProbeMember
POST/api/v2/data-integration/datasource/createWriteMember
POST/api/v2/data-integration/datasource/{datasourceId}/updateWriteMember
POST/api/v2/data-integration/datasource/deleteWriteMember
POST/api/v2/data-integration/datasource/{datasourceId}/mysql/tablesProbeMember
POST/api/v2/data-integration/datasource/{datasourceId}/postgres/tablesProbeMember
POST/api/v2/data-integration/datasource/{datasourceId}/mysql/preview-objectsProbeMember
POST/api/v2/data-integration/datasource/{datasourceId}/tidb/preview-objectsProbeMember
POST/api/v2/data-integration/aws-sqs-s3/setup-infoReadMember
POST/api/v2/data-integration/tidb/setup-infoReadMember
Data integration tasksPOST/api/v2/data-integration/tasksReadMember
POST/api/v2/data-integration/task/{taskId}/infoReadMember
POST/api/v2/data-integration/service/previewProbeMember
POST/api/v2/data-integration/runtime-unitsReadMember
POST/api/v2/data-integration/task/createWriteMember
POST/api/v2/data-integration/task/{taskId}/updateWriteCreator or Admin
POST/api/v2/data-integration/task/operateWriteCreator or Admin
POST/api/v2/data-integration/task/runsReadMember
POST/api/v2/data-integration/task/runs/{executeId}ReadMember
POST/api/v2/data-integration/task/runs/{executeId}/mysql/snapshot/tablesReadMember
POST/api/v2/data-integration/task/runs/{executeId}/tidb/full-sync/tablesReadMember
POST/api/v2/data-integration/task/{taskId}/metricsReadMember
GET/api/v1/orgs/{orgSlug}/tenant/metrics/{TiDBSync|MySQLSync}ReadMember

POST /v1/query has type Write because the SQL that you send can change data. See Agent Skills.

Endpoints That API Tokens Cannot Call​

API tokens cannot call other console endpoints. These are some examples:

AreaExamplesReason
AccountSign-in, password, profile changes, sessions, OAuth grants, account deletionThey change the account, not organization data.
CredentialsAPI token management, SQL user password reset, connection information, organization switch, token renewalA leaked token must not be able to create or read credentials.
Members and rolesInvite, accept or reject an invitation, grant, change role, remove memberPrivilege changes.
Billing and paymentPayment methods, payment links, bill confirmation, coupons, spend limits, cloud marketplaceMoney operations.
Audit logsAudit log searchNot open in this version.
Ticket attachmentsUpload, downloadNot open in this version.
AI featuresCloud Agent sessions, skills, and model callsCost and quota.
Warehouse changesCreate, resize, resume, suspend, rename, dropUse warehouse management SQL through the Query API.
Task flow changesCreate, update, start, suspend, deleteNot open in this version.

Security​

  • Every endpoint in this section acts with your account and your current role. Use a dedicated account with a small role for agents.
  • Set a token IP allowlist. Allow the outbound IP of the agent environment.
  • Endpoints with type Probe connect from Databend Cloud to the host that you give. Use only hosts that you own.
  • Responses mask all credentials, as described in Credential Masking. They still show hosts, user names, access key IDs, and bucket names. Query results, SQL text, history, and logs can enter the context of the agent model. Follow your data policy.
  • List Organization Members returns the names and emails of other people, and tickets contain free text. Treat them as personal data.
  • Ticket writes reach the support team. Ask the user to confirm a ticket before an agent creates it.
  • Disable or delete a token in the Cloud console to revoke it at once.
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today