Forwards API
API reference for creating and managing email forwarding rules in Taifa Mail.
Base URL: https://govconnect.ke/v1
All endpoints require authentication via API Key or JWT cookie. API keys use the tfm_k_ prefix.
Create a forward
Create an email forwarding rule. The domain that owns the source email must be verified and must have an MX record pointing to Taifa Mail so it can receive mail. The rule is synced to Postfix immediately upon creation.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
source_email | string (email) | Yes | The address to forward mail from. Must belong to a verified domain. |
destination_emails | string[] (email) | No | Email addresses to forward mail to. |
destination_urls | string[] (HTTPS URL) | No | HTTPS endpoints to POST the inbound message to. |
domain_id | string (UUID) | Yes | The ID of the verified domain that owns the source email. |
At least one of destination_emails or destination_urls must contain a
value. Both default to empty arrays.
cURL:
Python:
Node.js:
Response (201 Created):
List forwards
Returns all email forwarding rules in your workspace as a JSON array.
cURL:
Python:
Node.js:
Response:
Update a forward
Update an existing forwarding rule. You can change the destinations or
toggle the rule on and off. Changes are synced to Postfix immediately.
A rule must keep at least one destination; an update that empties both
destination lists returns 400.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
destination_emails | string[] (email) | No | New list of destination email addresses. Omit or pass null to leave unchanged. |
destination_urls | string[] (HTTPS URL) | No | New list of destination HTTPS endpoints. Omit or pass null to leave unchanged. |
is_active | boolean | No | Set to false to pause forwarding, true to resume. Omit or pass null to leave unchanged. |
cURL:
Python:
Node.js:
Response:
Delete a forward
Delete a forwarding rule. The rule is removed from Postfix immediately.
cURL:
Python:
Node.js:
Response: 204 No Content
No response body is returned.
List forwarded emails
Returns a paginated list of emails that have been forwarded.
Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
forward_id | string (UUID) | -- | Filter logs by a specific forwarding rule. |
page | integer | 0 | Page number (zero-indexed). |
limit | integer | 20 | Results per page (1-100). |
cURL:
Python:
Node.js:
Response (JSON array):
Count forwarded emails
Returns the total number of forwarded emails, optionally filtered by forwarding rule.
Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
forward_id | string (UUID) | -- | Filter count by a specific forwarding rule. |
cURL:
Response:
Forwarding stats
Returns forwarding statistics for the last 30 days. per_rule is an
object keyed by forwarding rule ID, with the forwarded-email count as the
value.
cURL:
Python:
Node.js:
Response:
Errors
| Status | Cause |
|---|---|
400 Bad Request | Invalid email format or missing required fields. |
401 Unauthorized | Missing or invalid authentication token. |
403 Forbidden | Plan does not support this feature, or domain is not owned by your account. |
404 Not Found | Forward ID or domain ID does not exist. |
409 Conflict | A forwarding rule for this source email already exists. |
422 Unprocessable Entity | Domain is not verified, or request body validation failed. |