Skip to Content

Datasource APIs

Sync a datasource

Read the datasource schema again so new tables and columns show up in Databrain.

POST
/api/v2/datasource/sync

Run it after you add tables or columns in your warehouse. For most types the call waits until the sync is done. For Amazon S3 it returns at once and you poll the sync status.

curl --request POST https://api.usedatabrain.com/api/v2/datasource/sync \  --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \  --header "Content-Type: application/json" \  --data '{ "input": { "datasourceId": "6f1c2b9e-4d3a-4f8e-9b7c-2a1d0e5f6c7b" } }'

Auth

A service token. See Authentication.

Limits

10 requests in 5 minutes per organization, shared with create, update and schema discovery. A large warehouse can take minutes; set a long HTTP timeout.

Authorization

ApiToken
headerAuthorizationBearer <token>

A service token or a data app API token.

Body

inputobjectrequired

Holds datasourceId.

1 field in input
datasourceIdstringrequired

The datasource id from List datasources. Send it inside input

Format: uuid

Response

The sync is done:

{ "data": { "message": "Sync completed" } }

Amazon S3, the sync started:

{ "message": "AWSS3 sync started..., please check the status on /api/v2/datasource/getDatasourceProgress" }

The sync failed. The status is still 200:

{ "data": { "error": "Schema sync already active" } }

Errors

This endpoint has its own error shape:

{ "data": { "error": { "code": "INVALID_DATASOURCE_ID", "message": "Datasource not found", "status": 404 } } }
StatuscodeWhy
400INVALID_DATASOURCE_IDinput.datasourceId is missing or not a UUID
404INVALID_DATASOURCE_IDNo datasource in your organization has this id
400INVALID_REQUEST_BODYThe sync failed in an unexpected way
429Rate limit

For errors that every endpoint returns, see Authentication.

Example Request
curl -X POST 'https://api.usedatabrain.com/api/v2/datasource/sync' \  -H 'Content-Type: application/json' \  -d '{  "input": {    "datasourceId": "6f1c2b9e-4d3a-4f8e-9b7c-2a1d0e5f6c7b"  }}'
Example Response
{  "data": {    "error": "Schema sync already active"  }}