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

# Dispatch order

> Partner hands an `accepted` or `ready` delivery order to its courier: its status becomes `in_delivery`.

POST`https://api.maple.inc/v1/orders/{orderId}/dispatch`API key

A pickup order answers 409 `illegal_transition` with `details.fulfillment_type`. Maple applies the action before it answers and returns the updated order, as GET /v1/orders/{orderId} does. An order already in the status the action sets is returned unchanged, so a resend is safe. Any other status answers 409 `illegal_transition` with `details.from_status`. If Maple has not finished applying the action within a few seconds it answers 409 `operation_in_progress` with `details.retry_after`: the action still applies; send the same request again. Needs `orders:write` and `orders:read`.

Dispatch order

```sh
curl -X POST "$MAPLE_BASE/orders/ord_123/dispatch" \
  -H "Authorization: Bearer $MAPLE_KEY"
```

```python
import os
import requests


r = requests.post(
    f"{os.environ['MAPLE_BASE']}/orders/ord_123/dispatch",
    headers={"Authorization": f"Bearer {os.environ['MAPLE_KEY']}"},
    timeout=30,
)
r.raise_for_status()
print(r.json())
```

```js
const res = await fetch(`${process.env.MAPLE_BASE}/orders/ord_123/dispatch`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MAPLE_KEY}`,
  },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

```json
{
  "object": "order",
  "id": "string",
  "livemode": true,
  "created": 1,
  "updated": 1,
  "status": "pending",
  "cancellation_reason": "customer",
  "canceled_at": 1,
  "rejection_reason": "validation_failed",
  "location_id": "str_123",
  "fulfillment_type": "pickup",
  "number": "string",
  "source": "phone",
  "notes": "string",
  "ready_by": 1,
  "scheduled_for": 1,
  "delivery_address": {
    "line1": "string",
    "line2": "string",
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country": "string",
    "notes": "string"
  },
  "customer": {
    "name": "string",
    "phone": "+15555550123",
    "phone_last_four": "string"
  },
  "line_items": [
    {
      "name": "string",
      "external_id": "string",
      "quantity": 1.5,
      "base_price_money": {
        "amount": 1,
        "currency": "USD"
      },
      "tax_money": {
        "amount": 1,
        "currency": "USD"
      },
      "notes": "string",
      "modifier_groups": [
        {
          "name": "string",
          "external_id": "string",
          "options": [
            {
              "name": "string",
              "external_id": "string",
              "quantity": 1,
              "price_money": {
                "amount": 1,
                "currency": "USD"
              },
              "modifier_groups": [
                {
                  "name": null,
                  "external_id": null,
                  "options": null
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "totals": {
    "subtotal_money": {
      "amount": 1,
      "currency": "USD"
    },
    "discount_money": {
      "amount": 1,
      "currency": "USD"
    },
    "tax_money": {
      "amount": 1,
      "currency": "USD"
    },
    "surcharge_money": {
      "amount": 1,
      "currency": "USD"
    },
    "service_charge_money": {
      "amount": 1,
      "currency": "USD"
    },
    "tip_money": {
      "amount": 1,
      "currency": "USD"
    },
    "delivery_fee_money": {
      "amount": 1,
      "currency": "USD"
    },
    "delivery_tip_money": {
      "amount": 1,
      "currency": "USD"
    },
    "total_money": {
      "amount": 1,
      "currency": "USD"
    }
  },
  "payment": {
    "method": "online",
    "provider": "string",
    "status": "paid",
    "payment_link_url": "string"
  }
}
```

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_request",
    "message": "string",
    "doc_url": "string",
    "feedback": "string"
  }
}
```

## Authorization

Send your API key as `Authorization: Bearer <key>`: `mpk_test_…` for test mode, `mpk_live_…` for live mode. Both use `https://api.maple.inc/v1`. See [Authentication](https://docs.maple.inc/developer-api/concepts/authentication.md). The samples read the key from `MAPLE_KEY` and the base URL from `MAPLE_BASE`, as set up in the [Quickstart](https://docs.maple.inc/developer-api/quickstart.md).

## Parameters

- `orderId` string path required

- `Idempotency-Key` string header

  Your unique key for this request, such as a UUID. A retry with the same key and the same body within 24 hours returns the first response, with `Idempotent-Replayed: true`, and does not run again. See <https://docs.maple.inc/developer-api/concepts/idempotency> Up to 255 characters.

