Embeds
Set the SMTP server
Send scheduled email reports from your own mail server.
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.
ApiTokenAuthorizationBearer <token>A service token or a data app API token.
Body
All fields are required. Unknown fields are refused.
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.
The port, for example 587 or 465
Use TLS. See below.
SMTP user.
SMTP password.
| Port | secure: true | secure: false |
|---|---|---|
| 465 | TLS from the start | TLS from the start |
| 25, 587, 2525 | STARTTLS, required | TLS only if the server offers it |
| Other | TLS from the start | TLS only if the server offers it |
The connection test waits up to 20 seconds.
Response
{ "data": { "success": true } }Errors
| Status | error.code | Why |
|---|---|---|
| 400 | INVALID_REQUEST_BODY | A field is missing or wrong, for example "fromAddress" must be a valid email. Or Databrain refused the host |
| 400 | INTERNAL_SERVER_ERROR | Databrain could not sign in to the server. The message says why. Nothing was saved |
| 403 | AUTHENTICATION_ERROR | You used a data app API token. Use a service token |
| 500 | INTERNAL_SERVER_ERROR | The settings could not be saved |
For errors that every endpoint returns, see Authentication.
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"}'{ "data": { "success": true }}