Mail API reference

Mail API · Inbound-Routes

post/v1/workspaces/{workspace_id}/inbound-routesAuth

Create an inbound route

A route on one address of a receive domain (`local_part`), or the domain catch-all (`local_part: "*"`, every address without a route or mailbox). Precedence: the address route, then the address's mailbox or alias (stored as before), then the catch-all. Rules run in order; the first that matches runs (`stop: false` goes on to the next match). Forwards are re-sent from the route address with Reply-To set to the sender, never with the sender's From (that would fail DMARC), to confirmed destinations only, at most 60 per hour and 500 per day per route. Forward and webhook actions skip spam unless the rule says `spam: any`.

Path parameters

workspace_id*string · uuid

Id of the workspace.

Headers

Idempotency-Keystring

Opaque client-generated string (1–256 chars, `[A-Za-z0-9._:-]`) used to deduplicate retries within a 24h window. A retry with the same key and body returns the original response with `Idempotent-Replay: true`.

Request body

domain_id*string · uuid

A domain of this workspace that receives mail (`intent` `receive` or `both`).

local_part*string

The address's local part (`support` for support@your-domain), or `*` for the domain catch-all, which takes every address that has no route and no mailbox.

Example: "support"

enabledboolean

Switch the route off without deleting it.

store_mailbox_idstring · uuid

The mailbox accepted mail is stored in (any mailbox of this workspace). Required unless every rule drops. Omit to use the address's own mailbox.

rules*array

Rules in order, at most 20. The first matching rule runs.

Response · 201

id*string · uuid

Route id.

domain_id*string · uuid

The receive domain.

address*string

The address the route is on; `*@domain` for the catch-all.

Example: "support@in.acme.com"

local_part*string

Local part, or `*`.

Example: "support"

catch_all*boolean

True for the domain catch-all.

enabled*boolean

Whether the route is on.

store_mailbox_id*string · uuid

Where accepted mail is stored.

rules*array

The rules, in the order they are checked.

created_at*string · date-time

When the route was created.

updated_at*string · date-time

When the route last changed.

Example

Request

POST https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/inbound-routes
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "domain_id": "00000000-0000-0000-0000-000000000000",
  "local_part": "support",
  "enabled": false,
  "store_mailbox_id": "00000000-0000-0000-0000-000000000000",
  "rules": [
    {
      "name": "Invoices to accounting",
      "conditions": {},
      "actions": [
        {
          "type": "forward",
          "keep": false,
          "to": [
            null
          ],
          "attach_original": false,
          "endpoint_id": "00000000-0000-0000-0000-000000000000"
        }
      ],
      "stop": false
    }
  ]
}

Response

{
  "id": "00000000-0000-0000-0000-000000000000",
  "domain_id": "00000000-0000-0000-0000-000000000000",
  "address": "support@in.acme.com",
  "local_part": "support",
  "catch_all": false,
  "enabled": false,
  "store_mailbox_id": "00000000-0000-0000-0000-000000000000",
  "rules": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "position": 0,
      "name": "string",
      "conditions": {},
      "actions": [
        {
          "type": "forward",
          "keep": false,
          "to": [
            null
          ],
          "attach_original": false,
          "endpoint_id": "00000000-0000-0000-0000-000000000000"
        }
      ],
      "stop": false
    }
  ],
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}