{
  "info": {
    "name": "nextech connecthub — Partner API",
    "description": "Two-way integration API for aggregators, OTAs and technology partners.\n\nGenerated from connecthub.openapi.json — do not edit by hand.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{access_token}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://d.nextechhq.com/functions/v1"
    },
    {
      "key": "client_id",
      "value": ""
    },
    {
      "key": "client_secret",
      "value": ""
    },
    {
      "key": "tenant_id",
      "value": ""
    },
    {
      "key": "access_token",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Authentication",
      "item": [
        {
          "name": "Get an access token",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/partner-oauth-token",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-oauth-token"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"{{client_id}}\",\n  \"client_secret\": \"{{client_secret}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "OAuth2 `client_credentials` grant. Accepts JSON or `application/x-www-form-urlencoded`. Returns a 1-hour Bearer token. Unknown client, wrong secret and suspended app all collapse to `401 invalid_client` (no credential oracle)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "var j = {};",
                  "try { j = pm.response.json(); } catch (e) {}",
                  "if (j.access_token) {",
                  "  pm.collectionVariables.set('access_token', j.access_token);",
                  "  pm.test('token captured', function () { pm.expect(j.access_token).to.be.a('string'); });",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Inspect the current token",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/partner-token-details",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-token-details"
              ]
            },
            "description": "Token diagnostics — echoes ONLY the caller's own token: its `app_id`, granted `scopes`, `environment`, expiry, and current rate-limit budget. Never an oracle for other apps."
          }
        }
      ]
    },
    {
      "name": "Directory",
      "item": [
        {
          "name": "List branches or reference lists",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/partner-directory?resource=<resource>&tenant_id={{tenant_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-directory"
              ],
              "query": [
                {
                  "key": "resource",
                  "value": "<resource>"
                },
                {
                  "key": "tenant_id",
                  "value": "{{tenant_id}}"
                }
              ]
            },
            "description": "`resource=shops` returns the tenant's active branches; `resource=order-types` and `resource=payment-methods` return the aggregator-relevant reference lists. Requires scope `directory:read` and an active grant for `tenant_id`."
          }
        }
      ]
    },
    {
      "name": "Menu",
      "item": [
        {
          "name": "Get the tenant menu",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/partner-menu?tenant_id={{tenant_id}}&channel=<channel>",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-menu"
              ],
              "query": [
                {
                  "key": "tenant_id",
                  "value": "{{tenant_id}}"
                },
                {
                  "key": "channel",
                  "value": "<channel>"
                }
              ]
            },
            "description": "Returns categories, visible products with per-channel price, and modifier groups with options. Only customer-facing fields are exposed (never cost, margin or tech-card). Requires scope `menu:read` and an active grant."
          }
        }
      ]
    },
    {
      "name": "Orders",
      "item": [
        {
          "name": "Poll an order's status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/partner-orders?tenant_id={{tenant_id}}&provider=<provider>&external_order_id=<external_order_id>",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-orders"
              ],
              "query": [
                {
                  "key": "tenant_id",
                  "value": "{{tenant_id}}"
                },
                {
                  "key": "provider",
                  "value": "<provider>"
                },
                {
                  "key": "external_order_id",
                  "value": "<external_order_id>"
                }
              ]
            },
            "description": "Resolves `(tenant_id, provider, external_order_id)` to the internal order and returns its live status. Requires scope `orders:read`."
          }
        },
        {
          "name": "Ingest an aggregator order",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/partner-orders",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-orders"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tenant_id\": \"\",\n  \"shop_id\": \"\",\n  \"provider\": \"\",\n  \"external_order_id\": \"\",\n  \"order_type\": \"pickup\",\n  \"payment_method\": \"cash\",\n  \"total\": 0,\n  \"delivery_fee\": 0,\n  \"commission\": 0,\n  \"customer_name\": \"\",\n  \"customer_phone\": \"\",\n  \"customer_note\": \"\",\n  \"items\": [\n    {}\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Idempotently lands an order in the shared spine (KDS + stock + accounting). Line prices are recorded **as sent** — connecthub does not re-price. Retrying the same `external_order_id` returns the original order with `idempotent:true`. Requires scope `orders:write`."
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "List webhook endpoints or deliveries",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/partner-webhooks?tenant_id={{tenant_id}}&resource=<resource>&limit=<limit>",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-webhooks"
              ],
              "query": [
                {
                  "key": "tenant_id",
                  "value": "{{tenant_id}}"
                },
                {
                  "key": "resource",
                  "value": "<resource>"
                },
                {
                  "key": "limit",
                  "value": "<limit>"
                }
              ]
            },
            "description": "Default lists this partner's endpoints for the tenant (the signing secret is NEVER returned). Pass `resource=deliveries` to list recent delivery attempts (status/attempts/error) for your endpoints. Requires scope `webhooks:read` (or `webhooks:manage`)."
          }
        },
        {
          "name": "Register a webhook endpoint (or replay a delivery)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/partner-webhooks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-webhooks"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tenant_id\": \"\",\n  \"url\": \"\",\n  \"event_types\": [\n    \"\"\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Registers an `https://` endpoint to receive signed events. The `secret` is returned ONCE — store it, it is used to verify the HMAC signature. Requires scope `webhooks:manage`.\n\nTo re-queue a failed delivery, POST `{ tenant_id, action: \"replay\", delivery_id }` — it re-attempts one of your own dead/failed/delivered deliveries."
          }
        },
        {
          "name": "Disable a webhook endpoint",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/partner-webhooks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "partner-webhooks"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"tenant_id\": \"\",\n  \"endpoint_id\": \"\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Disables one of this partner's own endpoints. Requires scope `webhooks:manage`."
          }
        }
      ]
    }
  ]
}
