Skip to Content

Embeds

Set the allowed domains

Choose which websites may show your Databrain embeds.

PUT
/api/v2/data-app/whitelist-domains

The list is for your whole organization: every data app uses it. PUT replaces the whole list.

curl --request PUT https://api.usedatabrain.com/api/v2/data-app/whitelist-domains \  --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \  --header "Content-Type: application/json" \  --data '{ "domains": ["app.example.com", "*.example.com", "localhost:3000"] }'

To read the list:

curl https://api.usedatabrain.com/api/v2/data-app/whitelist-domains \  --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN"

Auth

A service token. See Authentication.

Authorization

ApiToken
headerAuthorizationBearer <token>

A service token or a data app API token.

Body (PUT)

domainsstring[]required

The allowed domains. [] empties the list.

Each item is one of:

  • A domain, with no http:// or https:// and no port, for example app.example.com. Start with *. for all subdomains: *.example.com.
  • An IPv4 address, with or without a port: 203.0.113.10:8080.
  • localhost, with or without a port: localhost:3000.

Items are saved as you send them.

Response

GET:

{ "data": ["app.example.com", "*.example.com", "localhost:3000"] }

PUT:

{ "data": { "domains": ["app.example.com", "*.example.com", "localhost:3000"] } }

Errors

Statuserror.codeWhy
400INVALID_REQUEST_BODYdomains is missing, or an item is not valid: Invalid domain format. Please enter domain/IP without http:// or https://
500INTERNAL_SERVER_ERRORThe list could not be saved

For errors that every endpoint returns, see Authentication.

Example Request
curl -X PUT 'https://api.usedatabrain.com/api/v2/data-app/whitelist-domains' \  -H 'Content-Type: application/json' \  -d '{  "domains": [    "app.example.com",    "*.example.com",    "localhost:3000"  ]}'
Example Response
{  "data": [    "app.example.com",    "*.example.com",    "localhost:3000"  ]}