{
  "openapi": "3.1.0",
  "info": {
    "title": "Medienwerft Punchout API",
    "version": "1.1.0",
    "description": "Multi-tenant punchout connector. Speaks **IDS-Connect 2.5** (German trade: craftsman software punches out into a wholesaler webshop and the finished cart or order is posted back), **SAP OCI 2.0B–5.0** (a browser-mediated launch, with the basket returned as flat NEW_ITEM-<FIELD>[n] form fields) and **cXML 1.2.x** (a server-to-server XML setup answered with a StartPage, the basket returned as a PunchOutOrderMessage, and an OrderRequest relay).\n\nA storefront integrates ONCE: it receives a neutral cart and never learns which protocol the buyer speaks.\n\n## Scope\n\nThis document covers the **protocol surface** — everything a buyer’s procurement system or a storefront talks to. The tenant-admin endpoints (connections, unit mappings, transfers, hooks, the test console) are driven by the Punchout dashboard and are deliberately not documented here; they are gated by platform JWT scopes and change with the dashboard.\n\nThe protocol endpoints are unauthenticated in the platform sense, and always will be: they are driven by procurement systems — craftsman desktop software, SAP, Ariba, Coupa — and by storefronts that hold no platform identity. They are protected by per-connection credentials, an explicit return-URL allowlist, and single-use capability tokens.\n\n## Storefront SDK\n\nA shop does **not** need to implement the browser half of this by hand. Two packages cover it:\n\n- **`@medienwerft/punchout-client`** — framework-neutral, zero dependencies. Reads the handoff token out of the URL fragment, exchanges it, and keeps the session in a cookie, `sessionStorage` and `window.name` at once — so a browser that refuses one still holds the punchout.\n- **`@medienwerft/punchout-react`** — `<PunchoutResume>` and `<PunchoutCheckout>`, plus a `/next` entry for the App Router.\n\nA typical integration is two files: one resume page and one cart binding. See `packages/punchout-client` and `packages/punchout-react` in the Service Hub monorepo.\n\n## The round trip\n\n1. The buyer's system starts the punchout at its protocol's entry point: IDS craftsman software `POST`s a form to `/ids/{connection}/setup`, an SAP system sends the OCI launch to `/oci/{connection}/setup` (usually a `GET`), and a cXML procurement system posts a `PunchOutSetupRequest` to `/cxml/{connection}/request` server-to-server.\n2. For IDS and OCI the service answers **303** to `{storefrontUrl}/punchout/resume#t={token}`; for cXML it answers a `PunchOutSetupResponse` whose `StartPage` is that same URL, and the buyer's system sends its user there — the token rides in the *fragment*, so it never reaches the shop's server logs, proxies or `Referer`. A fragment is readable only by JavaScript, so a connection may set `handoffCarrier: \"query\"` and receive `?t={token}` instead: the shop then reads the token server-side and the whole round trip needs no JavaScript at all, at the cost of the single-use token appearing in that shop's own access log.\n3. The shop's resume page exchanges the token at `GET /handoff/{token}` and receives the basket plus a `submitToken`.\n4. The visitor shops. When they transfer, the shop `POST`s to `/submit/cart` (or `/submit/order`).\n5. The service answers with a self-submitting HTML form aimed at the buyer's return address, carrying the basket in the buyer's own protocol: the IDS document, OCI's flat `NEW_ITEM-<FIELD>[n]` fields, or a cXML `PunchOutOrderMessage` in the `cXML-urlencoded` field.\n\nSteps 2 and 5 are **browser navigations**, not fetches — a `fetch` would receive the redirect and the HTML and do nothing with either.\n\n## Orders, per protocol\n\nWhat \"an order\" means differs, and the shop never has to know which applies: the handoff's `requirements.submit` lists what it may send.\n\n- **IDS** marks the returned document \"mit Bestellung\" (`/submit/order`). The order is created either by the shop before it transfers (`placedbyshop`) or by the relay, before the document goes back.\n- **OCI** has no order on the return leg. A customer whose policy says so still gets one: the basket is relayed to the tenant's backend (the shop's order route and/or the `onOrder` hook) and returned as a cart.\n- **cXML** receives firm orders as a separate `OrderRequest` from the buyer, posted to the same `/cxml/{connection}/request`. Ordering on transfer works as for OCI.\n\nRelayed orders go to the shop's own order route (the `shopOrder` webhook), after the tenant's `onOrder` hook if one is bound, which can change or refuse the order first. Without an order route, the `onOrder` hook alone delivers it. A relay that refuses or fails STOPS the transfer: nothing reaches the buyer, the shop's visitor sees a refusal page, and the submit token is valid again.\n\n## Customers\n\nOne connection serves many buyer organisations. A customer is recognised by what its protocol sends — IDS `kndnr`, OCI `USERNAME`, the cXML `From` identity — and a customer profile can override the connection's order mode, custom fields and commodity-code system for that customer. The shop learns the outcome through `requirements`, never the identity."
  },
  "externalDocs": {
    "description": "Punchout in the Service Hub — architecture, hooks, and the storefront SDK",
    "url": "https://github.com/medienwerft/emporix-jas-cms-plugin/blob/main/PUNCHOUT.md"
  },
  "tags": [
    {
      "name": "Meta",
      "description": "Health, version, the SDK files and the user guide. Reachable even when nothing else is: no key, no token."
    },
    {
      "name": "Protocol entry points",
      "description": "Where a buyer's procurement system starts a punchout or sends an order: IDS-Connect and OCI post forms (OCI may also GET), cXML posts text/xml, server to server."
    },
    {
      "name": "Your shop calls the service",
      "description": "Calls your shop makes to the service: picking up the basket (`/handoff`) and sending it back (`/submit`). Covered by `@medienwerft/punchout-client`."
    },
    {
      "name": "The service calls your shop",
      "description": "Shop routes: endpoints YOUR shop hosts and the service calls, documented as webhooks. Set their addresses on the connection; every call is signed with `x-punchout-signature`. Covered by `createSignInRoute` and `createOrderRoute`."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Buyer systems",
      "tags": [
        "Protocol entry points"
      ]
    },
    {
      "name": "Shop integration",
      "tags": [
        "Your shop calls the service",
        "The service calls your shop"
      ]
    },
    {
      "name": "Service",
      "tags": [
        "Meta"
      ]
    }
  ],
  "paths": {
    "/": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "Service descriptor",
        "description": "Names the service and links its own docs. Useful when someone lands on the deployment root wondering what it is.",
        "responses": {
          "200": {
            "description": "Descriptor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Descriptor"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "Liveness and store reachability",
        "description": "Returns 503 when the configured store is unreachable. Unauthenticated by design.",
        "responses": {
          "200": {
            "description": "Healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "503": {
            "description": "Store unreachable"
          }
        }
      }
    },
    "/version": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "What is deployed here",
        "description": "Unauthenticated on purpose — the question comes up precisely when nobody can authenticate.",
        "responses": {
          "200": {
            "description": "Build and mode",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Version"
                }
              }
            }
          }
        }
      }
    },
    "/user-guide": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "The User Guide, as a PDF",
        "description": "Unauthenticated. The operator's guide to the Punchout dashboard — connections, customers, units and codes, hooks, test punchouts, transfers — one chapter per task. Served inline, so a link opens it in the browser.",
        "responses": {
          "200": {
            "description": "The PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        }
      }
    },
    "/sdk": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "The storefront SDK: current packages and how to install them",
        "description": "Unauthenticated. Lists `@medienwerft/punchout-client` and `@medienwerft/punchout-react` with their version, tarball URL and npm `integrity`, the install commands, and a single-file browser build of the client for pages without a bundler. A React storefront installs **both** tarballs in one command: the components depend on the client.",
        "responses": {
          "200": {
            "description": "The SDK manifest",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "packages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": { "type": "string", "examples": ["@medienwerft/punchout-client"] },
                          "version": { "type": "string", "examples": ["1.0.0"] },
                          "tarball": { "type": "string", "format": "uri" },
                          "integrity": { "type": "string", "description": "What npm records in a lockfile for this tarball." }
                        }
                      }
                    },
                    "install": {
                      "type": "object",
                      "properties": {
                        "client": { "type": "string", "description": "npm command for a framework-neutral storefront." },
                        "react": { "type": "string", "description": "npm command for a React storefront (both packages)." }
                      }
                    },
                    "browser": {
                      "type": "object",
                      "properties": {
                        "description": { "type": "string" },
                        "url": { "type": "string", "format": "uri" }
                      }
                    },
                    "guide": { "type": "string", "format": "uri" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sdk/{file}": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "Download one SDK file",
        "description": "Unauthenticated. A versioned npm tarball (`medienwerft-punchout-client-1.0.0.tgz`) or the browser build (`punchout-client-1.0.0.js`). File names carry the version and their bytes never change, so responses are cached as immutable and a lockfile's `integrity` stays valid. Take the current names from `GET /sdk`.",
        "parameters": [
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "content": {
              "application/gzip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/javascript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No SDK file of that name"
          }
        }
      }
    },
    "/ids/{connection}/setup": {
      "post": {
        "tags": [
          "Protocol entry points"
        ],
        "summary": "A craftsman application starts a punchout",
        "description": "The single entry point, configured once by hand in the craftsman's software. The connection slug is opaque and permanent — renaming a site does not change it.\n\n**Body encoding.** `application/x-www-form-urlencoded` or `multipart/form-data`. ISO-8859-1 is common and handled: the raw bytes are decoded with the charset the sender declares, so umlauts survive.\n\n**Answers differ by action.** `SV` and `LI` return XML. `WKS`/`WKE`, and `AS`/`ADL` when a `hookurl` is present, return **303** with a `Location`. `AS`/`ADL` without a `hookurl` redirect straight to the target — there is no way home, so no session is opened.",
        "parameters": [
          {
            "name": "connection",
            "in": "path",
            "required": true,
            "description": "The connection's opaque slug.",
            "schema": {
              "type": "string"
            },
            "example": "mwdemo"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SetupForm"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SetupForm"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`SV` or `LI` — an IDS XML document.",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "303": {
            "description": "Go to the shop. The browser must follow this.",
            "headers": {
              "Location": {
                "description": "`{storefrontUrl}/punchout/resume#t={token}`, or the same with `&next=` for an `AS`/`ADL` entry. A connection whose `handoffCarrier` is `query` gets `?t={token}` instead — see the round trip.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or missing action, or a missing `hookurl` on a cart action."
          },
          "403": {
            "description": "The connection is disabled, or the `hookurl` is not on its allowlist. The refusal names the refused URL and the origin an admin would have to add — never the allowlist itself. Every refusal is also recorded as a `rejected` inbound transfer, without its payload."
          },
          "404": {
            "description": "No such connection. Indistinguishable from one you may not see, on purpose."
          },
          "501": {
            "description": "An unsupported IDS version (names both sides), or an `AS`/`ADL` with no `search`/`deeplink` hook bound."
          },
          "502": {
            "description": "A tenant hook threw — the message names the hook point — or, as an HTML refusal page, the tenant's backend declined the order. On a refusal page nothing was sent and the submit token is valid again."
          }
        }
      }
    },
    "/handoff/{token}": {
      "get": {
        "tags": [
          "Your shop calls the service"
        ],
        "summary": "Exchange the handoff token for the basket",
        "description": "Called by the shop — from the browser or from its own server — with the token it found in the URL fragment.\n\n**Single use, and short-lived** (~5 minutes). Spending it returns the basket and mints the `submitToken` for the return leg. Invalid, expired and already-spent all answer 404 with one message, so a token cannot be probed.\n\n`@medienwerft/punchout-client` calls this for you.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "description": "The value of `t` from the resume URL's fragment.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The basket, plus the credential for sending it back. `Cache-Control: no-store`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HandoffCart"
                }
              }
            }
          },
          "400": {
            "description": "No token in the path."
          },
          "404": {
            "description": "Invalid, expired, or already used."
          }
        }
      }
    },
    "/submit/{kind}": {
      "post": {
        "tags": [
          "Your shop calls the service"
        ],
        "summary": "The shop returns the finished basket",
        "description": "A **form POST from the visitor's browser**, not a fetch: the response is a self-submitting HTML page aimed at the buyer's return address, and only a navigation can follow it.\n\nThe shop presents a **token, not a return address**. It never learns the buyer's return address (IDS `hookurl`, OCI `HOOK_URL`, cXML `BrowserFormPost`) — the service resolves it from the session when the token is spent. Handing the address to the shop and trusting it back is exactly the shape that made the original an open redirect.\n\nThe basket the buyer receives is rebuilt here; for IDS, the `RefItems` cross-references the craftsman sent are restored from the stored inbound cart — the shop is never told about them and cannot echo them.\n\n**Transferring as an order.** With `placedbyshop` set, the shop created the order itself and nothing is relayed. Otherwise the order is delivered BEFORE anything goes back to the buyer — to the shop's order route (see the `shopOrder` webhook), after the tenant's `onOrder` hook if one is bound, or to that hook alone without an order route — and its number becomes `orderconfno`. Only a punchout whose login was checked may relay (see the `shopSignIn` webhook). With nothing to relay to, IDS-Connect still marks the document \"mit Bestellung\" (the transfer is recorded with an issue); OCI and cXML refuse.",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "`cart` for a basket, `order` for an order. Offer only what the handoff's `requirements.submit` lists: a customer whose policy is carts-only has `order` refused (409), and one whose policy is orders-only has a `cart` treated as an order.",
            "schema": {
              "type": "string",
              "enum": [
                "cart",
                "order"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SubmitForm"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SubmitForm"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A self-submitting HTML form posting the basket to the buyer's return address, in the buyer's protocol: the IDS document, OCI `NEW_ITEM-<FIELD>[n]` fields, or a cXML `PunchOutOrderMessage` in `cXML-urlencoded`.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Missing cart payload (`payload`, or the older `idsgo`) or missing `token`; `placedbyshop` without `orderconfno`; or an IDS order with no order confirmation number and no relay to assign one."
          },
          "403": {
            "description": "An HTML refusal page (`login_unchecked`): an order would be relayed, but nobody checked the buyer’s login when the punchout opened. Set a sign-in address on the connection or bind an `authenticate` hook. Nothing was sent, and the submit token is valid again."
          },
          "409": {
            "description": "An HTML refusal page: this customer may not transfer the basket as an order, or no relay receives orders on this connection. Nothing was sent, and the submit token is valid again."
          },
          "422": {
            "description": "An HTML refusal page naming the required custom fields that are missing. Nothing was sent, and the submit token is valid again."
          },
          "404": {
            "description": "Unknown kind, or a submit token that is invalid, expired or already used."
          },
          "502": {
            "description": "A tenant hook threw (the message names the hook point), or the order relay refused or failed — the `onOrder` hook or the shop's order route answered anything but `ok: true`. Nothing was sent, and the submit token is valid again."
          }
        }
      }
    },
    "/submit/state": {
      "post": {
        "tags": [
          "Your shop calls the service"
        ],
        "summary": "Is this submit token still spendable?",
        "description": "Read-only. The SDK clears a storefront's session when the visitor presses transfer; a transfer refused before anything was sent (a missing required field, an order the tenant's backend declined) gives the token back, and this is how the shop finds out it may offer the button again. The SDK calls it for you.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Whether the token can still be spent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "open": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing token."
          }
        }
      }
    },
    "/test/return": {
      "post": {
        "tags": [
          "Your shop calls the service"
        ],
        "summary": "Stand-in for the buyer's procurement system",
        "description": "Renders whatever was posted to it, so a round trip can finish without a desktop listener to point a browser at.\n\nInert by construction: it stores nothing, reads nothing and decides nothing. `handleSetup` treats this exact path on this service's own origin as implicitly allowlisted, so the dashboard's test console works on a new connection without anyone adding it by hand — safe because the POST is made by the visitor's own browser, so the only basket anyone sees is the one they just sent.",
        "parameters": [
          {
            "name": "back",
            "in": "query",
            "required": false,
            "description": "An http(s) URL to render a link back to, so the round trip ends where it started.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SubmitForm"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An HTML page showing the fields received.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/oci/{connection}/setup": {
      "get": {
        "tags": [
          "Protocol entry points"
        ],
        "summary": "An SAP system starts an OCI punchout, search or price check",
        "description": "SAP's Open Catalog Interface, versions 2.0B, 3.0, 4.0 and 5.0. Usually a **GET** with every parameter in the query string; a form POST with the same fields is accepted too. Parameter names are matched case-insensitively.\n\n**`FUNCTION` decides what happens** (absent means `LAUNCH`):\n\n- `LAUNCH` — a punchout. The buyer arrives with an EMPTY basket. Answers **303** into the shop, exactly as IDS does. `HOOK_URL` is required and allowlist-checked.\n- `BACKGROUND_SEARCH` / `SOURCING` — search for `SEARCHSTRING`, through the connection's `search` hook. `DETAIL` — one article (`PRODUCTID`), through the `deeplink` hook. With a `HOOK_URL` they open a punchout at that page; without one they are a plain redirect.\n- `VALIDATE` — a price check for ONE article (`PRODUCTID`, optional `QUANTITY`), with no browser at all. Answered by the connection's `quote` hook, formatted as a one-line `NEW_ITEM-<FIELD>[1]` block. With no `quote` hook bound it is REFUSED (501) rather than answered without a price, which a buyer's approval workflow would read as free.\n\n**The return leg** posts the basket back to `HOOK_URL` as flat `NEW_ITEM-<FIELD>[n]` form fields. Which fields are written is decided by the `OCI_VERSION` the launch resolved, so a 2.0B buyer never receives fields its version does not define. Custom fields land in `NEW_ITEM-CUST_FIELD1..5`, commodity codes in `NEW_ITEM-MATGROUP` (and the 5.0 `EXT_SCHEMA_TYPE`/`EXT_CATEGORY_ID` pair). Units are UN/CEFACT Rec 20 codes (`EA`, `MTR`), at most three characters.",
        "parameters": [
          {
            "name": "connection",
            "in": "path",
            "required": true,
            "description": "The connection's opaque slug.",
            "schema": {
              "type": "string"
            },
            "example": "ocidemo"
          },
          {
            "name": "FUNCTION",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "LAUNCH",
                "BACKGROUND_SEARCH",
                "SOURCING",
                "DETAIL",
                "VALIDATE"
              ]
            },
            "description": "What the buyer asks for. Absent means LAUNCH."
          },
          {
            "name": "HOOK_URL",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Where the basket goes back. Required for LAUNCH; allowlist-checked before anything is stored."
          },
          {
            "name": "OCI_VERSION",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "2.0B",
                "3.0",
                "4.0",
                "5.0"
              ]
            },
            "description": "Checked against the connection's accepted versions; absent means the connection's default. Decides the field set of the return leg."
          },
          {
            "name": "USERNAME",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The buyer's user — what identifies the customer on OCI (a customer profile matches it)."
          },
          {
            "name": "PASSWORD",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Carried, never checked unless an `authenticate` hook is bound."
          },
          {
            "name": "SEARCHSTRING",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "BACKGROUND_SEARCH / SOURCING only."
          },
          {
            "name": "PRODUCTID",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "DETAIL and VALIDATE. VALIDATE also accepts `VENDORMAT` / `NEW_ITEM-VENDORMAT[1]`."
          },
          {
            "name": "QUANTITY",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "VALIDATE only. `NEW_ITEM-QUANTITY[1]` is accepted too."
          }
        ],
        "responses": {
          "200": {
            "description": "`VALIDATE` only — the priced article as a `NEW_ITEM-<FIELD>[1]` block.",
            "content": {
              "application/x-www-form-urlencoded": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "303": {
            "description": "Go to the shop (LAUNCH, or a search/detail with a `HOOK_URL`), or straight to the found page (without one).",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "`{storefrontUrl}/punchout/resume#t={token}` — see the round trip."
              }
            }
          },
          "400": {
            "description": "Missing `HOOK_URL` on a launch, an unknown `FUNCTION`, or a `VALIDATE` that names no article."
          },
          "403": {
            "description": "The connection is disabled, or `HOOK_URL` is not on its allowlist (the refusal names the refused URL, never the allowlist)."
          },
          "404": {
            "description": "No such connection."
          },
          "405": {
            "description": "Neither GET nor POST."
          },
          "501": {
            "description": "An `OCI_VERSION` the connection does not accept, or a search/detail/validate with no hook bound to answer it."
          },
          "502": {
            "description": "A tenant hook threw; the message names the hook point."
          }
        }
      },
      "post": {
        "tags": [
          "Protocol entry points"
        ],
        "summary": "The same OCI launch, sent as a form",
        "description": "Identical to the GET, with the parameters in an `application/x-www-form-urlencoded` body. Body fields win over query fields of the same name.",
        "parameters": [
          {
            "name": "connection",
            "in": "path",
            "required": true,
            "description": "The connection's opaque slug.",
            "schema": {
              "type": "string"
            },
            "example": "ocidemo"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`VALIDATE` only — the priced article as a `NEW_ITEM-<FIELD>[1]` block.",
            "content": {
              "application/x-www-form-urlencoded": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "303": {
            "description": "Go to the shop (LAUNCH, or a search/detail with a `HOOK_URL`), or straight to the found page (without one).",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "`{storefrontUrl}/punchout/resume#t={token}` — see the round trip."
              }
            }
          },
          "400": {
            "description": "Missing `HOOK_URL` on a launch, an unknown `FUNCTION`, or a `VALIDATE` that names no article."
          },
          "403": {
            "description": "The connection is disabled, or `HOOK_URL` is not on its allowlist (the refusal names the refused URL, never the allowlist)."
          },
          "404": {
            "description": "No such connection."
          },
          "405": {
            "description": "Neither GET nor POST."
          },
          "501": {
            "description": "An `OCI_VERSION` the connection does not accept, or a search/detail/validate with no hook bound to answer it."
          },
          "502": {
            "description": "A tenant hook threw; the message names the hook point."
          }
        }
      }
    },
    "/cxml/{connection}/request": {
      "post": {
        "tags": [
          "Protocol entry points"
        ],
        "summary": "A procurement system sends a cXML document",
        "description": "cXML 1.2.x (Ariba, Coupa, Jaggaer), accepted by version PREFIX — the DTD grows additively, so a new micro version is never a reason to refuse. The body is the raw cXML document (`text/xml`), posted **server-to-server**: there is no browser on this leg.\n\n**Which document decides the answer:**\n\n- `PunchOutSetupRequest` (`operation` `create`, `edit` or `inspect`) — opens a punchout. Requires `BrowserFormPost/URL` (allowlist-checked) and a `BuyerCookie`. On `edit`/`inspect` the requisition's `ItemOut` lines ARE the basket to reopen. Answered with a `PunchOutSetupResponse` whose `StartPage/URL` is the shop's resume page; the buyer's system sends its user there. The return leg posts a `PunchOutOrderMessage` back to `BrowserFormPost/URL` in the single form field `cXML-urlencoded`, carrying the same `BuyerCookie`, in the DTD version the buyer opened with.\n- `OrderRequest` — a firm purchase order, relayed to the tenant's backend: the shop's order route (`shopOrder` webhook), after the `onOrder` hook if bound, or the `onOrder` hook alone. **Idempotent per `payloadID`** (required): a retry is answered with the byte-identical acknowledgement and the relay does not run again. With neither, or a hook-only setup whose hook returns nothing, the order is REFUSED — acknowledging a PO nothing forwarded would tell the buyer it was placed.\n\n**Refusals travel IN BAND.** A buyer retries on any non-200, so every protocol-level refusal is an HTTP **200** carrying `<Status code=\"4xx\"|\"5xx\" text=\"…\">`. A real non-200 means this service failed, not that it declined.\n\nThe `From` identity is what identifies the customer (a customer profile matches it); the `Sender` `SharedSecret` is carried and checked only by an `authenticate` hook.",
        "parameters": [
          {
            "name": "connection",
            "in": "path",
            "required": true,
            "description": "The connection's opaque slug.",
            "schema": {
              "type": "string"
            },
            "example": "cxmldemo"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/xml": {
              "schema": {
                "type": "string"
              }
            },
            "application/xml": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Always, for anything the service decided: a `PunchOutSetupResponse` (StartPage), an `OrderRequest` acknowledgement, or a refusal as `<Status code>` — see above.",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No such connection. Answered as plain JSON before any cXML is read."
          },
          "405": {
            "description": "Only POST."
          },
          "500": {
            "description": "This service failed. A buyer may retry; an `OrderRequest` retry is still deduplicated by `payloadID`."
          }
        }
      }
    }
  },
  "webhooks": {
    "shopSignIn": {
      "post": {
        "tags": [
          "The service calls your shop"
        ],
        "summary": "Your sign-in route checks the buyer’s login",
        "description": "**Hosted by the shop, called by the service.** Set its URL as the connection's **sign-in address** (Connections → Policy). The service then asks it before it opens anything — every launch, search, product link and OCI price check — and the punchout opens only on `{\"ok\": true}`.\n\nThe login is whatever the buyer's protocol sent: IDS-Connect `kndnr` / `name_kunde` / `pw_kunde`, OCI `USERNAME` / `PASSWORD`, the cXML shared secret. Treat `password` as a login form's: check it and forget it, never log it.\n\nA checked login is also what allows orders to be relayed on transfer: without this route (or an `authenticate` hook), a basket submitted as an order is refused with `login_unchecked`.\n\nSigned with `x-punchout-signature` — see the `punchoutSignature` security scheme. Check it on the RAW body before parsing, and answer `401` on any failure. `createSignInRoute` / `createOrderRoute` in `@medienwerft/punchout-client` do all of this; a shop without JavaScript on its server builds the route from the developer guide's chapter 11.",
        "security": [
          {
            "punchoutSignature": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignInRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "With `\"ok\": true` the punchout opens. `200` without `\"ok\": true` is a refusal, like a `4xx`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInAnswer"
                }
              }
            }
          },
          "4XX": {
            "description": "The login is refused (`401` for a bad signature or a wrong login, or any other `4xx`). The buyer is told the login was refused; a `reason` in the body is recorded on the transfer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInAnswer"
                }
              }
            }
          },
          "5XX": {
            "description": "The buyer is refused, and the transfer records it as the shop’s failure. So is no answer within 10 seconds, or no connection at all."
          }
        }
      }
    },
    "shopOrder": {
      "post": {
        "tags": [
          "The service calls your shop"
        ],
        "summary": "Your order route creates an order",
        "description": "**Hosted by the shop, called by the service.** Set its URL as the connection's **order address** (Connections → Policy). If the tenant also bound an `onOrder` hook, that hook runs first, inside the service: it may pass the order on unchanged, send a changed one, or refuse it, in which case this route is not called. This route receives two kinds of order:\n\n- `purchaseOrder` — a cXML `OrderRequest` the buyer's system posted to `/cxml/{connection}/request`, server to server. Forwarded only when the connection has the credential `cxmlSharedSecret` and the order carries it.\n- `orderOnTransfer` — a basket the shop submitted to `/submit/order` **without** `placedbyshop`. Delivered BEFORE anything goes back to the buyer, and only from a punchout whose login was checked (the sign-in route or an `authenticate` hook).\n\nCreate the order in your commerce system under `customer`'s account, **at your own prices** — the lines carry the prices the buyer approved, which are a claim. Silence means no: anything but `{\"ok\": true, \"orderId\": …}` refuses the order, and a refused order-on-transfer stops the transfer. A resent purchase order with the same `documentId` is answered by the service from the first attempt; keying your order on `documentId` as well makes a double delivery harmless at your end too.\n\nSigned with `x-punchout-signature` — see the `punchoutSignature` security scheme. Check it on the RAW body before parsing, and answer `401` on any failure. `createSignInRoute` / `createOrderRoute` in `@medienwerft/punchout-client` do all of this; a shop without JavaScript on its server builds the route from the developer guide's chapter 11.",
        "security": [
          {
            "punchoutSignature": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PunchoutOrder"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "With `{\"ok\": true, \"orderId\": …}` the order is accepted; `orderId` becomes the order confirmation number the buyer receives. With `{\"ok\": false, \"reason\": …}` it is refused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderAnswer"
                }
              }
            }
          },
          "default": {
            "description": "Any non-`2xx`, or no answer within 25 seconds, refuses the order and the buyer’s system is told it was not accepted."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Descriptor": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "docs": {
            "type": "string"
          },
          "guide": {
            "type": "string"
          },
          "userGuide": {
            "type": "string"
          },
          "sdk": {
            "type": "string"
          },
          "openapi": {
            "type": "string"
          },
          "health": {
            "type": "string"
          }
        }
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "degraded"
            ]
          },
          "store": {
            "type": "string",
            "enum": [
              "postgres",
              "emporix"
            ]
          },
          "dbOk": {
            "type": "boolean",
            "nullable": true
          },
          "version": {
            "type": "string"
          }
        }
      },
      "Version": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "build": {
            "type": [
              "string",
              "null"
            ],
            "description": "A short hash of the running bundle. The version follows the product train and does not change with every build; two deployments with the same build run the same code. Null when not running from a bundle."
          },
          "surface": {
            "type": "string",
            "enum": [
              "all",
              "admin",
              "protocol"
            ],
            "description": "Which routes this deployment serves. On Emporix the protocol routes are a public function (`protocol`) and the console API a private one (`admin`)."
          },
          "store": {
            "type": "string"
          },
          "authMode": {
            "type": "string",
            "enum": [
              "emporix",
              "oidc"
            ]
          }
        }
      },
      "SetupForm": {
        "type": "object",
        "description": "IDS field names, exactly as craftsman software sends them. An `onInbound` hook can normalise a vendor that differs.",
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "WKS",
              "WKE",
              "AS",
              "ADL",
              "SV",
              "LI"
            ],
            "description": "WKS send cart · WKE receive cart · AS article search · ADL article deeplink · SV interface version · LI login information. (HLS, the heating label, answers 501.)"
          },
          "version": {
            "type": "string",
            "description": "IDS version. Checked against the connection's accepted list for cart actions.",
            "example": "2.5"
          },
          "hookurl": {
            "type": "string",
            "description": "Where the finished basket goes. Checked against the connection's allowlist before anything is stored. Required for WKS/WKE; on AS/ADL its absence means a plain redirect with no session."
          },
          "warenkorb": {
            "type": "string",
            "description": "The IDS XML document. WKS/WKE only."
          },
          "kndnr": {
            "type": "string",
            "description": "Customer number."
          },
          "name_kunde": {
            "type": "string",
            "description": "User name."
          },
          "pw_kunde": {
            "type": "string",
            "description": "Password. Never checked unless an `authenticate` hook is bound — that is the honest default."
          },
          "searchterm": {
            "type": "string",
            "description": "AS only. `suchbegriff` is accepted as an alias."
          },
          "ghnummer": {
            "type": "string",
            "description": "ADL only — the wholesaler's article number. `artnr` is accepted as an alias."
          }
        }
      },
      "SubmitForm": {
        "type": "object",
        "required": [
          "token"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "The `submitToken` from the handoff exchange. Single use."
          },
          "kind": {
            "type": "string",
            "enum": [
              "cart",
              "order"
            ],
            "description": "What the transfer is. Wins over the path: a submit URL of a different shape (a proxy, a sub-path mount) cannot silently turn an order into a cart. Absent or unrecognised falls back to the `{kind}` path segment."
          },
          "payload": {
            "type": "string",
            "description": "The finished basket as JSON, in the neutral shape the handoff delivered — see `ShopBasket`. Send either this or `idsgo`; exactly one is required."
          },
          "idsgo": {
            "type": "string",
            "description": "Deprecated NAME ONLY, and supported permanently: the same value as `payload`, under the name SDK 0.1.x sent. Not deprecated behaviour — there is no plan to remove it."
          }
        }
      },
      "HandoffCart": {
        "type": "object",
        "required": [
          "connection",
          "lines",
          "submitUrl",
          "submitToken",
          "submitExpiresAt"
        ],
        "properties": {
          "connection": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "example": "EUR"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HandoffLine"
            }
          },
          "submitUrl": {
            "type": "string",
            "description": "Where to POST the finished basket."
          },
          "submitToken": {
            "type": "string",
            "description": "The credential for sending it back. A TOKEN, not the buyer's return address — the shop never learns that."
          },
          "submitExpiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "After this the return leg is closed (~8h)."
          },
          "requirements": {
            "$ref": "#/components/schemas/Requirements"
          }
        }
      },
      "Requirements": {
        "type": "object",
        "description": "What THIS customer's transfer must look like. Protocol-neutral: the shop never learns the protocol, the customer's identity, or which wire slot a field lands in.",
        "required": [
          "submit",
          "fields"
        ],
        "properties": {
          "submit": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "cart",
                "order"
              ]
            },
            "description": "The kinds of transfer to offer, in order. `[\"cart\"]` is a plain transfer; `[\"cart\", \"order\"]` offers both; `[\"order\"]` means every transfer is an order."
          },
          "fields": {
            "type": "array",
            "description": "Custom fields to collect. Send values in the payload's `orderinfo.fields` (basket) or each line's `fields` (line), keyed by `key`. A missing required field refuses the transfer.",
            "items": {
              "type": "object",
              "required": [
                "key",
                "label",
                "level",
                "required"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "level": {
                  "type": "string",
                  "enum": [
                    "basket",
                    "line"
                  ]
                },
                "required": {
                  "type": "boolean"
                },
                "maxLength": {
                  "type": "integer"
                }
              }
            }
          },
          "classification": {
            "type": "object",
            "description": "The commodity code system and release this customer wants. Send every code you hold per line as `classifications`; the service picks this one.",
            "properties": {
              "system": {
                "type": "string",
                "example": "ECLASS"
              },
              "version": {
                "type": "string",
                "example": "13.0"
              }
            }
          }
        }
      },
      "HandoffLine": {
        "type": "object",
        "required": [
          "sku",
          "artNo",
          "qty"
        ],
        "properties": {
          "sku": {
            "type": "string",
            "description": "Resolved shop SKU. Today `passthrough`: the IDS ArtNo IS the SKU."
          },
          "artNo": {
            "type": "string"
          },
          "ean": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "qty": {
            "type": "string",
            "description": "A decimal STRING, not a number — IDS quantities carry trailing zeros that matter."
          },
          "unit": {
            "type": "string",
            "description": "Shop-side unit, after unit-mapping translation."
          },
          "priceCents": {
            "type": "integer",
            "description": "PER-UNIT price in minor units, already divided by PriceBasis. The shop should never have to know what PriceBasis is."
          },
          "note": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "ShopBasket": {
        "type": "object",
        "description": "What the shop sends inside `payload`. Keys are lowercase and read case-insensitively; values are strings (numbers are accepted). Only the keys an integrator most needs are listed — the handoff's `lines` show the rest of the vocabulary.",
        "properties": {
          "cart": {
            "type": "object",
            "properties": {
              "order": {
                "type": "object",
                "properties": {
                  "orderinfo": {
                    "type": "object",
                    "properties": {
                      "currency": {
                        "type": "string"
                      },
                      "inquiryno": {
                        "type": "string"
                      },
                      "placedbyshop": {
                      "type": "boolean",
                      "description": "The shop already created this order in its commerce system, and `orderconfno` is its number. The service then relays it nowhere — relaying would place it twice — and only marks the transfer as an order. Requires `orderconfno` (400 without it)."
                    },
                      "orderconfno": {
                        "type": "string",
                        "description": "The order's number. A cart never needs it. When the order is relayed (`onOrder` hook or the shop's order route), the relay's number replaces it. Required with `placedbyshop`, and for an IDS order that nothing relays."
                      },
                      "fields": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "Basket-level custom fields, by the keys `requirements.fields` named. A missing required one is refused (422) before anything is sent."
                      }
                    }
                  },
                  "orderitem": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "artno": {
                          "type": "string"
                        },
                        "qty": {
                          "type": "string"
                        },
                        "qu": {
                          "type": "string",
                          "description": "Shop unit; translated to the buyer unit by the unit mappings."
                        },
                        "articleshorttext": {
                          "type": "string"
                        },
                        "netprice": {
                          "type": "string",
                          "description": "The price of `pricebasis` units, as a decimal in currency: `\"29.00\"`. Send `pricebasis` `\"1\"`."
                        },
                        "pricebasis": {
                          "type": "string",
                          "description": "A QUANTITY — the price is for this many units (the trade’s Preiseinheit), not a currency subdivision."
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          },
                          "description": "Line-level custom fields."
                        },
                        "classifications": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "system",
                              "code"
                            ],
                            "properties": {
                              "system": {
                                "type": "string",
                                "example": "ECLASS",
                                "description": "Any common spelling is read as the same system — `ECLASS`/`eCl@ss`/`eClass`, `ETIM`, `UNSPSC` — and a release spelled into it (`eCl@ss 13.0`, `ETIM-9.0`) fills in a missing `version`. Other names (a buyer’s own material groups, say `MATGROUP`) are taken as given. The buyer’s own spelling is written only on the way out, from the connection."
                              },
                              "version": {
                                "type": "string",
                                "example": "13.0"
                              },
                              "code": {
                                "type": "string",
                                "example": "27-06-01-01"
                              }
                            }
                          },
                          "description": "Commodity codes the shop knows. The one matching the customer's system and release is written; otherwise the tenant's mapping table decides."
                        },
                        "category": {
                          "type": "string",
                          "description": "The shop's category, for mapping rows that match by category rather than by SKU."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "SignInRequest": {
        "type": "object",
        "description": "What the sign-in route receives. Fields that do not apply are left out, never sent empty.",
        "required": [
          "connection",
          "protocol",
          "action"
        ],
        "properties": {
          "connection": {
            "type": "string",
            "example": "demo"
          },
          "protocol": {
            "type": "string",
            "enum": [
              "ids",
              "oci",
              "cxml"
            ]
          },
          "action": {
            "type": "string",
            "description": "What the buyer asked for: `WKS`, `LAUNCH`, `BACKGROUND_SEARCH`, `VALIDATE`, …",
            "example": "WKS"
          },
          "customerNo": {
            "type": "string",
            "description": "IDS `kndnr`.",
            "example": "0010042"
          },
          "userName": {
            "type": "string",
            "description": "IDS `name_kunde`, OCI `USERNAME`.",
            "example": "meier"
          },
          "password": {
            "type": "string",
            "description": "IDS `pw_kunde`, OCI `PASSWORD`, the cXML shared secret. Never log it."
          },
          "buyerUserId": {
            "type": "string",
            "description": "The buyer-side person, where the protocol named one (OCI `USER_ID`, the cXML end user)."
          },
          "buyerId": {
            "type": "string",
            "description": "cXML `From` identity: the buying organisation."
          },
          "senderId": {
            "type": "string",
            "description": "cXML `Sender` identity: the calling system, often a procurement network."
          },
          "fields": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "The launch's form fields after the tenant's `onInbound` hook — for a customer number the buyer's software sent in a field of its own. IDS-Connect and OCI only. Never contains the password; values over 2,000 characters are left out."
          }
        }
      },
      "SignInAnswer": {
        "type": "object",
        "description": "What the sign-in route answers. Anything but `\"ok\": true` refuses the buyer.",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "customerNo": {
            "type": "string",
            "maxLength": 100,
            "description": "Your customer number. It picks the customer profile for the whole punchout and reaches the exchange as `customer.key`. Omit it and the protocol's own key picks the profile."
          },
          "userId": {
            "type": "string",
            "maxLength": 100,
            "description": "Your user id, handed back to the shop as `buyerUserId`."
          },
          "displayName": {
            "type": "string",
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "description": "With `\"ok\": false`: why. Recorded on the transfer."
          }
        },
        "example": {
          "ok": true,
          "customerNo": "10042",
          "userId": "u-7",
          "displayName": "Acme Plumbing Ltd"
        }
      },
      "Customer": {
        "type": "object",
        "description": "The customer the service recognised.",
        "required": [
          "key",
          "displayName",
          "shop"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "The customer number the sign-in route returned; else what the buyer's system identified it by: IDS customer number, OCI login, cXML buyer id."
          },
          "displayName": {
            "type": "string"
          },
          "shop": {
            "type": "object",
            "additionalProperties": true,
            "description": "The customer profile's `settings.shop` — e.g. `{\"emporixCustomerNo\": \"C-42\"}`. `{}` when nothing is set."
          },
          "signedIn": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Present when the sign-in route accepted this login."
          }
        }
      },
      "PunchoutOrder": {
        "type": "object",
        "description": "What the order route receives.",
        "required": [
          "kind",
          "connection",
          "customer",
          "order"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "purchaseOrder",
              "orderOnTransfer"
            ],
            "description": "A cXML `OrderRequest` from the buyer, or a basket transferred as an order that the shop did not place itself."
          },
          "documentId": {
            "type": "string",
            "description": "The buyer's document id, stable across the buyer's retries.",
            "example": "1793448000.4711@buyer.example"
          },
          "connection": {
            "type": "string",
            "example": "demo"
          },
          "customer": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Customer"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when no customer profile matched. Resolve the account from `customer.shop`."
          },
          "buyerUserId": {
            "type": "string",
            "description": "The buyer-side person, where the protocol named one.",
            "example": "jane.doe@acme.example"
          },
          "order": {
            "type": "object",
            "required": [
              "order"
            ],
            "properties": {
              "order": {
                "type": "object",
                "description": "The order in the service's neutral model.",
                "required": [
                  "info",
                  "items"
                ],
                "properties": {
                  "info": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`inquiryNo` (the cXML PO number, or the buyer's IDS `InquiryNo`), `currency`, …"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "deliveryPlace": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "billTo": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        }
      },
      "OrderAnswer": {
        "type": "object",
        "description": "What the order route answers. Anything but `\"ok\": true` with an `orderId` refuses the order.",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "orderId": {
            "type": "string",
            "description": "With `\"ok\": true`: your order number.",
            "example": "EMX-1001"
          },
          "reason": {
            "type": "string",
            "description": "With `\"ok\": false`: why.",
            "example": "unknown customer"
          }
        }
      }
    },
    "securitySchemes": {
      "punchoutSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "x-punchout-signature",
        "description": "Sent BY the service on every call into the shop's routes. `t=<unix seconds>,v1=<lowercase hex HMAC-SHA256 of \"<t>.<raw body>\">`, keyed with the secret set on the connection as `shopSigningSecret` (the shop keeps the same value, e.g. as `PUNCHOUT_SHOP_SECRET`). Refuse a `t` more than 300 seconds from your clock, and compare `v1` in constant time."
      },
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Platform JWT whose `aud` includes `punchout-api`, carrying `medienwerft.punchout.*` scopes. Admin surface only — not used by anything in this document."
      },
      "shopKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Punchout-API-Key",
        "description": "Per-shop key, stored only as a peppered SHA-256 hash and revealed once at mint time."
      }
    }
  }
}
