Skip to main content

Data Sources

Read the Overview first for authentication, request conventions, and errors.

A data source stores the connection to an external system: a database, object storage, a message queue, or a notification bot. A data integration task reads from a data source and writes to Databend.

All data source endpoints are v2. Send orgSlug in the body. serviceId selects the source type. Each type has one credentials object. See Service ID and Credentials Objects.

Secrets: list and get responses mask all secret values in serviceArgs. In an update, send ****** back to keep a saved secret, or send a new value. See Credential Masking.

List Data Sources​

POST /api/v2/data-integration/datasources · Read · Member

FieldTypeRequiredDescription
orgSlugstringYesOrganization ID.
pageintegerNoPage number. Default: 1.
perPageintegerNoRows per page. Default: 20.
serviceIdinteger (enum)NoFilter by Service ID.

Request example:

{ "orgSlug": "<organization-id>", "page": 1, "perPage": 20, "serviceId": 2 }

Response example. serviceArgs is a JSON string. Parse it to read the connection settings.

{
"success": true,
"data": {
"total": 1,
"page": 1,
"perPage": 20,
"list": [
{
"id": 12,
"orgId": "1024",
"name": "orders_mysql",
"serviceId": 2,
"serviceArgs": "{\"host\":\"mysql.example.com\",\"port\":3306,\"username\":\"sync\",\"password\":\"******\",\"database\":\"shop\",\"sslMode\":\"require\"}",
"createdAccountId": 7,
"createdAccountName": "Alice",
"createdAccountEmail": "alice@example.com",
"createdAt": "2026-11-01T02:00:00Z",
"updatedAt": "2026-11-01T02:00:00Z"
}
]
}
}

Get a Data Source​

POST /api/v2/data-integration/datasource/{datasourceId}/info · Read · Member

ParameterInTypeRequiredDescription
datasourceIdpathintegerYesData source ID.
orgSlugbodystringYesOrganization ID.

Response: data is one data source object with the same fields as one item of List Data Sources.

{ "success": true, "data": { "id": 12, "name": "orders_mysql", "serviceId": 2, "serviceArgs": "{...}" } }

Test a Data Source Connection​

POST /api/v2/data-integration/datasource/test · Probe · Member

Tests the connection settings without saving them. The body is the same as Create a Data Source, plus one optional field:

FieldTypeRequiredDescription
datasourceIdintegerNoID of a saved data source. Set it to test changed settings before an update: a secret sent as ****** is replaced with the saved value, under the rules in Credential Masking. Without it, ****** is rejected.

Limits: each organization can run about one test every 5 seconds, with a burst of 5. The server returns HTTP 429 when the quota is used up. Wait and try again.

Response on success:

{ "success": true }

Response on a failure. A parameter error returns HTTP 400 with a [CLIENT-5001] message. A connection failure returns HTTP 500. The message contains the reason from the external system.

{ "success": false, "message": "dial tcp 10.0.0.12:3306: i/o timeout" }

Create a Data Source​

POST /api/v2/data-integration/datasource/create · Write · Member

Tests the connection, then saves the data source.

FieldTypeRequiredDescription
orgSlugstringYesOrganization ID.
namestringYesUnique name in the organization. For serviceId 4 (Feishu bot), use only letters, digits, and _.
serviceIdinteger (enum)YesService ID.
One credentials objectobjectYesThe object that matches serviceId. See the table below.
serviceIdCredentials field
1awsCredentials
2mysqlCredentials
3postgresCredentials
4feiShuBot
5awsSqsS3
6tidbCredentials
7kafkaConsumer
8mnsOss

Send exactly one credentials object. The fields of each object are in Credentials Objects.

Request example (MySQL):

{
"orgSlug": "<organization-id>",
"name": "orders_mysql",
"serviceId": 2,
"mysqlCredentials": {
"host": "mysql.example.com",
"port": 3306,
"username": "sync",
"password": "<password>",
"database": "shop",
"sslMode": "require"
}
}

Request example (Kafka):

{
"orgSlug": "<organization-id>",
"name": "events_kafka",
"serviceId": 7,
"kafkaConsumer": {
"brokers": "b-1.kafka.example.com:9096,b-2.kafka.example.com:9096",
"authentication": "SASL/PLAIN",
"tlsEncryption": true,
"saslPlain": { "username": "consumer", "password": "<password>" }
}
}

Response. The ID is at the top level.

