> ## 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.

# Publish your catalog

> Send a location’s full catalog as one JSON document keyed by your own stable IDs, then read it back. Publishing is a diff, so re-publishing is safe.

A catalog is the menu you publish for a location: what customers can order. You publish it as **one JSON document** that describes the whole menu — menus, categories, items, variations, modifiers, and the tax rates and discounts that apply. Maple keys everything off the **external IDs you assign**: an order line item or modifier carries the `external_id` you published for that catalog object.

Publishing requires the `catalog:write` scope and an **active connection** to the location. Reading needs only the `catalog:read` scope and a grant for the location. See [How Maple works](https://docs.maple.inc/developer-api/how-maple-works.md) for connections. Connecting makes your app the location’s order receiver, so the restaurant must also have approved `orders:read` for your app: without that approval, `POST /v1/locations/{locationId}/connection` answers `403` with code `insufficient_scope`.

## The shape of a catalog

A catalog has three top-level lists, `menus`, `categories` and `items`, that point at each other by `external_id`, with shared definitions alongside:

```
catalog
├── menus[]               (required: at least one — the hours live here)
│   └── category_ids[]    (ordered, by category external_id)
├── categories[]          (required)
│   └── item_ids[]        (ordered, by item external_id)
├── items[]               (required)
│   └── variations[]      (required: at least one — the price lives here)
│       └── modifier_groups[]   (inline, or a reference to a shared group)
├── modifier_groups[]      (shared definitions, referenced by group_id)
├── tax_rates[]
└── discounts[] / promotions[]
```

Two rules carry most of the model:

- **Every object has an `external_id`** — your stable handle for it. You choose these; Maple never changes them. Re-publishing with the same `external_id` updates the same object. The response also mints Maple IDs (`menu_…`, `ctg_…`, `item_…`, `var_…`) for reference, but you address objects by your `external_id`. Every `*_id` and `*_ids` field in the body holds an `external_id`, never a Maple ID.
- **The price lives on the variation.** Even a simple item has at least one variation (call it “Regular”). All prices are **integer minor units** — `450` is $4.50.

## A minimal catalog

The smallest valid document is a currency, one menu, one category in that menu, and one item in that category with one variation:

```bash
curl -X POST $MAPLE_BASE/locations/{locationId}/catalog \
  -H "Authorization: Bearer $MAPLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "currency": "USD",
    "menus": [
      { "external_id": "menu-all-day", "name": "All day", "category_ids": ["cat-drinks"] }
    ],
    "categories": [
      { "external_id": "cat-drinks", "name": "Drinks", "item_ids": ["itm-latte"] }
    ],
    "items": [
      {
        "external_id": "itm-latte",
        "name": "Latte",
        "variations": [
          { "external_id": "var-latte-reg", "name": "Regular", "price": { "money": { "amount": 450, "currency": "USD" } } }
        ]
      }
    ]
  }'
```

A menu with no `availability` is always open. A successful publish returns the resulting catalog, the same body `GET` returns. See [Read it back](#read-it-back). Every key in a catalog body is snake\_case, in requests and responses.

## Menus, hours and prices

Hours go on menus, and only on menus. Here Lunch and Dinner share the Mains category, and the burger costs more at dinner. Lunch runs 11:00 to 15:00 (the example shows two days). Dinner runs on Friday and Saturday evenings, and Saturday’s window ends at 01:00 on Sunday. Summer Specials is switched off:

```json
{
  "currency": "USD",
  "menus": [
    {
      "external_id": "lunch",
      "name": "Lunch",
      "category_ids": ["lunch-specials", "mains"],
      "availability": {
        "windows": [
          { "day_of_week": "monday", "start_time": "11:00", "end_time": "15:00" },
          { "day_of_week": "tuesday", "start_time": "11:00", "end_time": "15:00" }
        ]
      }
    },
    {
      "external_id": "dinner",
      "name": "Dinner",
      "category_ids": ["mains"],
      "availability": {
        "windows": [
          { "day_of_week": "friday", "start_time": "17:00", "end_time": "23:00" },
          { "day_of_week": "saturday", "start_time": "17:00", "end_time": "01:00" }
        ]
      }
    },
    { "external_id": "summer", "name": "Summer Specials", "active": false, "category_ids": ["summer"] }
  ],
  "categories": [
    { "external_id": "lunch-specials", "name": "Lunch Specials", "item_ids": ["soup"] },
    { "external_id": "mains", "name": "Mains", "item_ids": ["burger"] },
    { "external_id": "summer", "name": "Summer", "item_ids": ["gazpacho"] }
  ],
  "items": [
    {
      "external_id": "burger",
      "name": "Burger",
      "variations": [
        {
          "external_id": "burger-regular",
          "name": "Regular",
          "price": {
            "money": { "amount": 1300, "currency": "USD" },
            "overrides": [{ "menu_id": "dinner", "money": { "amount": 1600, "currency": "USD" } }]
          }
        }
      ]
    },
    {
      "external_id": "soup",
      "name": "Soup of the Day",
      "variations": [{ "external_id": "soup-bowl", "name": "Bowl", "price": { "money": { "amount": 700, "currency": "USD" } } }]
    },
    {
      "external_id": "gazpacho",
      "name": "Gazpacho",
      "variations": [{ "external_id": "gazpacho-cup", "name": "Cup", "price": { "money": { "amount": 600, "currency": "USD" } } }]
    }
  ]
}
```

- A menu’s `active` defaults to `true`. `active: false` switches it off without deleting its categories and items.
- `day_of_week` is a day name, `monday` to `sunday`. A window is half-open, `[start_time, end_time)`. `24:00` is allowed as an end. An end before the start (Saturday 17:00 to 01:00) runs past midnight.
- Hours read in the location’s own `timezone`, shown on `GET /v1/locations/{id}`. The catalog has no `timezone` field.
- The burger sits in Mains, and Mains sits in both Lunch and Dinner. Its price is $13.00, and $16.00 on Dinner. Lunch and Dinner are never open at the same time, so the two prices pass. If they did overlap, publish would be refused with `menu_price_overlap`.
- A category can sit in several menus, and an item in several categories. It stays one object with one stock status.

See [The catalog model](https://docs.maple.inc/developer-api/concepts/the-catalog-model.md#menus-and-hours) for every rule, and the [recipes](https://docs.maple.inc/developer-api/guides/catalog-recipes.md) for a late-night menu and a seasonal switch.

## Add shared modifiers

Define a modifier group once at the top level and reference it by `group_id` wherever it applies — so “Milk options” stays in one place across every drink:

```json
{
  "currency": "USD",
  "modifier_groups": [
    {
      "external_id": "grp-milk",
      "name": "Milk",
      "min_selections": 0,
      "max_selections": 1,
      "options": [
        { "external_id": "mod-whole", "name": "Whole milk" },
        { "external_id": "mod-oat", "name": "Oat milk", "price": { "money": { "amount": 75, "currency": "USD" } } }
      ]
    }
  ],
  "menus": [{ "external_id": "menu-all-day", "name": "All day", "category_ids": ["cat-drinks"] }],
  "categories": [{ "external_id": "cat-drinks", "name": "Drinks", "item_ids": ["itm-latte"] }],
  "items": [
    {
      "external_id": "itm-latte",
      "name": "Latte",
      "variations": [{ "external_id": "var-latte-reg", "name": "Regular", "price": { "money": { "amount": 450, "currency": "USD" } } }],
      "modifier_groups": [{ "group_id": "grp-milk" }]
    }
  ]
}
```

A modifier group entry is either an **inline definition** (carries `name` and `options`) or a **reference** (`{ "group_id": "grp-milk" }`). Don’t mix the two shapes in one entry — a payload that does is rejected rather than silently truncated. Items, variations, and individual options can each carry modifier groups, which lets you nest options where the menu calls for it.

> [!TIP]
>
> Tax rates, discounts and promotions are optional top-level collections, each addressed by its own `external_id`. Items attach tax rates with `tax_rate_ids`; a promotion names its discount with `discount_id`. Maple has no fees or coupons: see [What Maple refuses](https://docs.maple.inc/developer-api/concepts/the-catalog-model.md#what-maple-refuses). The [endpoint reference](https://docs.maple.inc/developer-api/api-reference.md) documents every field.

## Publishing semantics

Every publish sends the **entire catalog** as its desired state. Maple diffs it against the current catalog (keyed by `external_id`) and applies the result as a new version. A few rules follow from that:

- **The document is the whole catalog.** Whatever you send becomes the catalog. An object you published before but leave out of a later publish is **removed** — to keep something, include it every time.
- **`stock_status` is the exception.** It’s a field-level value: leaving it off an object you *do* include preserves that object’s current stock (new objects default to `in_stock`). So 86-ing an item is still a complete publish that includes every object — you just set one field.
- **Identity is your `external_id`.** The same `external_id` updates the same object across publishes; a new one creates a new object. Use IDs that are stable in your system (a SKU or primary key), not display names.
- **Order inside a list is preserved.** The order of `category_ids`, `item_ids`, variations, options and modifier group placements is the order you send, and the order guests see. The top-level `menus`, `categories`, `items`, `modifier_groups`, `tax_rates`, `discounts` and `promotions` lists are not kept in sent order: `GET` returns each sorted by `external_id`.
- **Validation is all-or-nothing.** If anything is invalid you get a `400` listing every issue, with the first field in `error.param`, and the catalog is left exactly as it was. Fix them all and re-send. See [Refusals](#refusals).
- **Maple stores only what it charges.** A field Maple would not use is refused with a `400`, not dropped, so what you read back is what you sent, plus Maple’s ids and `stock_status`. A field you set to its default (`method: "percentage"`, `base: "price"`, `inclusion: "exclusive"`, `price_type: "fixed"`) comes back left out. See [What Maple refuses](https://docs.maple.inc/developer-api/concepts/the-catalog-model.md#what-maple-refuses).
- **Identical re-publishes are no-ops.** Sending the same document changes nothing and creates no churn, so you can safely publish on every catalog change.
- **Each change is versioned.** A content change cuts a new version; the location always serves the current one.

Because the document is the full desired state, the simplest integration re-publishes the entire catalog whenever your source changes. You never compute diffs — Maple does.

### Refusals

A refused publish answers `400` with code `invalid_catalog`. Its message lists every issue, and each menu issue starts with a code in brackets. A publish is refused when:

- `menus` is empty (`[menus_required]`). A body with no `menus` key fails the body decode instead: `invalid_request` with `param: "menus"`.
- Two menus hold one variation, are open at the same time, and give it different prices (`[menu_price_overlap]`). Overlap uses `[start, end)`, so Lunch to 15:00 and Dinner from 15:00 do not collide. A menu with no hours overlaps every menu.
- A category sits in no menu (`[orphan_category]`), or an item sits in no category (`[orphan_item]`).
- An `availability` has an empty `windows` list (`[empty_windows]`), or a window whose `start_time` equals its `end_time` (`[empty_window]`). A day that is not a day name fails the body decode.
- A `category_ids` or `item_ids` entry names an `external_id` that does not exist. The issue says so, and if the value starts with `menu_`, `ctg_`, `item_` or `var_` it adds a hint to use the `external_id`.
- A price override names a menu that does not hold the item, names one menu twice, has a negative amount, or uses a currency other than the catalog’s (`[invalid_price_override]`). Overrides also work only on fixed prices, and modifier options take none.

Maple also refuses fields it cannot charge, such as fees, tax categories and coupons, with the field in `error.param`. See [What Maple refuses](https://docs.maple.inc/developer-api/concepts/the-catalog-model.md#what-maple-refuses).

## Read it back

```bash
curl $MAPLE_BASE/locations/{locationId}/catalog \
  -H "Authorization: Bearer $MAPLE_KEY"
```

Returns the current published catalog — `menus`, `categories` and `items` with their prices, shared modifier groups, tax rates, discounts and promotions — every object echoing the `external_id` you published it under. A catalog Maple imported from a POS can hold what the API cannot state, such as an open price or a coupon; the read leaves those out. A location with no published catalog returns a `404`.

The body starts with `"object": "catalog"`, then:

- `id` — the catalog’s Maple ID (`ctlg_…`). It replaces `catalog_id`.
- `livemode` — `true` for a live key, `false` for a test key.
- `location_id` and `version_id`.
- `updated` — when the published content last changed, in Unix seconds.

The response has no `timezone`. Menus, categories, items, top-level modifier groups, tax rates, discounts and promotions come back sorted by `external_id`, not in the order you sent them. The order inside `category_ids`, `item_ids`, variations, options and modifier group placements stays exactly as you sent it. Every collection is present, empty if you sent none.

## Orders and menu hours

An order line’s `external_id` is the `external_id` of the variation you published. If every menu that holds the item is closed when the order is placed, or at its `scheduled_for` time, Maple refuses the order, and the error message names the items and when their menus serve.

## Know when a publish lands

Publishing is synchronous: the response to `POST /v1/locations/{locationId}/catalog` is the result. No webhook follows a publish.

## Next

- [Receive and decide orders](https://docs.maple.inc/developer-api/guides/receive-orders.md): Order line items reference your catalog by the external\_id you assign.
- [Full catalog schema](https://docs.maple.inc/developer-api/api-reference.md): Every field on every catalog object, in the endpoint reference.
