---
title: "Create a route (source is exactly one of form_id / stream_id)"
method: POST
path: "/v1/routes"
tags: ["routes"]
---

# Create a route (source is exactly one of form_id / stream_id)

`POST /v1/routes`

## Request

- Base URL: `https://postbag.dev`
- URL: `https://postbag.dev/v1/routes`
- Auth: HTTP bearer

A route ties one source (a form or a stream) to one destination, with a mode (instant or digest) and optional filter/transform/quality rules.

## Request body

- object
  - `form_id` string
  - `stream_id` string
  - `destination_id` string, required
  - `enabled` boolean
  - `mode` union
    - object
      - `type` 'instant', required
    - object
      - `type` 'digest', required
      - `cron` string, required
      - `timezone` string, required
  - `window` object
    - `from` string, date-time, nullable
    - `until` string, date-time, nullable
  - `quality` object
    - `exclude_spam` boolean
    - `exclude_quarantined` boolean
  - `filter` string
  - `transform` string

## Response `201`

created

- Route
  - `id` string, required
  - `form_id` string, nullable, required
  - `stream_id` string, nullable, required
  - `destination_id` string, required
  - `enabled` boolean, required
  - `mode` object, required
  - `window` object
  - `quality` object
  - `filter` string, nullable
  - `transform` string, nullable
  - `counts` object
  - `created_at` string

## Other responses

- `400`: Error
- `401`: Error
- `403`: Error
- `404`: Not found
- `409`: Error
- `422`: Error

---

[API](https://skmtc.dev/postbag/apis/postbag-api.md) · [All operations](https://skmtc.dev/postbag/apis/postbag-api/llms.txt) · [OpenAPI document](https://skmtc.dev/postbag/apis/postbag-api/revisions/3da976524695?raw)