- `Maple-Version` string header

  The API version your code expects. A version Maple does not serve answers 400 `invalid_request` with `param` `Maple-Version`. See <https://docs.maple.inc/developer-api/concepts/versioning> Always `2026-11-27`.

## Responses

### 200 OK

Order

- `object` string required

  Always `order`.

- `id` string required

- `livemode` boolean required

  True when the order belongs to the live environment; false for test-mode data.

- `created` integer required

- `updated` integer required

  When the order last changed (Unix seconds), including its payment and delivery. Of two copies of one order, from webhooks that arrived out of order, the one with the larger `updated` is newer; on a tie, read it again with `GET /v1/orders/{orderId}`.

- `status` string required

  One of `pending`, `submitted`, `accepted`, `ready`, `in_delivery`, `fulfilled`, `rejected`, `canceled`.

- `cancellation_reason` string or null required

  Who canceled the order (`customer` or `restaurant`) when `status` is `canceled`; null otherwise.

- `canceled_at` integer or null required

  When the order was canceled (Unix seconds); null unless `status` is `canceled`, and null for orders canceled before 2026-11-24.

- `rejection_reason` string or null required

  Why the order is `rejected`: `validation_failed` (your app answered its validation `invalid`, or did not answer), `submission_failed` (Maple could not hand the order to your app), `denied` (your app denied it), `decision_timeout` (no decision arrived in time) or `expired` (the order was too old to make by the time Maple could send it). Null otherwise, and null for orders rejected before 2026-11-24.

- `location_id` string required

  The location the order belongs to.

- `fulfillment_type` string required

  `pickup` (the customer collects the order) or `delivery`. One of `pickup`, `delivery`.

- `number` string or null required

  The short order number Maple gave the customer, the one they say at the counter (e.g. `1274`). Not unique across locations or over time; use `id` to identify the order.

- `source` string or null required

  Where the customer placed the order: `phone` (Maple’s phone agent), `web` (the restaurant’s Maple ordering website), `kiosk`, or `pos`. Null for orders Maple did not classify.

- `notes` string or null required

  What the customer asked for on the whole order (special instructions); null when nothing. Item requests are on each line item’s `notes`, delivery instructions on `delivery_address.notes`.

- `ready_by` integer required

  When the order is due (Unix seconds): `scheduled_for` for a scheduled order, otherwise the time Maple gave the customer, the order time plus the prep time.

- `scheduled_for` integer or null required

  Customer-selected completion time (Unix seconds) for scheduled orders; null for ASAP orders. Prepare the order for this time, not on receipt.

- `delivery_address` object or null required

  The delivery address for delivery orders, including delivery instructions; null for pickup orders or when no stored address is available.

- `delivery_address.line1` string or null required

- `delivery_address.line2` string or null required

- `delivery_address.city` string or null required

- `delivery_address.state` string or null required

- `delivery_address.postal_code` string or null required

- `delivery_address.country` string or null required

- `delivery_address.notes` string or null required

- `customer` object required

- `customer.name` string required

- `customer.phone` string or null required

  Customer phone number in E.164 format (e.g. +14155552671); null when the customer provided none.

- `customer.phone_last_four` string or null required

  Last four digits of the customer phone number.

- `line_items` object\[] required

- `line_items[].name` string required

- `line_items[].external_id` string or null required

- `line_items[].quantity` number required

- `line_items[].base_price_money` object required

- `line_items[].base_price_money.amount` integer required

- `line_items[].base_price_money.currency` string required

- `line_items[].tax_money` object required

- `line_items[].tax_money.amount` integer required

- `line_items[].tax_money.currency` string required

- `line_items[].notes` string or null required

- `line_items[].modifier_groups` object\[] required

- `line_items[].modifier_groups[].name` string required

- `line_items[].modifier_groups[].external_id` string or null required

- `line_items[].modifier_groups[].options` object\[] required

- `line_items[].modifier_groups[].options[].name` string required

- `line_items[].modifier_groups[].options[].external_id` string or null required

- `line_items[].modifier_groups[].options[].quantity` integer required

- `line_items[].modifier_groups[].options[].price_money` object required

- `line_items[].modifier_groups[].options[].price_money.amount` integer required

- `line_items[].modifier_groups[].options[].price_money.currency` string required

- `line_items[].modifier_groups[].options[].modifier_groups` object\[] required

