> ## Documentation Index
> Fetch the complete documentation index at: https://omni.fireflo.au/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v1/routes

> Add a route: the channels a message is tried on, in order.

Adds a route: the channels a message is tried on, in order, and what counts as done on each. A message names it by `route`. Making it the default unsets the previous default.

<Note>Needs the `routes:write` scope.</Note>

## Body

| Field | Type | Required | Notes |
| :- | :- | :- | :- |
| `name` | string | Yes | Up to 100 characters, unique on the account. |
| `steps` | array | Yes | 1 to 6 steps, tried in order. |
| `default` | boolean | No | Use it for messages that name no route. Default false. |

Each step is `{"channel", "succeed_on", "within"}`: `channel` is `sms`, `whatsapp`, `rcs` or `firetone` (Voice) — the channels your account has; `succeed_on` is `sent`, `delivered` (the default), `read` or `answered` — only what that channel reports (SMS reports delivery, WhatsApp and RCS delivery and reads, Voice whether the call was answered); `within` is how many seconds to wait for it, from 30 to 604800 (default 900). A route has 1 to 6 steps.

Send an `Idempotency-Key` header to make a retry safe: the same key with the same body is answered once, and the first answer repeated (with `Idempotent-Replayed: true`).

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.fireflo.au/v1/routes \
    -H "Authorization: Bearer $OMNI_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: route-whatsapp-then-sms" \
    -d '{
      "name": "whatsapp-then-sms",
      "steps": [
        {
          "channel": "whatsapp",
          "succeed_on": "read",
          "within": 600
        },
        {
          "channel": "sms",
          "succeed_on": "delivered",
          "within": 900
        }
      ],
      "default": true
    }'
  ```

  ```python Python theme={null}
  import os

  import requests

  response = requests.post(
      "https://api.fireflo.au/v1/routes",
      headers={
          "Authorization": f"Bearer {os.environ['OMNI_API_KEY']}",
          "Idempotency-Key": "route-whatsapp-then-sms",
      },
      json={
          "name": "whatsapp-then-sms",
          "steps": [
              {
                  "channel": "whatsapp",
                  "succeed_on": "read",
                  "within": 600,
              },
              {
                  "channel": "sms",
                  "succeed_on": "delivered",
                  "within": 900,
              },
          ],
          "default": True,
      },
  )
  print(response.status_code, response.json())
  ```

  ```javascript Node theme={null}
  const response = await fetch("https://api.fireflo.au/v1/routes", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.OMNI_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": "route-whatsapp-then-sms",
    },
    body: JSON.stringify({
      "name": "whatsapp-then-sms",
      "steps": [
        {
          "channel": "whatsapp",
          "succeed_on": "read",
          "within": 600
        },
        {
          "channel": "sms",
          "succeed_on": "delivered",
          "within": 900
        }
      ],
      "default": true
    }),
  });
  console.log(response.status, await response.json());
  ```
</CodeGroup>

## Response

`201 Created`

```json theme={null}
{
  "id": "b1d6e0a4-2f3c-4a5b-8e9d-7c6f5a4b3e21",
  "name": "whatsapp-then-sms",
  "steps": [
    {
      "channel": "whatsapp",
      "succeed_on": "read",
      "within": 600
    },
    {
      "channel": "sms",
      "succeed_on": "delivered",
      "within": 900
    }
  ],
  "default": true,
  "updated": "2026-10-02T11:40:05.217Z"
}
```

## Errors

Every refusal is `{"error": {"code", "message", "field"}}`; `field` is there when one input is at fault.

| Status | Error code | When |
| :- | :- | :- |
| 400 | `invalid_request` | The name is missing, or a step is wrong (`field` is `name` or `steps`). |
| 409 | `name_taken` | Another route has that name. |
| 400 | `invalid_json` | The body isn't valid JSON. |
| 403 | `scope_missing` | The key doesn't have the `routes:write` scope. |

Any request can also be refused for its key, its account or its rate (`key_required`, `invalid_key`, `account_suspended`, `plan_excludes_api`, `address_not_allowed`, `rate_limited`); see [the overview](/api-reference/overview).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.