EstateHub

Administrator Email Integration API

Base URL: http://localhost:8000/api/v1
Prefix: /admins/platform-settings/integrations
Auth: Administrator JWT required
Headers: Content-Type: application/json

1. Get Email Configuration

Retrieve the saved integration state and sanitized configuration.

GET/admins/platform-settings/integrations/email/

Auth: Required

Headers

HTTP
Authorization: Bearer {{admin_access_token}}
Content-Type: application/json

Success Example

JSON
{
  "success": true,
  "message": "Integration retrieved successfully.",
  "data": {
    "integration": {
      "type": "email",
      "is_enabled": true,
      "configured": true,
      "config": {
        "provider": "smtp",
        "smtp_host": "smtp.example.com",
        "smtp_port": 587,
        "default_from_email": "noreply@example.com",
        "smtp_username": "replace-with-username",
        "smtp_use_tls": true,
        "smtp_use_ssl": false,
        "has_smtp_password": true,
        "has_mailgun_api_key": false,
        "has_sendgrid_api_key": false,
        "has_resend_api_key": false
      },
      "updated_at": "2026-11-24T10:00:00Z"
    }
  }
}

Notes

Sensitive values are returned as has_* flags. configured means encrypted configuration exists; it does not verify provider credentials. A missing integration record is created disabled.

Applicable errors: 401 missing/invalid JWT; 403 administrator access required; 406 unsupported response format.

Unauthorized - HTTP 401

JSON
{
  "success": false,
  "message": "Authentication credentials were not provided.",
  "errors": {}
}

Forbidden - HTTP 403

JSON
{
  "success": false,
  "message": "You do not have permission to perform this action.",
  "errors": {}
}

2. Update Email Configuration

Save provider configuration and optionally enable or disable the integration.

PATCH/admins/platform-settings/integrations/email/

Auth: Required

Headers

HTTP
Authorization: Bearer {{admin_access_token}}
Content-Type: application/json

Request Body

FieldTypeRequirement
is_enabledbooleanOptional; preserves the saved state when omitted.
configobjectOptional; merges the submitted fields with saved configuration.

SMTP

JSON
{
  "is_enabled": true,
  "config": {
    "provider": "smtp",
    "smtp_host": "smtp.example.com",
    "smtp_port": 587,
    "default_from_email": "noreply@example.com",
    "smtp_username": "replace-with-username",
    "smtp_password": "replace-with-password",
    "smtp_use_tls": true,
    "smtp_use_ssl": false
  }
}

Resend

JSON
{
  "is_enabled": true,
  "config": {
    "provider": "resend",
    "resend_api_key": "replace-with-api-key",
    "default_from_email": "noreply@example.com"
  }
}

SendGrid

JSON
{
  "is_enabled": true,
  "config": {
    "provider": "sendgrid",
    "sendgrid_api_key": "replace-with-api-key",
    "default_from_email": "noreply@example.com"
  }
}

Mailgun

JSON
{
  "is_enabled": true,
  "config": {
    "provider": "mailgun",
    "mailgun_api_key": "replace-with-api-key",
    "mailgun_domain": "mg.example.com",
    "default_from_email": "noreply@example.com"
  }
}

Success Example

JSON
{
  "success": true,
  "message": "Integration updated successfully.",
  "data": {
    "integration": {
      "type": "email",
      "is_enabled": true,
      "configured": true,
      "config": {
        "provider": "smtp",
        "smtp_host": "smtp.example.com",
        "smtp_port": 587,
        "default_from_email": "noreply@example.com",
        "smtp_username": "replace-with-username",
        "smtp_use_tls": true,
        "smtp_use_ssl": false,
        "has_smtp_password": true,
        "has_mailgun_api_key": false,
        "has_sendgrid_api_key": false,
        "has_resend_api_key": false
      },
      "updated_at": "2026-11-24T10:00:00Z"
    }
  }
}

Notes

Both is_enabled and config are optional. PATCH merges with saved configuration; omit unchanged secrets to retain them. Required values must exist in the merged configuration when enabled. Saving does not verify provider connectivity. Disable with { "is_enabled": false }; re-enable with { "is_enabled": true } when configuration is complete.

Providers: smtp, resend, sendgrid, mailgun. Send only fields belonging to the selected provider plus shared default_from_email. Use Send Test Email after enabling. It sends to the authenticated administrator's email address.

Required fields when enabled

ProviderRequired fields
smtpsmtp_host, smtp_port, default_from_email
resendresend_api_key, default_from_email
sendgridsendgrid_api_key, default_from_email
mailgunmailgun_api_key, mailgun_domain, default_from_email

The selected provider is also required.

Configuration fields

FieldTypeDetails
providerenumOptional in a partial update
default_from_emailemail stringOptional in a partial update
backendstringMaximum length: 255
smtp_hoststringMaximum length: 255
smtp_portintegerMinimum: 1; Maximum: 65535
smtp_usernamestringMaximum length: 255; blank allowed
smtp_passwordstringMaximum length: 255; blank allowed; write-only
smtp_use_tlsbooleanOptional in a partial update
smtp_use_sslbooleanOptional in a partial update
mailgun_api_keystringMaximum length: 255; blank allowed; write-only
mailgun_domainstringMaximum length: 255
sendgrid_api_keystringMaximum length: 255; blank allowed; write-only
resend_api_keystringMaximum length: 255; blank allowed; write-only

Disable without deleting configuration

JSON
{
  "is_enabled": false
}

Re-enable with complete saved configuration

JSON
{
  "is_enabled": true
}

When enabling SMTP without saved credentials - HTTP 400

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "config": {
      "smtp_host": "This field is required when enabling the integration.",
      "smtp_port": "This field is required when enabling the integration.",
      "default_from_email": "This field is required when enabling the integration."
    }
  }
}

Applicable errors: 400 invalid/missing configuration or malformed JSON; 401 missing/invalid JWT; 403 administrator access required; 406 unsupported response format; 415 unsupported content type.

Unauthorized - HTTP 401

JSON
{
  "success": false,
  "message": "Authentication credentials were not provided.",
  "errors": {}
}

Forbidden - HTTP 403

JSON
{
  "success": false,
  "message": "You do not have permission to perform this action.",
  "errors": {}
}

3. Send Test Email

Send a test email through the enabled email provider to the authenticated administrator.

POST/admins/platform-settings/integrations/email/test-email/

Auth: Required

Headers

HTTP
Authorization: Bearer {{admin_access_token}}
Content-Type: application/json

Request Body

JSON
{}

Success Example

JSON
{
  "success": true,
  "message": "Test email sent successfully.",
  "data": {
    "recipient": "admin@example.com"
  }
}

Notes

Sends a fixed test message to the authenticated administrator's email address. Email integration must be enabled. A custom recipient is not accepted.

Applicable errors: 400 disabled email integration, missing administrator email or malformed JSON; 401; 403; 406; 415. Unhandled provider failures may return 500 without the standard JSON envelope.

Unauthorized - HTTP 401

JSON
{
  "success": false,
  "message": "Authentication credentials were not provided.",
  "errors": {}
}

Forbidden - HTTP 403

JSON
{
  "success": false,
  "message": "You do not have permission to perform this action.",
  "errors": {}
}

Email integration disabled - HTTP 400

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "non_field_errors": [
      "Email integration is disabled."
    ]
  }
}

Administrator email missing - HTTP 400

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "non_field_errors": [
      "The current admin does not have an email address."
    ]
  }
}

Integrations Overview | Product Integration Guide