{
  "openapi": "3.1.0",
  "info": {
    "title": "Cofinal pricing quote API",
    "version": "1.0.0",
    "description": "Programmatic twin of the price calculator on https://cofinal.io/pricing:\nsend item measurements, get back the same quote the page's calculator\ncomputes — group classification, basket column, per-line and total prices.\n\nAll prices are in DKK and exclude 25% Danish VAT (moms is added on the\ninvoice). Prices are maintained continuously and may change — always\nquote live, never cache results beyond the response's Cache-Control.\n\nThe canonical price list lives at https://cofinal.io/pricing.md.\n"
  },
  "servers": [
    {
      "url": "https://cofinal.io",
      "description": "Production (marketing site)"
    }
  ],
  "paths": {
    "/api/pricing/quote": {
      "get": {
        "summary": "Quote fulfilment and return prices from item measurements",
        "description": "Send one LxWxHxG spec per item; the response carries each line's\ngroup classification, basket column and per-unit/total prices in\nøre — drop-off and home delivery when `delivery` is omitted, one\nmode when given, returns always. Malformed input is a 400 JSON\nerror, never an HTML page.\n",
        "operationId": "getPricingQuote",
        "parameters": [
          {
            "name": "items",
            "in": "query",
            "required": true,
            "description": "One spec per item: length x width x height x weight — sides in cm\n(dot or comma decimals; side ORDER does not matter, the item may\nbe rotated), weight in whole grams; 'x' or '×' as separator.\nOptional '*N' multiplier for N identical units. Multiple item\nspecs are separated by commas.\n",
            "schema": {
              "type": "string",
              "examples": [
                "21.4x13x9.5x344,10x8x5x120*3"
              ]
            }
          },
          {
            "name": "delivery",
            "in": "query",
            "required": false,
            "description": "Fulfilment delivery mode to quote. When omitted, the response\ncarries BOTH modes, so an unspecified ask never needs a second\nrequest. Returns have no delivery dimension and are always\nquoted.\n",
            "schema": {
              "type": "string",
              "enum": [
                "dropoff",
                "home"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quote succeeded. `quotes.dropoff` / `quotes.home` follow the\n`delivery` parameter (both present when it was omitted);\n`quotes.returns` is always present.\n",
            "headers": {
              "Cache-Control": {
                "description": "Prices are read on every request; keep caching short.",
                "schema": {
                  "type": "string",
                  "example": "public, max-age=10"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteResponse"
                },
                "examples": {
                  "twoItemsBothModes": {
                    "summary": "GET /api/pricing/quote?items=21.4x13x9.5x344,10x8x5x120*3",
                    "description": "Generated from the live price catalog at request time.",
                    "value": {
                      "ok": true,
                      "currency": "DKK",
                      "vat_rate": 0.25,
                      "note": "All prices excl. 25% Danish VAT (moms).",
                      "quotes": {
                        "dropoff": {
                          "units": 4,
                          "lines": [
                            {
                              "dims_cm": [
                                21.4,
                                13.0,
                                9.5
                              ],
                              "weight_g": 344.0,
                              "quantity": 1,
                              "group": "small_770",
                              "group_name": "Small 770 g",
                              "column": "q4p",
                              "unit_price_ore": 2604,
                              "total_ore": 2604
                            },
                            {
                              "dims_cm": [
                                10.0,
                                8.0,
                                5.0
                              ],
                              "weight_g": 120.0,
                              "quantity": 3,
                              "group": "small_140",
                              "group_name": "Small 140 g",
                              "column": "q4p",
                              "unit_price_ore": 2580,
                              "total_ore": 7740
                            }
                          ],
                          "total_ore": 10344
                        },
                        "home": {
                          "units": 4,
                          "lines": [
                            {
                              "dims_cm": [
                                21.4,
                                13.0,
                                9.5
                              ],
                              "weight_g": 344.0,
                              "quantity": 1,
                              "group": "small_770",
                              "group_name": "Small 770 g",
                              "column": "q4p",
                              "unit_price_ore": 3273,
                              "total_ore": 3273
                            },
                            {
                              "dims_cm": [
                                10.0,
                                8.0,
                                5.0
                              ],
                              "weight_g": 120.0,
                              "quantity": 3,
                              "group": "small_140",
                              "group_name": "Small 140 g",
                              "column": "q4p",
                              "unit_price_ore": 3173,
                              "total_ore": 9519
                            }
                          ],
                          "total_ore": 12792
                        },
                        "returns": {
                          "units": 4,
                          "lines": [
                            {
                              "dims_cm": [
                                21.4,
                                13.0,
                                9.5
                              ],
                              "weight_g": 344.0,
                              "quantity": 1,
                              "group": "small_770",
                              "group_name": "Small 770 g",
                              "column": "q4p",
                              "unit_price_ore": 2604,
                              "total_ore": 2604
                            },
                            {
                              "dims_cm": [
                                10.0,
                                8.0,
                                5.0
                              ],
                              "weight_g": 120.0,
                              "quantity": 3,
                              "group": "small_140",
                              "group_name": "Small 140 g",
                              "column": "q4p",
                              "unit_price_ore": 2580,
                              "total_ore": 7740
                            }
                          ],
                          "total_ore": 10344
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed input — never an HTML error page. `error` names what\nwent wrong, `message` explains the expected syntax.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "QuoteResponse": {
        "type": "object",
        "required": [
          "ok",
          "currency",
          "vat_rate",
          "note",
          "quotes"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "currency": {
            "type": "string",
            "const": "DKK"
          },
          "vat_rate": {
            "type": "number",
            "const": 0.25,
            "description": "25% Danish VAT (moms); added on the invoice, not in these totals."
          },
          "note": {
            "type": "string"
          },
          "quotes": {
            "type": "object",
            "required": [
              "returns"
            ],
            "properties": {
              "dropoff": {
                "$ref": "#/components/schemas/CategoryQuote"
              },
              "home": {
                "$ref": "#/components/schemas/CategoryQuote"
              },
              "returns": {
                "$ref": "#/components/schemas/CategoryQuote"
              }
            }
          }
        }
      },
      "CategoryQuote": {
        "type": "object",
        "required": [
          "units",
          "lines",
          "total_ore"
        ],
        "description": "One catalog category over all asked-for items. `total_ore` is null\nwhen ANY line lacks a mirrored price — no silently partial sum.\n",
        "properties": {
          "units": {
            "type": "integer",
            "minimum": 1,
            "description": "Total units across all items — drives each line's basket column."
          },
          "lines": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/QuoteLine"
                },
                {
                  "type": "null"
                }
              ]
            },
            "description": "One entry per asked-for item, same order; a null line means that item could not be classified at all."
          },
          "total_ore": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "QuoteLine": {
        "type": "object",
        "required": [
          "dims_cm",
          "weight_g",
          "quantity",
          "group",
          "group_name",
          "column",
          "unit_price_ore",
          "total_ore"
        ],
        "properties": {
          "dims_cm": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 3,
            "maxItems": 3,
            "description": "Echoes the three sides exactly as parsed from the request (cm)."
          },
          "weight_g": {
            "type": "number",
            "description": "Item weight in grams, as requested."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "group": {
            "type": "string",
            "description": "Pricing-group code (e.g. small_110..small_3000, standard_140..standard_4500, large_590..large_4500, oversize)."
          },
          "group_name": {
            "type": "string",
            "description": "The group's Danish display name, as merchants see it."
          },
          "column": {
            "type": "string",
            "enum": [
              "q1",
              "q2",
              "q3",
              "q4p",
              "q2p"
            ],
            "description": "Basket column for this order — follows the ORDER's total unit count with the group's own cap (q1..q3 + q4p, or q1 + q2p for Large)."
          },
          "unit_price_ore": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Per-unit price in øre (1 DKK = 100 øre); null while the category is unmirrored."
          },
          "total_ore": {
            "type": [
              "integer",
              "null"
            ],
            "description": "unit_price_ore × quantity; null when the unit price is unmirrored."
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "ok",
          "error",
          "message"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "string",
            "enum": [
              "invalid_items",
              "invalid_delivery"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}