{
  "info": {
    "_postman_id": "a1d2c3b4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
    "name": "Maple Developer API",
    "description": "# Maple Developer API\n\nImport this collection together with its environment, set your API key, and run the requests top to bottom.\n\n## Setup\n1. Import this collection and the `Maple Developer API` environment.\n2. In the environment, paste your API key into `apiKey`: `mpk_test_…` for test mode, `mpk_live_…` for live mode. Both use the same base URL.\n3. Run **Status & Auth → Current app (/me)** to confirm the credential.\n\n## How auth works\nRequests send `Authorization: Bearer {{bearerToken}}`. When `bearerToken` is empty it falls back to your `apiKey`, so just setting `apiKey` is enough. The optional **OAuth** folder issues an access token and switches `bearerToken` to it automatically; clear `bearerToken` to go back to the API key.\n\n## Chaining\nList requests capture the first `id` they return (`locationId`, `orderId`, `subscriptionId`, `eventId`) into the environment, so the get/update/decision requests below them work without copy-paste.\n\nAll money is in integer minor units (cents). Full reference: https://docs.maple.inc/developer-api.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{bearerToken}}",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Fall back to the API key when no explicit bearer token (e.g. an OAuth access token) is set.",
          "if (!pm.environment.get('bearerToken') && !pm.collectionVariables.get('bearerToken')) {",
          "  const apiKey = pm.environment.get('apiKey') || pm.collectionVariables.get('apiKey');",
          "  if (apiKey) { pm.variables.set('bearerToken', apiKey); }",
          "}"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": ["pm.test('No server error', function () {", "  pm.expect(pm.response.code).to.be.below(500);", "});"]
      }
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.maple.inc/v1",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Status & Auth",
      "description": "Service readiness and credential introspection.",
      "item": [
        {
          "name": "Ping",
          "request": {
            "method": "GET",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "url": {
              "raw": "{{baseUrl}}/ping",
              "host": ["{{baseUrl}}"],
              "path": ["ping"]
            },
            "description": "Unauthenticated readiness probe for the Developer API."
          },
          "response": []
        },
        {
          "name": "Current app (/me)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/me",
              "host": ["{{baseUrl}}"],
              "path": ["me"]
            },
            "description": "Returns the developer app and effective scopes for the authenticated credential. Run this first to confirm your API key works."
          },
          "response": []
        }
      ]
    },
    {
      "name": "OAuth (optional)",
      "description": "Optional OAuth 2.0 flows. Most integrations just use an API key; use these only if you issue access tokens. The token-capture scripts switch the active `bearerToken` to the issued access token automatically.",
      "item": [
        {
          "name": "Token — client_credentials",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && json.access_token) {",
                  "  pm.environment.set('accessToken', json.access_token);",
                  "  pm.environment.set('bearerToken', json.access_token);",
                  "  console.log('Saved accessToken and switched bearerToken to the OAuth token.');",
                  "}",
                  "if (json && json.refresh_token) {",
                  "  pm.environment.set('refreshToken', json.refresh_token);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "auth": {
              "type": "noauth"
            },
            "url": {
              "raw": "{{baseUrl}}/oauth/token",
              "host": ["{{baseUrl}}"],
              "path": ["oauth", "token"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"{{clientId}}\",\n  \"client_secret\": \"{{clientSecret}}\",\n  \"scope\": \"locations:read connections:read connections:write orders:read orders:write catalog:read catalog:write delivery_zones:read delivery_zones:write\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Exchange an OAuth client id/secret for an access token (and rotating refresh token). Set `clientId` and `clientSecret` in your environment first."
          },
          "response": []
        },
        {
          "name": "Token — refresh_token",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && json.access_token) {",
                  "  pm.environment.set('accessToken', json.access_token);",
                  "  pm.environment.set('bearerToken', json.access_token);",
                  "  console.log('Saved accessToken and switched bearerToken to the OAuth token.');",
                  "}",
                  "if (json && json.refresh_token) {",
                  "  pm.environment.set('refreshToken', json.refresh_token);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "auth": {
              "type": "noauth"
            },
            "url": {
              "raw": "{{baseUrl}}/oauth/token",
              "host": ["{{baseUrl}}"],
              "path": ["oauth", "token"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"grant_type\": \"refresh_token\",\n  \"client_id\": \"{{clientId}}\",\n  \"client_secret\": \"{{clientSecret}}\",\n  \"refresh_token\": \"{{refreshToken}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Exchange a refresh token for a new access token. The refresh token is rotated on every use; reusing an old one revokes the whole family."
          },
          "response": []
        },
        {
          "name": "Authorization code — Step 1: generate PKCE",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const CryptoJS = require('crypto-js');",
                  "function base64url(words) {",
                  "  return CryptoJS.enc.Base64.stringify(words).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");",
                  "}",
                  "const verifier = base64url(CryptoJS.lib.WordArray.random(32));",
                  "const challenge = base64url(CryptoJS.SHA256(verifier));",
                  "pm.environment.set('codeVerifier', verifier);",
                  "pm.environment.set('codeChallenge', challenge);",
                  "console.log('code_challenge (S256) for your authorize URL:', challenge);"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "url": {
              "raw": "{{baseUrl}}/ping",
              "host": ["{{baseUrl}}"],
              "path": ["ping"]
            },
            "description": "Generates a PKCE `code_verifier` + `code_challenge` (S256) into your environment. Build your authorize URL with the logged `code_challenge`, complete the merchant consent in a browser, then paste the returned `code` into `authCode` and run Step 2."
          },
          "response": []
        },
        {
          "name": "Authorization code — Step 2: exchange code",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && json.access_token) {",
                  "  pm.environment.set('accessToken', json.access_token);",
                  "  pm.environment.set('bearerToken', json.access_token);",
                  "  console.log('Saved accessToken and switched bearerToken to the OAuth token.');",
                  "}",
                  "if (json && json.refresh_token) {",
                  "  pm.environment.set('refreshToken', json.refresh_token);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "auth": {
              "type": "noauth"
            },
            "url": {
              "raw": "{{baseUrl}}/oauth/token",
              "host": ["{{baseUrl}}"],
              "path": ["oauth", "token"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"grant_type\": \"authorization_code\",\n  \"client_id\": \"{{clientId}}\",\n  \"client_secret\": \"{{clientSecret}}\",\n  \"code\": \"{{authCode}}\",\n  \"redirect_uri\": \"{{redirectUri}}\",\n  \"code_verifier\": \"{{codeVerifier}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Exchange the authorization code (with its PKCE verifier) for an access + refresh token. Requires `authCode`, `redirectUri`, and the `codeVerifier` from Step 1."
          },
          "response": []
        },
        {
          "name": "Revoke token",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "auth": {
              "type": "noauth"
            },
            "url": {
              "raw": "{{baseUrl}}/oauth/revoke",
              "host": ["{{baseUrl}}"],
              "path": ["oauth", "revoke"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"client_id\": \"{{clientId}}\",\n  \"client_secret\": \"{{clientSecret}}\",\n  \"token\": \"{{accessToken}}\",\n  \"token_type_hint\": \"access_token\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Revoke an access or refresh token. Revoking a refresh token revokes its whole rotation family. Succeeds even if the token is unknown."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Locations & Connections",
      "description": "The locations your app has been granted access to, and connecting to a location as its POS order receiver.",
      "item": [
        {
          "name": "List locations",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && Array.isArray(json.data) && json.data.length > 0) {",
                  "  pm.environment.set('locationId', json.data[0].id);",
                  "  console.log('Saved locationId =', json.data[0].id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations",
              "host": ["{{baseUrl}}"],
              "path": ["locations"]
            },
            "description": "Lists the locations your app has been granted access to. Requires `locations:read`."
          },
          "response": []
        },
        {
          "name": "Get location",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "description": "Returns a single granted location. Requires `locations:read`."
          },
          "response": []
        },
        {
          "name": "Create connection",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/connection",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "connection"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "description": "Connects your app to a granted location as its POS receiver, provisioning and activating the integration. Requires `connections:write`."
          },
          "response": []
        },
        {
          "name": "Get connection",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/connection",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "connection"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "description": "Returns your app's connection to a granted location, if one exists. Requires `connections:read`."
          },
          "response": []
        },
        {
          "name": "Delete connection",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/connection",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "connection"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "description": "Disconnects your app from a location (the location can then be connected to a different POS). Requires `connections:write`."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Catalog",
      "description": "Read a granted location’s catalog, and publish it as the location’s order receiver. Publishing requires an active connection to the location.",
      "item": [
        {
          "name": "Get location catalog",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/catalog",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "catalog"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "description": "The location's current published catalog: categories, items, variations, shared modifier groups, and tax/fee/discount definitions. Money is in integer minor units. Requires `catalog:read` and a grant for the location."
          },
          "response": []
        },
        {
          "name": "Publish location catalog",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/catalog",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "catalog"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"currency\": \"USD\",\n  \"timezone\": \"America/New_York\",\n  \"taxCategories\": [\n    {\n      \"externalId\": \"tax-standard\",\n      \"name\": \"Standard\"\n    }\n  ],\n  \"taxRates\": [\n    {\n      \"externalId\": \"nyc-sales\",\n      \"name\": \"NYC Sales Tax\",\n      \"taxCategoryId\": \"tax-standard\",\n      \"method\": \"percentage\",\n      \"percentage\": 8.875\n    }\n  ],\n  \"modifierGroups\": [\n    {\n      \"externalId\": \"milk-choice\",\n      \"name\": \"Milk\",\n      \"minSelections\": 0,\n      \"maxSelections\": 1,\n      \"options\": [\n        {\n          \"externalId\": \"oat-milk\",\n          \"name\": \"Oat Milk\",\n          \"price\": {\n            \"amount\": {\n              \"amountMinor\": 75,\n              \"currency\": \"USD\"\n            }\n          }\n        },\n        {\n          \"externalId\": \"whole-milk\",\n          \"name\": \"Whole Milk\"\n        }\n      ]\n    }\n  ],\n  \"categories\": [\n    {\n      \"externalId\": \"coffee\",\n      \"name\": \"Coffee\",\n      \"items\": [\n        {\n          \"externalId\": \"latte\",\n          \"name\": \"Latte\",\n          \"description\": \"Espresso with steamed milk.\",\n          \"taxCategoryId\": \"tax-standard\",\n          \"variations\": [\n            {\n              \"externalId\": \"latte-12oz\",\n              \"name\": \"12 oz\",\n              \"price\": {\n                \"amount\": {\n                  \"amountMinor\": 450,\n                  \"currency\": \"USD\"\n                }\n              }\n            },\n            {\n              \"externalId\": \"latte-16oz\",\n              \"name\": \"16 oz\",\n              \"price\": {\n                \"amount\": {\n                  \"amountMinor\": 525,\n                  \"currency\": \"USD\"\n                }\n              }\n            }\n          ],\n          \"modifierGroups\": [\n            {\n              \"groupId\": \"milk-choice\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Publishes the full catalog document for a connected location. Validation is all-or-nothing; the document is applied as a diff, so an identical re-publish is a no-op and object identities stay stable by `externalId`. Requires `catalog:write`."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Delivery zones",
      "description": "Read a granted location’s delivery zones and check whether a coordinate is deliverable. Creating, updating and deleting zones requires an active connection to the location.",
      "item": [
        {
          "name": "List delivery zones",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && Array.isArray(json.data) && json.data.length > 0) {",
                  "  pm.environment.set('zoneId', json.data[0].id);",
                  "  console.log('Saved zoneId =', json.data[0].id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/delivery_zones",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "delivery_zones"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "description": "Lists the active delivery zones for a granted location. Requires `delivery_zones:read`."
          },
          "response": []
        },
        {
          "name": "Create delivery zone",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && json.object === 'delivery_zone') {",
                  "  pm.environment.set('zoneId', json.id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/delivery_zones",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "delivery_zones"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Downtown\",\n  \"polygon\": {\n    \"type\": \"Polygon\",\n    \"coordinates\": [\n      [\n        [\n          -74.02,\n          40.7\n        ],\n        [\n          -73.99,\n          40.7\n        ],\n        [\n          -73.99,\n          40.73\n        ],\n        [\n          -74.02,\n          40.73\n        ],\n        [\n          -74.02,\n          40.7\n        ]\n      ]\n    ]\n  },\n  \"delivery_fee_cents\": 450,\n  \"priority\": 0\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Creates a delivery zone for a connected location; zone names must be unique per location. `polygon` is a GeoJSON Polygon of `[longitude, latitude]` rings — the first ring must be closed. Requires `delivery_zones:write`."
          },
          "response": []
        },
        {
          "name": "Get delivery zone",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/delivery_zones/:zoneId",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "delivery_zones", ":zoneId"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                },
                {
                  "key": "zoneId",
                  "value": "{{zoneId}}"
                }
              ]
            },
            "description": "Returns a single delivery zone belonging to a granted location. Requires `delivery_zones:read`."
          },
          "response": []
        },
        {
          "name": "Update delivery zone",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/delivery_zones/:zoneId",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "delivery_zones", ":zoneId"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                },
                {
                  "key": "zoneId",
                  "value": "{{zoneId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"delivery_fee_cents\": 550\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Updates a delivery zone; only the provided fields change. Requires `delivery_zones:write`."
          },
          "response": []
        },
        {
          "name": "Delete delivery zone",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/delivery_zones/:zoneId",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "delivery_zones", ":zoneId"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                },
                {
                  "key": "zoneId",
                  "value": "{{zoneId}}"
                }
              ]
            },
            "description": "Deactivates a delivery zone belonging to a connected location. Requires `delivery_zones:write`."
          },
          "response": []
        },
        {
          "name": "Check delivery zone coverage",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/locations/:locationId/delivery_zones/check",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":locationId", "delivery_zones", "check"],
              "variable": [
                {
                  "key": "locationId",
                  "value": "{{locationId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"latitude\": 40.7128,\n  \"longitude\": -74.006\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Checks whether a coordinate falls inside any active delivery zone of a granted location and returns the matching zone and delivery fee. Requires `delivery_zones:read`."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Orders",
      "description": "The order loop: read orders, report validation results, accept/deny, and report status transitions. Reading orders needs a grant for the location; decisions and validation results need an active connection.",
      "item": [
        {
          "name": "List orders",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && Array.isArray(json.data) && json.data.length > 0) {",
                  "  pm.environment.set('orderId', json.data[0].id);",
                  "  console.log('Saved orderId =', json.data[0].id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders",
              "host": ["{{baseUrl}}"],
              "path": ["orders"]
            },
            "description": "Lists orders (up to 100) for every location your app holds a grant for. Use `since` for an oldest-first catch-up drain, then repeat with `starting_after` set to the last order id while `has_more` is true. Requires `orders:read`."
          },
          "response": []
        },
        {
          "name": "Get order",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "description": "Returns a single order if it belongs to a location your app holds a grant for. Requires `orders:read`."
          },
          "response": []
        },
        {
          "name": "Resend order notification",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/resend",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "resend"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "description": "Publishes a fresh order.notification only for a live order owned by your app connection that missed its webhook. Terminal orders cannot be resent or revived; reconcile them with GET /v1/orders?since=... and GET /v1/orders/{orderId}. Requires `orders:write`; your app must be the restaurant's order receiver."
          },
          "response": []
        },
        {
          "name": "Submit validation result",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/validation_result",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "validation_result"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"valid\",\n  \"partner_reference\": \"POS-TICKET-123\",\n  \"warnings\": []\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Report whether an order can be accepted (availability, pricing, POS injectability). A `valid` result lets Maple send the order notification; `invalid` blocks it. For an invalid result send `{ \"status\": \"invalid\", \"reason\": { \"code\": \"item_unavailable\", \"explanation\": \"…\" } }`. Requires `orders:write`."
          },
          "response": []
        },
        {
          "name": "Accept order",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/accept",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "accept"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "description": "Accept the order; it is finalized and the customer confirmed. Requires `orders:write`."
          },
          "response": []
        },
        {
          "name": "Mark order ready",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/ready",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "ready"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "description": "Mark the order ready for pickup/handoff. Requires `orders:write`."
          },
          "response": []
        },
        {
          "name": "Complete order",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/complete",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "complete"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "description": "Mark the order fulfilled. Requires `orders:write`."
          },
          "response": []
        },
        {
          "name": "Deny order",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/deny",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "deny"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Item out of stock\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Reject the order; it is rejected and any payment reversed. Requires `orders:write`."
          },
          "response": []
        },
        {
          "name": "Cancel order",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "cancel"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Customer requested cancellation\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Cancel the order. Requires `orders:write`."
          },
          "response": []
        },
        {
          "name": "Update order status",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/orders/:orderId/status",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":orderId", "status"],
              "variable": [
                {
                  "key": "orderId",
                  "value": "{{orderId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"ACCEPTED\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Report an order status transition. One of ACCEPTED, READY, IN_DELIVERY, FULFILLED, REJECTED, STORE_CANCELLED. Requires `orders:write`."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Webhooks",
      "description": "Event-type catalog, subscriptions, the event ledger, and replay.",
      "item": [
        {
          "name": "List webhook event types",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_event_types",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_event_types"]
            },
            "description": "Lists the event types a subscription can subscribe to."
          },
          "response": []
        },
        {
          "name": "Create webhook subscription",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && json.subscription) {",
                  "  pm.environment.set('subscriptionId', json.subscription.id);",
                  "  console.log('Saved subscriptionId =', json.subscription.id);",
                  "}",
                  "if (json && json.signing_secret) {",
                  "  pm.environment.set('signingSecret', json.signing_secret);",
                  "  console.log('Saved signingSecret (shown once) — store it securely.');",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhook_subscriptions",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_subscriptions"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"notification_url\": \"https://example.com/webhooks/maple\",\n  \"event_types\": [\n    \"order.validation_requested\",\n    \"order.notification\",\n    \"order.paid\",\n    \"order.cancelled\"\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Subscribe a notification URL to event types. Returns the HMAC signing secret once — store it now to verify deliveries. Needs the read scope of each event type: `orders:read` for `order.*`, `catalog:read` for `catalog.sync.*`, `locations:read` for `store.*`."
          },
          "response": []
        },
        {
          "name": "List webhook subscriptions",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && Array.isArray(json.data) && json.data.length > 0) {",
                  "  pm.environment.set('subscriptionId', json.data[0].id);",
                  "  console.log('Saved subscriptionId =', json.data[0].id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_subscriptions",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_subscriptions"]
            },
            "description": "Lists your app's webhook subscriptions in the credential's environment. Needs no scope."
          },
          "response": []
        },
        {
          "name": "Get webhook subscription",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_subscriptions/:subscriptionId",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_subscriptions", ":subscriptionId"],
              "variable": [
                {
                  "key": "subscriptionId",
                  "value": "{{subscriptionId}}"
                }
              ]
            },
            "description": "Retrieves a single subscription owned by your app. Needs no scope."
          },
          "response": []
        },
        {
          "name": "Update webhook subscription",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhook_subscriptions/:subscriptionId",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_subscriptions", ":subscriptionId"],
              "variable": [
                {
                  "key": "subscriptionId",
                  "value": "{{subscriptionId}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"disabled\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Update the notification URL, event types, or enabled/disabled status. The signing secret is unchanged. Event types need the same read scopes as when creating."
          },
          "response": []
        },
        {
          "name": "Send test webhook",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_subscriptions/:subscriptionId/test",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_subscriptions", ":subscriptionId", "test"],
              "variable": [
                {
                  "key": "subscriptionId",
                  "value": "{{subscriptionId}}"
                }
              ]
            },
            "description": "Delivers a synthetic `webhook.test` event and returns the delivery result. Needs no scope."
          },
          "response": []
        },
        {
          "name": "Delete webhook subscription",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_subscriptions/:subscriptionId",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_subscriptions", ":subscriptionId"],
              "variable": [
                {
                  "key": "subscriptionId",
                  "value": "{{subscriptionId}}"
                }
              ]
            },
            "description": "Permanently deletes the subscription; pending deliveries are abandoned. Needs no scope."
          },
          "response": []
        },
        {
          "name": "List webhook events",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && Array.isArray(json.data) && json.data.length > 0) {",
                  "  pm.environment.set('eventId', json.data[0].id);",
                  "  console.log('Saved eventId =', json.data[0].id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_events",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_events"]
            },
            "description": "Your app's event ledger (most recent first, up to 50). Useful for reconciliation and debugging missed deliveries. Shows only events whose type your credential may read."
          },
          "response": []
        },
        {
          "name": "Get webhook event",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_events/:eventId",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_events", ":eventId"],
              "variable": [
                {
                  "key": "eventId",
                  "value": "{{eventId}}"
                }
              ]
            },
            "description": "Retrieves a single event from the ledger, including its `data` payload. An event whose type your credential may not read answers 404."
          },
          "response": []
        },
        {
          "name": "Replay webhook event",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/webhook_events/:eventId/replay",
              "host": ["{{baseUrl}}"],
              "path": ["webhook_events", ":eventId", "replay"],
              "variable": [
                {
                  "key": "eventId",
                  "value": "{{eventId}}"
                }
              ]
            },
            "description": "Re-delivers the event to currently-matching subscriptions, skipping any already delivered (idempotent). An event whose type your credential may not read answers 404."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Feedback",
      "description": "Tell Maple about a bug, a missing capability, wrong docs, or an error you could not act on.",
      "item": [
        {
          "name": "Send feedback",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/feedback",
              "host": ["{{baseUrl}}"],
              "path": ["feedback"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"kind\": \"unclear_error\",\n  \"summary\": \"Order validation answered 400 without naming the field\",\n  \"attempted\": \"Submit a validation result for an order\",\n  \"expected\": \"The error names the field that failed\",\n  \"endpoint\": \"POST /v1/orders/{orderId}/validation_result\",\n  \"request_ids\": []\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Stores a report for Maple to read at its weekly review. Put the `x-request-id` of any request involved in `request_ids`. No scope is required."
          },
          "response": []
        }
      ]
    }
  ]
}
