{ "openapi": "3.1.0",
  "info": { "title": "OpenAjan Order API", "version": "1.0", "description": "Place orders and bookings at local shops. Payment at the shop. See https://openajan.com/agents.php", "contact": { "email": "hej@openajan.com" } },
  "servers": [ { "url": "https://openajan.com" } ],
  "paths": {
    "/@{slug}.json": { "get": { "summary": "Shop card (hours, catalog, ordering)", "parameters": [ { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Shop card" }, "404": { "description": "Not found" } } } },
    "/api/order.php": {
      "get": { "summary": "Describe how to order at a shop", "parameters": [ { "name": "merchant", "in": "query", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Schema and modes" } } },
      "post": { "summary": "Place an order or booking", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderRequest" } } } },
        "responses": { "200": { "description": "Order placed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderResponse" } } } }, "400": { "description": "Validation error" }, "404": { "description": "Merchant not found" }, "429": { "description": "Rate limited" } } } }
  },
  "components": { "schemas": {
    "OrderRequest": { "type": "object", "required": [ "merchant", "items", "customer" ], "properties": {
      "merchant": { "type": "string" }, "kind": { "type": "string", "enum": [ "order", "booking" ], "default": "order" }, "agent": { "type": "string" },
      "items": { "type": "array", "items": { "type": "object", "required": [ "id" ], "properties": { "id": { "type": "integer" }, "qty": { "type": "integer", "minimum": 1, "maximum": 50, "default": 1 } } } },
      "customer": { "type": "object", "required": [ "name", "phone" ], "properties": { "name": { "type": "string" }, "phone": { "type": "string" }, "email": { "type": "string" }, "lang": { "type": "string", "enum": [ "da", "de", "tr", "en" ] } } },
      "wanted_at": { "type": "string", "format": "date-time" }, "note": { "type": "string", "maxLength": 400 }, "idempotency_key": { "type": "string", "maxLength": 80 } } },
    "OrderResponse": { "type": "object", "properties": { "ok": { "type": "boolean" }, "order_id": { "type": "string" }, "status": { "type": "string" }, "kind": { "type": "string" }, "total": { "type": "number" }, "currency": { "type": "string" }, "payment": { "type": "string", "enum": [ "at_merchant", "online" ] }, "wanted_at": { "type": [ "string", "null" ] }, "message": { "type": "string" } } }
  } } }