- `line_items[].modifier_groups[].options[].modifier_groups[].name` string required

- `line_items[].modifier_groups[].options[].modifier_groups[].external_id` string or null required

- `line_items[].modifier_groups[].options[].modifier_groups[].options` object\[] required

- `line_items[].modifier_groups[].options[].modifier_groups[].options[].name` string required

- `line_items[].modifier_groups[].options[].modifier_groups[].options[].external_id` string or null required

- `line_items[].modifier_groups[].options[].modifier_groups[].options[].quantity` integer required

- `line_items[].modifier_groups[].options[].modifier_groups[].options[].price_money` object required

- `line_items[].modifier_groups[].options[].modifier_groups[].options[].modifier_groups` object\[] required

- `totals` object required

  Each amount is `{ amount, currency }`: `amount` in integer minor units (cents for `USD`). `subtotal_money` is the line items and their modifiers before discounts; `discount_money` is what discounts took off them; `tax_money` is the tax charged, after discounts; `surcharge_money` is Maple’s processing fee passed to the customer; `service_charge_money` is the restaurant’s own fees its POS adds to the check; `tip_money` is the tip for the restaurant. Two POS systems file the restaurant’s fees elsewhere: Toast counts its non-gratuity service charges in `subtotal_money`, and Chowbus fees are in `surcharge_money`. `total_money` is what the customer pays: the amount charged online, or for an `in_store` order the amount the restaurant should collect (Maple does not see what it took). It is subtotal - discount + tax + surcharge + service charge + tip + delivery fee + delivery tip.

- `totals.subtotal_money` object required

- `totals.subtotal_money.amount` integer required

- `totals.subtotal_money.currency` string required

- `totals.discount_money` object required

- `totals.discount_money.amount` integer required

- `totals.discount_money.currency` string required

- `totals.tax_money` object required

- `totals.tax_money.amount` integer required

- `totals.tax_money.currency` string required

- `totals.surcharge_money` object required

- `totals.surcharge_money.amount` integer required

- `totals.surcharge_money.currency` string required

- `totals.service_charge_money` object required

- `totals.service_charge_money.amount` integer required

- `totals.service_charge_money.currency` string required

- `totals.tip_money` object required

- `totals.tip_money.amount` integer required

- `totals.tip_money.currency` string required

- `totals.delivery_fee_money` object required

- `totals.delivery_fee_money.amount` integer required

- `totals.delivery_fee_money.currency` string required

- `totals.delivery_tip_money` object required

- `totals.delivery_tip_money.amount` integer required

- `totals.delivery_tip_money.currency` string required

- `totals.total_money` object required

- `totals.total_money.amount` integer required

- `totals.total_money.currency` string required

- `payment` object required

  How the customer pays. `method`: `online` (through a payment link or the ordering website) or `in_store` (at the restaurant, at pickup or delivery); null only when Maple recorded none. `provider`: the payment processor, null before a payment exists. `payment_link_url`: the link Maple sent the customer; null for `in_store` orders or before a link exists.

- `payment.method` string or null required

- `payment.provider` string or null required

- `payment.status` string or null required

  Where the customer’s payment stands: `pending` (not paid yet; an `in_store` order stays `pending` until your app marks it paid with `POST /v1/orders/{orderId}/pay`), `paid`, `failed` (the payment did not go through), `voided` (Maple canceled the payment before it settled), `refunded` or `partially_refunded`. Null only when Maple recorded none.

- `payment.payment_link_url` string or null required

### Errors

- `400` Bad request Invalid request (`invalid_request_error`), or `idempotency_error` for `idempotency_key_mismatch`

- `401` Unauthorized Missing or invalid credential (`authentication_error`)

- `403` Forbidden Not allowed (`permission_error`)

- `404` Not found Not found (`invalid_request_error`)

- `409` Conflict Conflicts with current state (`invalid_request_error`), or `idempotency_error` for `idempotency_key_in_use`

- `429` Too many requests Rate limit reached (`rate_limit_error`)

- `500` Server error Maple could not complete the request (`api_error`)

Every error body is one `error` object: branch on its `type` and `code`; `message` is for people, `param` names the field at fault, and `doc_url` links the code on [Errors](https://docs.maple.inc/developer-api/concepts/errors.md).

A `429` also sends `Retry-After`: Seconds to wait before retrying; also returned as error.retry\_after in the body.