{ "success": true, "id": 12 }

Errors: a duplicate name returns HTTP 500 with [SERVER-6000] server err: name orders_mysql exists. A failed connection test returns the same error as Test a Data Source Connection.

Update a Data Source​

POST /api/v2/data-integration/datasource/{datasourceId}/update · Write · Member

Replaces the name and the credentials of a data source.

ParameterInTypeRequiredDescription
datasourceIdpathintegerYesData source ID.
orgSlugbodystringYesOrganization ID.
namebodystringYesName.
serviceIdbodyinteger (enum)YesThe current Service ID of the data source.
One credentials objectbodyobjectYesAll credential fields. For a secret that you keep, send ******. See Credential Masking.

Request example:

{
"orgSlug": "<organization-id>",
"name": "orders_mysql",
"serviceId": 2,
"mysqlCredentials": { "host": "mysql.example.com", "port": 3306, "username": "sync", "password": "<new-password>", "database": "shop", "sslMode": "require" }
}

Response:

{ "success": true }

Delete Data Sources​

POST /api/v2/data-integration/datasource/delete · Write · Member

FieldTypeRequiredDescription
orgSlugstringYesOrganization ID.
datasourceIdsinteger[]YesIDs of the data sources to delete.
{ "orgSlug": "<organization-id>", "datasourceIds": [12, 13] }

Response: { "success": true }. If a task uses one of the data sources, the request fails and the server deletes nothing. Delete or change the task first.

List MySQL Tables​

POST /api/v2/data-integration/datasource/{datasourceId}/mysql/tables · Probe · Member

Connects to the MySQL server of the data source and returns the tables of its default database (mysqlCredentials.database). The data source must have a database. If it has none, the request fails with param [database] required. For a data source without a database, use Preview MySQL Table Rules.

ParameterInTypeRequiredDescription
datasourceIdpathintegerYesID of a MySQL data source (serviceId 2).
orgSlugbodystringYesOrganization ID.

Response. The list is at the top level.

{ "success": true, "tables": ["customers", "orders", "order_items"] }

List PostgreSQL Tables​

POST /api/v2/data-integration/datasource/{datasourceId}/postgres/tables · Probe · Member

Same as List MySQL Tables, for a PostgreSQL data source (serviceId 3). targetTableNames[i] is the suggested Databend table name for tables[i], without the schema prefix.

{ "success": true, "tables": ["public.orders", "public.customers"], "targetTableNames": ["orders", "customers"] }

Preview MySQL Table Rules​

POST /api/v2/data-integration/datasource/{datasourceId}/mysql/preview-objects · Probe · Member

Shows which source tables a table selection matches, and the target names. Call it before you create a rule-based MySQL task.

FieldInTypeRequiredDescription
datasourceIdpathintegerYesID of a MySQL data source.
orgSlugbodystringYesOrganization ID.
tableRulesbodystring[]NoTable rules. Do not use with includeTables or excludeTables.
includeTablesbodystring[]NoTables in the default database to include.
excludeTablesbodystring[]NoTables in the default database to exclude.
limitbodyintegerNoMaximum number of returned pairs. 0 uses the server default.
targetDatabasePrefix, targetDatabaseSuffix, targetTablePrefix, targetTableSuffixbodystringNoName affixes. Letters, digits, and _ only. They change only the target names in the response.

Request example:

{
"orgSlug": "<organization-id>",
"tableRules": ["shop.orders", "shard_*.*", "!*.tmp_*"],
"limit": 100,
"targetDatabasePrefix": "raw_"
}

Response. The fields are at the top level. total counts all matches before limit. unmatchedDatabases lists databases that have tables but no match. maxMatchedTables is the most tables that one task can sync.

{
"success": true,
"objects": [
{ "database": "shop", "table": "orders", "targetDatabase": "raw_shop", "targetTable": "orders" },
{ "database": "shard_01", "table": "events", "targetDatabase": "raw_shard_01", "targetTable": "events" }
],
"total": 2,
"unmatchedDatabases": ["analytics"],
"maxMatchedTables": 5000
}

Preview TiDB Table Rules​

POST /api/v2/data-integration/datasource/{datasourceId}/tidb/preview-objects · Probe · Member

Reads the object storage of a TiDB data source (serviceId 6). Shows which source tables a table selection matches.

