Skip to content

cURL Examples

Set your API key once:

Terminal window
export EMBOUX_KEY="your-api-key-here"
export EMBOUX_URL="https://api.emboux.com"
Terminal window
# Create
curl -X POST "$EMBOUX_URL/domains/" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "example.com"}'
# List
curl "$EMBOUX_URL/domains/" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Delete
curl -X DELETE "$EMBOUX_URL/domains/example.com" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Suspend
curl -X PUT "$EMBOUX_URL/domains/example.com/suspend" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Activate
curl -X PUT "$EMBOUX_URL/domains/example.com/activate" \
-H "Authorization: Bearer $EMBOUX_KEY"
Terminal window
# Create
curl -X POST "$EMBOUX_URL/users/" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"domain_name": "example.com", "email": "user@example.com", "password": "pass123"}'
# List (all)
curl "$EMBOUX_URL/users/" \
-H "Authorization: Bearer $EMBOUX_KEY"
# List (by domain)
curl "$EMBOUX_URL/users/?domain_id=1" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Change password
curl -X PUT "$EMBOUX_URL/users/user@example.com" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"password": "new-pass-456"}'
# Delete
curl -X DELETE "$EMBOUX_URL/users/user@example.com" \
-H "Authorization: Bearer $EMBOUX_KEY"
Terminal window
# Create alias
curl -X POST "$EMBOUX_URL/aliases/" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"domain_name": "example.com", "source": "info@example.com", "destination": "user@example.com"}'
# Create catch-all
curl -X POST "$EMBOUX_URL/aliases/" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"domain_name": "example.com", "source": "@example.com", "destination": "user@example.com"}'
# List
curl "$EMBOUX_URL/aliases/?domain_id=1" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Delete
curl -X DELETE "$EMBOUX_URL/aliases/info@example.com" \
-H "Authorization: Bearer $EMBOUX_KEY"
Terminal window
# Get mailbox quota
curl "$EMBOUX_URL/users/user@example.com/quota" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Set mailbox quota (2 GB)
curl -X PUT "$EMBOUX_URL/users/user@example.com/quota" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"quota_mb": 2048}'
# Get retention policy
curl "$EMBOUX_URL/domains/example.com/retention" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Set retention (90 days)
curl -X PUT "$EMBOUX_URL/domains/example.com/retention" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"retention_days": 90}'
# Get transfer limit
curl "$EMBOUX_URL/domains/example.com/transfer" \
-H "Authorization: Bearer $EMBOUX_KEY"
# Set transfer limit (10 GB)
curl -X PUT "$EMBOUX_URL/domains/example.com/transfer" \
-H "Authorization: Bearer $EMBOUX_KEY" \
-H "Content-Type: application/json" \
-d '{"transfer_monthly_mb": 10240}'
Terminal window
curl "$EMBOUX_URL/health" \
-H "Authorization: Bearer $EMBOUX_KEY"
{"status": "ok", "db_connected": true}