Skip to Content

Embeds

Set the SMTP server

Send scheduled email reports from your own mail server.

PUT
/api/v2/data-app/smtp-settings

The setting is for your whole organization. Databrain signs in to the server first and saves the settings only if that works.

curl --request PUT https://api.usedatabrain.com/api/v2/data-app/smtp-settings \  --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \  --header "Content-Type: application/json" \  --data '{    "host": "smtp.example.com",    "port": 587,    "secure": true,    "username": "reports@example.com",    "password": "<password>",    "fromAddress": "reports@example.com",    "replyToAddress": "support@example.com"  }'

Auth

A service token. A data app API token can get 403 AUTHENTICATION_ERROR. See Authentication.

Authorization

ApiToken
headerAuthorizationBearer <token>

A service token or a data app API token.

Body

All fields are required. Unknown fields are refused.

hoststringrequired

The SMTP server. Use a public address. Databrain can refuse a private, loopback, link-local or metadata address, or a host name it cannot look up.

portintegerrequired

The port, for example 587 or 465

securebooleanrequired

Use TLS. See below.

usernamestringrequired

SMTP user.

passwordstringrequired

SMTP password.

fromAddressstringrequired

The sender email address.

Format: email
replyToAddressstringrequired

The reply-to email address.

Format: email
Portsecure: truesecure: false
465TLS from the startTLS from the start
25, 587, 2525STARTTLS, requiredTLS only if the server offers it
OtherTLS from the startTLS only if the server offers it

The connection test waits up to 20 seconds.

Response

{ "data": { "success": true } }

Errors

Statuserror.codeWhy
400INVALID_REQUEST_BODYA field is missing or wrong, for example "fromAddress" must be a valid email. Or Databrain refused the host
400INTERNAL_SERVER_ERRORDatabrain could not sign in to the server. The message says why. Nothing was saved
403AUTHENTICATION_ERRORYou used a data app API token. Use a service token
500INTERNAL_SERVER_ERRORThe settings 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/smtp-settings' \  -H 'Content-Type: application/json' \  -d '{  "host": "smtp.example.com",  "port": 587,  "secure": true,  "username": "reports@example.com",  "password": "<password>",  "fromAddress": "reports@example.com",  "replyToAddress": "support@example.com"}'
Example Response
{  "data": {    "success": true  }}