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. 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. It must be a public address.

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 the host is a private address
400INTERNAL_SERVER_ERRORDatabrain could not sign in to the server. The message says why. Nothing was saved
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  }}