Skip to main content
curl --request PUT \
  --url 'https://api.usedatabrain.com/api/v2/data-app/smtp-settings' \
  --header 'Authorization: Bearer dbn_live_abc123...' \
  --header 'Content-Type: application/json' \
  --data '{
    "host": "smtp.example.com",
    "port": 587,
    "username": "smtp-user",
    "password": "your-password",
    "fromAddress": "noreply@example.com",
    "replyToAddress": "support@example.com",
    "secure": false
  }'
{
  "data": {
    "success": true
  }
}
PUT
https://api.usedatabrain.com
/
api
/
v2
/
data-app
/
smtp-settings
curl --request PUT \
  --url 'https://api.usedatabrain.com/api/v2/data-app/smtp-settings' \
  --header 'Authorization: Bearer dbn_live_abc123...' \
  --header 'Content-Type: application/json' \
  --data '{
    "host": "smtp.example.com",
    "port": 587,
    "username": "smtp-user",
    "password": "your-password",
    "fromAddress": "noreply@example.com",
    "replyToAddress": "support@example.com",
    "secure": false
  }'
{
  "data": {
    "success": true
  }
}
Set or update the SMTP configuration used to send scheduled reports and other emails for your data app. The API validates the connection before saving; if the credentials or server are invalid, the request fails and settings are not stored.
You can also configure email in the UI: Settings → Embed Settings → Email Settings. This API is for automation and integration. See Email Settings for Scheduled Reports for the UI flow.

Endpoint

PUT https://api.usedatabrain.com/api/v2/data-app/smtp-settings

Authentication

All requests must include your data app API key in the Authorization header. See the data app creation guide and the API Token guide.

Headers

Authorization
string
required
Bearer token for API authentication. Use your data app API key.
Authorization: Bearer dbn_live_abc123...
Content-Type
string
required
Must be application/json.

Request Body

host
string
required
SMTP server hostname (e.g. smtp.example.com).
port
number
required
SMTP server port as integer (e.g. 587 for STARTTLS, 465 for implicit SSL).
username
string
required
SMTP authentication username.
password
string
required
SMTP authentication password.
fromAddress
string
required
Sender email address. Must be a valid email format (e.g. noreply@example.com).
replyToAddress
string
required
Reply-to email address. Must be a valid email format.
secure
boolean
required
Whether to use TLS/SSL for the connection. Use true for port 465; use false for port 587 with STARTTLS.

Response

data
object
data.success
boolean
true when settings were saved successfully.

Examples

Error codes

Error CodeHTTP StatusDescription
INVALID_DATA_APP_API_KEY400Missing or invalid data app API key
INVALID_SERVICE_TOKEN400Invalid or expired token; cannot resolve company context
INVALID_REQUEST_BODY400Invalid or missing body fields (e.g. invalid email, missing host)
INTERNAL_SERVER_ERROR400 / 500SMTP connection test failed (400) or unexpected server error (500)