FieldInTypeRequiredDescription
datasourceIdpathintegerYesID of a TiDB data source.
orgSlugbodystringYesOrganization ID.
s3PrefixbodystringYesPrefix to read. For CDC, use the changefeed prefix. For a snapshot, use the Dumpling prefix.
sourceKindbodystring (enum)Nochangefeed (default): reads {prefix}/{db}/{table}/. dumpling: reads {db}.{table}-schema.sql files.
tableRules, includeTables, excludeTablesbodystring[]NoTable selection. Same rules as Preview MySQL Table Rules.
limitbodyintegerNoMaximum number of returned pairs. 0 uses the server default.
targetDatabasePrefix, targetDatabaseSuffix, targetTablePrefix, targetTableSuffixbodystringNoName affixes for the target names in the response.

Response: the same top-level fields as Preview MySQL Table Rules, without maxMatchedTables.

Get AWS SQS (S3) Setup Information​

POST /api/v2/data-integration/aws-sqs-s3/setup-info · Read · Member

Returns the values that you need to create the IAM role for an AWS SQS (S3) data source (serviceId 5). Put externalID in the trust policy of the role, and trust each principal with required: true.

FieldTypeRequiredDescription
orgSlugstringYesOrganization ID.
{
"success": true,
"data": {
"externalID": "acme-prod",
"trustPrincipals": [
{ "name": "Databend Cloud", "arn": "arn:aws:iam::123456789012:role/databend-sqs-s3-consumer", "required": true }
]
}
}

Get TiDB Setup Information​

POST /api/v2/data-integration/tidb/setup-info · Read · Member

Returns the same fields as Get AWS SQS (S3) Setup Information. Use them when a TiDB data source reads S3 with roleARN.

Types​

Service ID​

ValueNameSource type
1AwsCredentialsAWS S3, with an access key.
2MysqlCredentialsMySQL.
3PostgresCredentialsPostgreSQL.
4FeiShuBotFeishu or Lark bot, for task failure notifications.
5AwsSqsS3AWS S3 with SQS event notifications, with an IAM role.
6TiDBCDCTiDB, through TiCDC changefeed and Dumpling files in object storage.
7KafkaConsumerKafka.
8MnsOssAlibaba Cloud OSS with MNS event notifications.

Do not use 0. The availability of a type depends on the cloud and region of the organization.

Credentials Objects​

Send one of these objects in Create a Data Source, Update a Data Source, and Test a Data Source Connection.

awsCredentials (serviceId 1)​

FieldTypeRequiredDescription
accessKeystringYesAWS access key ID.
secretKeystringYesAWS secret access key. Secret.

mysqlCredentials (serviceId 2)​

FieldTypeRequiredDescription
hoststringYesHost name or IP address. Databend Cloud must be able to reach it.
portintegerYesPort, for example 3306.
usernamestringYesUser name. The user needs binlog read privileges for CDC.
passwordstringYesPassword. Secret.
databasestringNoDefault database. Required for tasks that use includeTables. Not used by tasks with tableRules.
sslModestring (enum)Nodisable (default), require, verify-ca, or verify-full.
serverIdintegerNoBinlog replica server ID. It must be unique in the organization. If you omit it, create generates one and update keeps the current one.
charsetstringNoConnection character set, for example utf8mb4.

postgresCredentials (serviceId 3)​

FieldTypeRequiredDescription
hoststringYesHost name or IP address.
portintegerYesPort, for example 5432.
usernamestringYesUser name. The user needs logical replication privileges for CDC.
passwordstringYesPassword. Secret.
databasestringYesDatabase name.
sslModestring (enum)Nodisable (default), require, verify-ca, or verify-full.
schemastring[]NoSchemas. Default: ["public"].
slotNamestringNoLogical replication slot. The server makes a name if you omit it.
publicationstringNoPublication. The server makes a name if you omit it.

feiShuBot (serviceId 4)​

FieldTypeRequiredDescription
urlstringYesBot webhook URL. It must be https://open.feishu.cn/open-apis/bot/v2/hook/<token>, or the same path on open.larksuite.com or open.larkoffice.com. Secret.
typeintegerNo1: task error messages.
templatestringNoMessage template.
warehousestringYesWarehouse name that the bot uses.

awsSqsS3 (serviceId 5)​

