Multi-Tenant Configuration

Configure and manage multiple tenants in Mailtura

Mailtura is built from the ground up to support multiple tenants, allowing you to serve multiple clients or projects from a single installation.

What is Multi-Tenancy?

Multi-tenancy in Mailtura allows you to:

  • Isolate email configurations per client
  • Maintain separate email templates for each tenant
  • Track metrics independently per tenant
  • Apply different rate limits and quotas

Creating a Tenant

Via API

Create a new tenant using the API:

curl -X POST https://your-mailtura-instance.com/api/v1/tenants \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "acme-corp",
    "domain": "acme.com",
    "settings": {
      "fromEmail": "noreply@acme.com",
      "fromName": "Acme Corporation"
    }
  }'

Via Configuration File

You can also define tenants in your configuration:

tenants:
  - id: acme-corp
    domain: acme.com
    fromEmail: noreply@acme.com
    fromName: Acme Corporation
    quotas:
      dailyLimit: 10000
      rateLimit: 100

Tenant Isolation

Each tenant has isolated:

  • Templates: Email templates are tenant-specific
  • Tracking: Analytics and metrics are separated
  • Quotas: Rate limits apply per tenant
  • API Keys: Each tenant has unique API credentials

Managing Tenants

List All Tenants

curl https://your-mailtura-instance.com/api/v1/tenants \
  -H "Authorization: Bearer YOUR_API_KEY"

Update a Tenant

curl -X PATCH https://your-mailtura-instance.com/api/v1/tenants/acme-corp \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "settings": {
      "dailyLimit": 20000
    }
  }'

Delete a Tenant

curl -X DELETE https://your-mailtura-instance.com/api/v1/tenants/acme-corp \
  -H "Authorization: Bearer YOUR_API_KEY"

Best Practices

  1. Use meaningful tenant IDs: Choose IDs that clearly identify the client or project
  2. Set appropriate quotas: Protect your infrastructure with sensible rate limits
  3. Isolate credentials: Never share API keys between tenants
  4. Monitor usage: Regularly review tenant metrics to optimize performance

Next Steps