FieldTypeRequiredDescription
roleARNstringYesARN of the IAM role that Databend Cloud assumes. Create it with Get AWS SQS (S3) Setup Information.
queueURLstringYesSQS queue URL, for example https://sqs.us-east-2.amazonaws.com/123456789012/orders-events. The server reads the region from it.
bucketstringYesS3 bucket.
prefixstringNoLoad only objects with this key prefix.
suffixstringNoLoad only objects with this key suffix, for example .csv.

Do not send externalID or queueRegion. The server sets them.

tidbCredentials (serviceId 6)​

The TiDB data source reads TiCDC changefeed files and Dumpling export files from object storage. The S3 prefixes are set on the task, not on the data source.

FieldTypeRequiredDescription
storageProviderstring (enum)Nos3 or empty (default): AWS S3 or an S3-compatible store. oss: Alibaba Cloud OSS.
s3BucketstringYesBucket name.
s3RegionstringYesRegion, for example us-west-2. For oss, the OSS region, for example cn-hangzhou.
s3AccessKeystringDependsAccess key. Required for oss. For S3, send it with s3SecretKey, or send roleARN.
s3SecretKeystringDependsSecret key. Secret.
roleARNstringDependsIAM role ARN, instead of an access key. Not supported for oss. See Get TiDB Setup Information.
s3EndpointstringNoEndpoint of an S3-compatible store. Must be empty for oss.
sqsQueueURLstringNoSQS standard queue URL for event mode. FIFO queues are rejected. Not supported for oss.
sqsRegionstringNoSQS region. Default: s3Region.
databasestringNoDefault source database. Tasks without tableRules need it.

Do not send externalID, ossInternalEndpoint, or ossLoaderInternalEndpoint. The server sets them.

kafkaConsumer (serviceId 7)​

FieldTypeRequiredDescription
brokersstringYesBroker addresses (host:port), separated by commas.
authenticationstring (enum)NoNONE (default) or SASL/PLAIN.
saslPlainobjectDepends{ "username": "...", "password": "..." }. Required for SASL/PLAIN. password is secret.
tlsEncryptionbooleanNoUse TLS. Default: false.

The data source ignores topics, dataFormat, offsetReset, maxBatchSizeBytes, and maxBatchWaitSeconds. Set them on the task.

mnsOss (serviceId 8)​

FieldTypeRequiredDescription
endpointstringYesPublic HTTPS MNS endpoint of the region, for example https://123456789.mns.cn-hangzhou.aliyuncs.com.
regionstringYesRegion, for example cn-hangzhou.
queueNamestringYesMNS queue that gets the OSS events.
quarantineQueueNamestringYesQueue for messages that fail. It must be different from queueName.
bucketstringYesOSS bucket.
prefixstringNoObject key prefix. Empty, or it must end with /.
suffixstringNoObject key suffix.
accessKeyIdstringYesAccess key ID.
accessKeySecretstringYesAccess key secret. Secret.
securityTokenstringNoSTS token. Secret.

Credential Masking​

All endpoints in this section use one masking rule:

  • The server replaces every secret value with the fixed string ******. The rule is the same for list and get endpoints.
  • A secret is a value that grants access: a password, a secret key, a session token, or a webhook URL that contains a token.
  • Identifiers stay visible: host, port, user name, access key ID, role ARN, bucket, region, and queue. You need them to check the configuration.
  • An empty secret stays empty. A masked secret is always ******, whatever its length. Do not use the mask to guess the length or the value.
  • No structured field in this section returns a secret in clear text.

Masked fields by endpoint:

EndpointObjectMasked fields
List Data Sources, Get a Data SourceserviceArgs of awsCredentialssecretKey
serviceArgs of mysqlCredentials, postgresCredentialspassword
serviceArgs of feiShuBoturl
serviceArgs of tidbCredentialss3SecretKey
serviceArgs of kafkaConsumersaslPlain.password
serviceArgs of mnsOssaccessKeySecret, securityToken

awsSqsS3 data sources use an IAM role and have no secret field.

Rules for sending secrets:

  • Update a Data Source replaces all credential fields. For each secret, send a new value, or send ****** to keep the saved one.
  • The server keeps a saved secret also when you change other fields, for example the host or the port. To replace a secret, send the new value.
  • Test a Data Source Connection follows the same rules when you set datasourceId.
  • Create a Data Source, and a test without datasourceId, reject ****** with HTTP 400.

The masking applies to structured fields only. The server does not mask SQL text in query history, query details, SQL task runs, and task flows. A SQL statement can contain a credential, for example in CREATE STAGE. Treat SQL text as sensitive.