{
  "openapi": "3.1.0",
  "info": {
    "version": "1.0.0",
    "title": "Ka-ching API",
    "description": "Ka-ching APIs to integration points, import and export of data.",
    "license": {
      "name": "",
      "url": "www.example.com"
    },
    "x-logo": {
      "url": "https://developers.ka-ching.dk/openapi/ka-ching-logo.png",
      "backgroundColor": "#FFFFFF",
      "altText": "Ka-ching logo"
    }
  },
  "servers": [
    {
      "url": "https://us-central1-ka-ching-base.cloudfunctions.net",
      "description": "Production server (US based)"
    },
    {
      "url": "https://europe-west1-ka-ching-base.cloudfunctions.net",
      "description": "Production server (EU based)"
    }
  ],
  "webhooks": {
    "Sale created": {
      "post": {
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sale"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "Checkout created": {
      "post": {
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Checkout"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "Deposit box reconciliation created": {
      "post": {
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepositBoxReconciliation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "Register close statement created": {
      "post": {
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterCloseStatement"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "paths": {
    "/imports/customers": {
      "post": {
        "tags": [
          "Imports"
        ],
        "summary": "Import customers",
        "description": "This allows you to import customers to Ka-ching.",
        "operationId": "customer_import",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "$ref": "#/components/parameters/Integration"
          }
        ],
        "requestBody": {
          "description": "Import customer to the Ka-ching system",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerImport"
              },
              "example": [
                {
                  "identifier": "123456",
                  "name": "Jens Jensen",
                  "street": "456 Østergade",
                  "city": "Copenhagen",
                  "postal_code": "2100",
                  "country": "Denmark",
                  "country_code": "DK",
                  "phone": "12 34 56 78",
                  "email": "jens.jensen@example.dk",
                  "additional_info": "This customer is a preferred client.",
                  "organization_number": "12345678",
                  "balance": 0,
                  "balance_overdue": 0,
                  "credit_limit": 10000,
                  "block_sales": false,
                  "attributes": {
                    "member_type": "platinum",
                    "discount_group": "group1"
                  }
                },
                {
                  "identifier": "987654",
                  "name": "Pia Petersen",
                  "street": "123 Hovedgaden",
                  "city": "Aarhus",
                  "postal_code": "8000",
                  "country": "Denmark",
                  "country_code": "DK",
                  "phone": "87 65 43 21",
                  "email": "pia.petersen@example.dk",
                  "additional_info": "This customer is a VIP.",
                  "organization_number": "98765432",
                  "balance": 0,
                  "balance_overdue": 0,
                  "credit_limit": 5000,
                  "block_sales": false
                }
              ]
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Response200OneOf"
          },
          "400": {
            "$ref": "#/components/responses/Response400"
          }
        }
      },
      "delete": {
        "tags": [
          "Imports"
        ],
        "operationId": "customer_delete",
        "summary": "Delete customer",
        "description": "This allows you to delete customers from Ka-ching.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "$ref": "#/components/parameters/Integration"
          }
        ],
        "requestBody": {
          "description": "Pass JSON array of customer identifiers to delete the from the system.",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "example": [
                "927438193",
                "348240301",
                "105328923"
              ]
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Response200OneOf"
          },
          "400": {
            "$ref": "#/components/responses/Response400"
          }
        }
      }
    },
    "/imports/loyalty_points": {
      "post": {
        "tags": [
          "Imports"
        ],
        "summary": "Import loyalty point events",
        "description": "This allows you to import loyalty point events to Ka-ching.",
        "operationId": "loyalty_point_event_import",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "$ref": "#/components/parameters/Integration"
          }
        ],
        "requestBody": {
          "description": "Import loyalty point events to the Ka-ching system",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoyaltyPointEventsImport"
              },
              "example": {
                "events": [
                  {
                    "currency_code": "DKK",
                    "customer_id": "226DBB0D-E7AC-4901-8D56-57C94F84F7CC",
                    "source": {
                      "type": "external",
                      "externalReference": "initial_points"
                    },
                    "timestamp": "2023-01-16T15:28:39",
                    "type": "overwrite",
                    "overwrite": 10
                  },
                  {
                    "currency_code": "DKK",
                    "customer_id": "ABC_DEF",
                    "source": {
                      "type": "external",
                      "externalReference": "id_of_event_in_your_system"
                    },
                    "timestamp": "2023-01-16T14:28",
                    "type": "earned",
                    "adjustment": 15
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Response200OneOf"
          },
          "400": {
            "$ref": "#/components/responses/Response400"
          }
        }
      }
    },
    "/rest/stats/summary/market/{market_id}/{time_resolution}/{time_value}/{bucket}": {
      "get": {
        "tags": [
          "Stats"
        ],
        "summary": "Get stats for a market",
        "operationId": "stats_summary_market",
        "description": "Returns aggregated sales key figures for all shops in a market.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.\n\nFor the stored buckets (`all`, `expenses` and `order_fulfillments`) you can append a further path to read a single value, for instance `.../all/payments/types` or `.../all/total`. A single number is returned as a JSON string.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "description": "The market identifier.",
            "schema": {
              "type": "string"
            },
            "example": "dk"
          },
          {
            "$ref": "#/components/parameters/StatsTimeResolution"
          },
          {
            "$ref": "#/components/parameters/StatsTimeValue"
          },
          {
            "$ref": "#/components/parameters/StatsBucket"
          }
        ],
        "responses": {
          "200": {
            "description": "The summary for the requested source, period and bucket.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatsSummary"
                },
                "examples": {
                  "stored": {
                    "summary": "Stored bucket (`all`)",
                    "value": {
                      "count": 42,
                      "item_count": 57,
                      "customer_count": 9,
                      "total": 18950,
                      "sub_total": 18950,
                      "base_price": 15160,
                      "total_discounts": 1250,
                      "total_tax_amount": 3790,
                      "vat_amount": 3790,
                      "margin": 7420,
                      "margin_total": 7420,
                      "payments": {
                        "types": {
                          "card": 16200,
                          "cash": 2950
                        },
                        "returns": {
                          "card": 200
                        },
                        "rounding": 0.5,
                        "transaction_count": 44,
                        "has_rounding_count": 3
                      },
                      "last_activity": {
                        "last_sale": {
                          "timestamp": 1741958961.565,
                          "timestamp_string": "2025-03-14T13:29:21Z",
                          "timezone": "Europe/Copenhagen",
                          "timestamp_date_string": "2025-03-14-14-29",
                          "timestamp_week_string": "2025-11"
                        }
                      }
                    }
                  },
                  "calculated": {
                    "summary": "Calculated bucket (`revenue`)",
                    "value": {
                      "count": 41,
                      "item_count": 55,
                      "customer_count": 9,
                      "total": 18450,
                      "sub_total": 18450,
                      "base_price": 14760,
                      "total_discounts": 1250,
                      "total_tax_amount": 3690,
                      "vat_amount": 3690,
                      "margin": 7420,
                      "margin_total": 7420
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "$ref": "#/components/responses/StatsResponse404"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/stats/summary/market/dk/day/2025-03-14/revenue?account=$KACHING_ACCOUNT\""
          }
        ]
      }
    },
    "/rest/stats/summary/shop/{shop_id}/all/{time_resolution}/{time_value}/{bucket}": {
      "get": {
        "tags": [
          "Stats"
        ],
        "summary": "Get stats for a shop",
        "operationId": "stats_summary_shop",
        "description": "Returns aggregated sales key figures for a single shop.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.\n\nFor the stored buckets (`all`, `expenses` and `order_fulfillments`) you can append a further path to read a single value, for instance `.../all/payments/types` or `.../all/total`. A single number is returned as a JSON string.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "shop_id",
            "in": "path",
            "required": true,
            "description": "The shop identifier.",
            "schema": {
              "type": "string"
            },
            "example": "-KxZjfwFLw93B2te1Ie9"
          },
          {
            "$ref": "#/components/parameters/StatsTimeResolution"
          },
          {
            "$ref": "#/components/parameters/StatsTimeValue"
          },
          {
            "$ref": "#/components/parameters/StatsBucket"
          }
        ],
        "responses": {
          "200": {
            "description": "The summary for the requested source, period and bucket.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatsSummary"
                },
                "examples": {
                  "stored": {
                    "summary": "Stored bucket (`all`)",
                    "value": {
                      "count": 42,
                      "item_count": 57,
                      "customer_count": 9,
                      "total": 18950,
                      "sub_total": 18950,
                      "base_price": 15160,
                      "total_discounts": 1250,
                      "total_tax_amount": 3790,
                      "vat_amount": 3790,
                      "margin": 7420,
                      "margin_total": 7420,
                      "payments": {
                        "types": {
                          "card": 16200,
                          "cash": 2950
                        },
                        "returns": {
                          "card": 200
                        },
                        "rounding": 0.5,
                        "transaction_count": 44,
                        "has_rounding_count": 3
                      },
                      "last_activity": {
                        "last_sale": {
                          "timestamp": 1741958961.565,
                          "timestamp_string": "2025-03-14T13:29:21Z",
                          "timezone": "Europe/Copenhagen",
                          "timestamp_date_string": "2025-03-14-14-29",
                          "timestamp_week_string": "2025-11"
                        }
                      }
                    }
                  },
                  "calculated": {
                    "summary": "Calculated bucket (`revenue`)",
                    "value": {
                      "count": 41,
                      "item_count": 55,
                      "customer_count": 9,
                      "total": 18450,
                      "sub_total": 18450,
                      "base_price": 14760,
                      "total_discounts": 1250,
                      "total_tax_amount": 3690,
                      "vat_amount": 3690,
                      "margin": 7420,
                      "margin_total": 7420
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "$ref": "#/components/responses/StatsResponse404"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/stats/summary/shop/-KxZjfwFLw93B2te1Ie9/all/month/2025-03/all?account=$KACHING_ACCOUNT\""
          }
        ]
      }
    },
    "/rest/checkouts": {
      "get": {
        "tags": [
          "Checkouts"
        ],
        "summary": "List checkouts",
        "operationId": "rest_checkouts_list",
        "description": "Returns checkouts for the account, newest first (ordered by `timing.timestamp_date_string`).\n\nAt most 500 checkouts are returned per request. To read further back, use `since` to narrow the period.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Only return checkouts made at or after this local time. Compared as text with `timing.timestamp_date_string` (`YYYY-MM-DD-HH-mm`), so a prefix such as `2025-03-14` or `2025-03` also works.",
            "schema": {
              "type": "string"
            },
            "example": "2025-03-14"
          },
          {
            "name": "shop",
            "in": "query",
            "required": false,
            "description": "Only return checkouts from this shop.",
            "schema": {
              "type": "string"
            },
            "example": "-KxZjfwFLw93B2te1Ie9"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of checkouts to return. Values above 500 are capped at 500.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 500
            },
            "example": 50
          }
        ],
        "responses": {
          "200": {
            "description": "The matching checkouts. An empty array if there are none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/schemas-Checkout"
                  }
                }
              }
            }
          },
          "400": {
            "description": "`limit` is not a positive integer.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "'limit' must be a positive integer"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/checkouts?account=$KACHING_ACCOUNT&shop=-KxZjfwFLw93B2te1Ie9&since=2025-03-14&limit=50\""
          }
        ]
      }
    },
    "/rest/checkouts/{checkout_id}": {
      "get": {
        "tags": [
          "Checkouts"
        ],
        "summary": "Get a checkout",
        "operationId": "rest_checkout_get",
        "description": "Returns a single checkout by its identifier.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "checkout_id",
            "in": "path",
            "required": true,
            "description": "The checkout `identifier`.",
            "schema": {
              "type": "string"
            },
            "example": "6C2B7F1E-4E0A-4D3B-9F1A-2E7A1C9D0B55"
          }
        ],
        "responses": {
          "200": {
            "description": "The checkout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/schemas-Checkout"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "description": "Not found. Returned with an empty body when no checkout has the given identifier."
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/checkouts/6C2B7F1E-4E0A-4D3B-9F1A-2E7A1C9D0B55?account=$KACHING_ACCOUNT\""
          }
        ]
      }
    },
    "/rest/customer/{customer_id}": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Get a customer",
        "operationId": "rest_customer_get",
        "description": "Returns a customer that was imported through the customer import (`/imports/customers`).\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "customer_id",
            "in": "path",
            "required": true,
            "description": "The customer `identifier`.",
            "schema": {
              "type": "string"
            },
            "example": "123456"
          }
        ],
        "responses": {
          "200": {
            "description": "The customer, as imported, plus a search `index`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerLookup"
                },
                "example": {
                  "identifier": "123456",
                  "name": "Jens Jensen",
                  "street": "456 Østergade",
                  "city": "Copenhagen",
                  "postal_code": "2100",
                  "country": "Denmark",
                  "country_code": "DK",
                  "phone": "12 34 56 78",
                  "email": "jens.jensen@example.dk",
                  "attributes": {
                    "member_type": "platinum"
                  },
                  "index": {
                    "email": "jens.jensen@example.dk",
                    "name": "jens jensen"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "description": "Not found. Returned with an empty body when no customer has the given identifier."
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/customer/123456?account=$KACHING_ACCOUNT\""
          }
        ]
      }
    },
    "/rest/customer/{customer_id}/loyalty_points": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Get a customer's loyalty points",
        "operationId": "rest_customer_loyalty_points_list",
        "description": "Returns the customer's loyalty point balance in every currency, keyed by currency code.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "customer_id",
            "in": "path",
            "required": true,
            "description": "The customer `identifier`.",
            "schema": {
              "type": "string"
            },
            "example": "123456"
          }
        ],
        "responses": {
          "200": {
            "description": "Balances keyed by currency code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "$ref": "#/components/schemas/LoyaltyPointsBalance"
                  }
                },
                "example": {
                  "DKK": {
                    "points": 1250,
                    "last_modified": {
                      "_seconds": 1741958961,
                      "_nanoseconds": 565000000
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "description": "Not found. Returned with an empty body when the customer has no loyalty point balances."
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/customer/123456/loyalty_points?account=$KACHING_ACCOUNT\""
          }
        ]
      }
    },
    "/rest/customer/{customer_id}/loyalty_points/{currency}": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Get a customer's loyalty points in one currency",
        "operationId": "rest_customer_loyalty_points_get",
        "description": "Returns the customer's loyalty point balance in a single currency.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "customer_id",
            "in": "path",
            "required": true,
            "description": "The customer `identifier`.",
            "schema": {
              "type": "string"
            },
            "example": "123456"
          },
          {
            "name": "currency",
            "in": "path",
            "required": true,
            "description": "ISO 4217 currency code.",
            "schema": {
              "type": "string"
            },
            "example": "DKK"
          }
        ],
        "responses": {
          "200": {
            "description": "The balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoyaltyPointsBalance"
                },
                "example": {
                  "points": 1250,
                  "last_modified": {
                    "_seconds": 1741958961,
                    "_nanoseconds": 565000000
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "description": "Not found. Returned with an empty body when the customer has no balance in that currency."
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/customer/123456/loyalty_points/DKK?account=$KACHING_ACCOUNT\""
          }
        ]
      }
    },
    "/rest/product/{product_id}": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Get a product",
        "operationId": "rest_product_get",
        "description": "Returns a product as it is used on the POS in the given market.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "description": "The product `id`.",
            "schema": {
              "type": "string"
            },
            "example": "0001"
          },
          {
            "name": "market",
            "in": "query",
            "required": false,
            "description": "The market to read products from. Defaults to `dk`.",
            "schema": {
              "type": "string",
              "default": "dk"
            },
            "example": "dk"
          }
        ],
        "responses": {
          "200": {
            "description": "The product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductLookup"
                },
                "example": {
                  "id": "0001",
                  "name": "Coffee",
                  "retail_price": 25,
                  "barcode": "5701234567890"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "description": "Not found. Returned with an empty body when the product does not exist in the market or is archived."
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/product/0001?account=$KACHING_ACCOUNT&market=dk\""
          }
        ]
      }
    },
    "/rest/products": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Find products",
        "operationId": "rest_products_find",
        "description": "Finds products in a market, either by barcode or by free-text search. Archived products are not returned. One of `barcode` or `search` is required; if both are given, `barcode` is used.\n\n- `barcode` matches the barcodes of the product exactly (case sensitive). By default only the first match is returned; use `limit` to get more.\n- `search` matches the product name and other text fields, and also looks up a single-word term as a barcode or product `id`. At most 25 products are returned.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "barcode",
            "in": "query",
            "required": false,
            "description": "Barcode to look up.",
            "schema": {
              "type": "string"
            },
            "example": "5701234567890"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Search term. Must contain a word of at least 3 characters to give results.",
            "schema": {
              "type": "string"
            },
            "example": "coffee"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of products to return for a `barcode` lookup. Values above 100 are capped at 100. Ignored for `search`.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 1
            }
          },
          {
            "name": "market",
            "in": "query",
            "required": false,
            "description": "The market to read products from. Defaults to `dk`.",
            "schema": {
              "type": "string",
              "default": "dk"
            },
            "example": "dk"
          }
        ],
        "responses": {
          "200": {
            "description": "The matching products. An empty array if there are none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProductLookup"
                  }
                },
                "example": [
                  {
                    "id": "0001",
                    "name": "Coffee",
                    "retail_price": 25,
                    "barcode": "5701234567890"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Neither `barcode` nor `search` was given, or `limit` is not a positive integer.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "Missing 'barcode' or 'search'"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/products?account=$KACHING_ACCOUNT&market=dk&search=coffee\""
          }
        ]
      }
    },
    "/rest/product_assets/{product_id}": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Get product assets",
        "operationId": "rest_product_assets_get",
        "description": "Returns the assets (images, documents, videos) imported for a product through the [product assets import](https://developers.ka-ching.dk/product-assets-import-integration/).\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "description": "The product `id`.",
            "schema": {
              "type": "string"
            },
            "example": "0001"
          }
        ],
        "responses": {
          "200": {
            "description": "The product's assets. An empty array if there are none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProductAsset"
                  }
                },
                "example": [
                  {
                    "mime_type": "image/jpeg",
                    "url": "https://example.com/images/coffee.jpg",
                    "name": {
                      "en": "Front",
                      "da": "Forside"
                    }
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/product_assets/0001?account=$KACHING_ACCOUNT\""
          }
        ]
      }
    },
    "/rest/receipts/register_close_statement/{id}": {
      "get": {
        "tags": [
          "Receipts"
        ],
        "summary": "Get a register close statement receipt",
        "operationId": "rest_receipt_register_close_statement",
        "description": "Renders the receipt (Z report) for a register close statement as HTML or PDF.\n\nThe statement identifier is the same as in the *Register close statement created* webhook.\n\nRequires a REST API key for the account, passed in the `X-API-Key` header or the `apikey` query parameter. REST API keys are created in the Ka-ching back office and are separate from import integration keys.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Account"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The register close statement identifier.",
            "schema": {
              "type": "string"
            },
            "example": "-NqL3x9Zk2mQ8vR1aB7c"
          },
          {
            "name": "shop",
            "in": "query",
            "required": true,
            "description": "The shop the register belongs to.",
            "schema": {
              "type": "string"
            },
            "example": "-KxZjfwFLw93B2te1Ie9"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Output format.",
            "schema": {
              "type": "string",
              "enum": [
                "html",
                "pdf"
              ],
              "default": "html"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rendered receipt. PDFs are sent as an attachment named `z-report.pdf`.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "`shop` is missing or empty, or `format` is not `html` or `pdf`.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "Missing 'shop'"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/RESTResponse401"
          },
          "404": {
            "description": "Not found. Returned with an empty body when the statement does not exist in the given shop."
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "source": "curl -H \"X-API-Key: $KACHING_API_KEY\" \\\n  \"https://europe-west1-ka-ching-base.cloudfunctions.net/rest/receipts/register_close_statement/-NqL3x9Zk2mQ8vR1aB7c?account=$KACHING_ACCOUNT&shop=-KxZjfwFLw93B2te1Ie9&format=pdf\""
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Query-parameter": {
        "type": "apiKey",
        "in": "query",
        "name": "apikey"
      },
      "X-API-Key": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Sale": {
        "type": "object",
        "required": [
          "base_currency_code",
          "identifier",
          "checkout_identifier",
          "sequence_number",
          "summary",
          "timing",
          "voided"
        ],
        "properties": {
          "base_currency_code": {
            "type": "string",
            "description": "The currency code for the sale in ISO 4217 standard"
          },
          "identifier": {
            "type": "string",
            "description": "A globally unique identifier for the sale"
          },
          "checkout_identifier": {
            "type": "string",
            "description": "A globally unique identifier for the checkout that this sale was part of. See discussion about the difference between Sales and Checkouts."
          },
          "sequence_number": {
            "type": "number",
            "description": "A sequence number managed by the cash register. Only unique for sales from a specific register"
          },
          "formatted_sequence_number": {
            "type": "string",
            "description": "An optional formatted version of the sequence number. It will be present if configured for the account. It can display a sequence number like \"REG1-0000012\" rather than as the number 12"
          },
          "voided": {
            "type": "boolean",
            "description": "If 'true', then this sale was abandoned / voided. It is still present since a voided sale may represent payment transactions (sale partially paid with card, then voided and the payment refunded with cash)"
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            },
            "description": "An array of payment transaction entries. If there are no payments, this property may not be present"
          },
          "receipt_metadata": {
            "$ref": "#/components/schemas/ReceiptMetadata",
            "description": "Values that are not part of the sale, but required to generate the a receipt for the sale"
          },
          "source": {
            "$ref": "#/components/schemas/Source",
            "description": "The source of the sale (shop, register, cashier)"
          },
          "summary": {
            "$ref": "#/components/schemas/BasketSummary",
            "description": "The summary of the basket that was sold"
          },
          "timing": {
            "$ref": "#/components/schemas/Timing",
            "description": "Timing metadata with a bit of redundancy, so it can be viewed either as a time stamp or as a time in the local timezone for bucketing purposes"
          },
          "fiscal_rules_data": {
            "$ref": "#/components/schemas/FiscalRulesData",
            "description": "If sale was made in a market where fiscal rules apply, any data for complying with fiscalization rules are represented here."
          }
        }
      },
      "Checkout": {
        "type": "object",
        "required": [
          "identifier",
          "sales",
          "source",
          "timing",
          "voided"
        ],
        "properties": {
          "identifier": {
            "type": "string",
            "description": "A globally unique identifier for the checkout"
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            },
            "description": "An array of payment transaction entries. If there are no payments, this property may not be present"
          },
          "sales": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalePart"
            },
            "description": "An array of individual sale entries. A checkout including sale of goods and return of items from two prior sales will have three 'sales' entries"
          },
          "receipt_metadata": {
            "$ref": "#/components/schemas/ReceiptMetadata",
            "description": "Values that are not part of the sale, but required to generate the a receipt for the sale"
          },
          "source": {
            "$ref": "#/components/schemas/Source",
            "description": "The source of the sale (shop, register, cashier)"
          },
          "timing": {
            "$ref": "#/components/schemas/Timing",
            "description": "Timing metadata with a bit of redundancy, so it can be viewed either as a time stamp or as a time in the local timezone for bucketing purposes"
          },
          "voided": {
            "type": "boolean",
            "description": "If 'true', then this checkout was abandoned / voided. It is still present since a voided checkout may represent payment transactions (checkout partially paid with card, then voided and the payment refunded with cash)"
          }
        }
      },
      "DepositBoxReconciliation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "reconciliations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reconciliation"
            }
          },
          "shop_info": {
            "$ref": "#/components/schemas/ShopInfo"
          },
          "source": {
            "$ref": "#/components/schemas/SourceInfo"
          },
          "timestamp": {
            "type": "number",
            "description": "Unix timestamp with fractional seconds"
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DepositTransaction"
            }
          }
        },
        "required": [
          "id",
          "timestamp"
        ]
      },
      "RegisterCloseStatement": {
        "required": [
          "sequence_number",
          "source",
          "base_currency_code",
          "timing",
          "register_summary"
        ],
        "properties": {
          "shop_info": {
            "$ref": "#/components/schemas/ShopInfo"
          },
          "source": {
            "$ref": "#/components/schemas/SourceInfo"
          },
          "base_currency_code": {
            "type": "string"
          },
          "timing": {
            "$ref": "#/components/schemas/Timing"
          },
          "reconciliations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reconciliation"
            }
          },
          "sequence_number": {
            "type": "integer"
          },
          "comment": {
            "type": "string"
          },
          "register_summary": {
            "$ref": "#/components/schemas/RegisterSummary"
          }
        }
      },
      "Customer": {
        "type": "object",
        "required": [
          "identifier"
        ],
        "properties": {
          "identifier": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "street": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "additional_info": {
            "type": "string"
          },
          "organization_number": {
            "type": "string"
          },
          "balance": {
            "type": "number"
          },
          "balance_overdue": {
            "type": "number"
          },
          "credit_limit": {
            "type": "number"
          },
          "block_sales": {
            "type": "boolean"
          },
          "attributes": {
            "type": "object"
          }
        }
      },
      "CustomerImport": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Customer"
        }
      },
      "Success": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "success_count": {
            "type": "number"
          },
          "success_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "SuccessWithError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "success_count": {
            "type": "number"
          },
          "success_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "failure_count": {
            "type": "number"
          },
          "failure_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "failure_count": {
            "type": "number"
          },
          "failure_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "LoyaltyPointsEvent": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
          "customer_id": {
            "type": "string"
          },
          "currency_code": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "source": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "checkout_identifier": {
                "type": "string"
              },
              "sale_identifier": {
                "type": "string"
              },
              "external_reference": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "oneOf": [
              {
                "properties": {
                  "type": {
                    "enum": [
                      "checkout"
                    ]
                  },
                  "checkout_identifier": {
                    "type": "string"
                  },
                  "sale_identifier": {
                    "type": "string"
                  },
                  "shop_id": {
                    "type": "string"
                  }
                }
              },
              {
                "properties": {
                  "type": {
                    "enum": [
                      "external"
                    ]
                  },
                  "external_reference": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "customer_id",
          "currency_code",
          "type",
          "source"
        ],
        "oneOf": [
          {
            "properties": {
              "type": {
                "enum": [
                  "earned",
                  "spent",
                  "return_earned",
                  "return_spent",
                  "cover_negative_balance"
                ]
              },
              "adjustment": {
                "type": "number"
              }
            }
          },
          {
            "properties": {
              "type": {
                "enum": [
                  "overwrite"
                ]
              },
              "overwrite": {
                "type": "number"
              }
            }
          }
        ]
      },
      "LoyaltyPointEventsImport": {
        "type": "object",
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LoyaltyPointsEvent"
            }
          }
        }
      },
      "Timing": {
        "type": "object",
        "required": [
          "timestamp",
          "timestamp_string",
          "timezone",
          "timestamp_date_string",
          "timestamp_week_string"
        ],
        "properties": {
          "timestamp": {
            "type": "number",
            "description": "Timestamp represented as the number of seconds since 'epoch' (1970-01-01) in UTC time zone"
          },
          "timestamp_string": {
            "type": "string",
            "description": "Timestamp in ISO 8601 in UTC time zone"
          },
          "timezone": {
            "type": "string",
            "description": "ISO 8601 timezone string"
          },
          "timestamp_date_string": {
            "type": "string",
            "description": "Time formatted as YYYY-MM-DD-HH-mm in local timezone"
          },
          "timestamp_week_string": {
            "type": "string",
            "description": "Week-year and week in local timezone. E.g. 2025-50"
          }
        }
      },
      "StatsSummary": {
        "type": "object",
        "description": "Aggregated key figures for a bucket of sales in a period. Amounts are in the base currency of the sales. Properties without any activity are left out.",
        "properties": {
          "count": {
            "type": "integer",
            "description": "Number of sales."
          },
          "item_count": {
            "type": "number",
            "description": "Total quantity of line items sold."
          },
          "customer_count": {
            "type": "integer",
            "description": "Number of sales with a customer attached."
          },
          "total": {
            "type": "number",
            "description": "Total amount including taxes."
          },
          "sub_total": {
            "type": "number",
            "description": "Sub total amount."
          },
          "base_price": {
            "type": "number",
            "description": "Amount excluding taxes."
          },
          "total_discounts": {
            "type": "number",
            "description": "Total amount of discounts given."
          },
          "total_tax_amount": {
            "type": "number",
            "description": "Total amount of taxes."
          },
          "vat_amount": {
            "type": "number",
            "description": "Amount of VAT."
          },
          "sales_tax_amount": {
            "type": "number",
            "description": "Amount of sales tax."
          },
          "margin": {
            "type": "number",
            "description": "Margin on the sold products."
          },
          "margin_total": {
            "type": "number",
            "description": "Total margin."
          },
          "payments": {
            "type": "object",
            "description": "Summary of the payments. Only present on stored buckets.",
            "properties": {
              "types": {
                "type": "object",
                "description": "Amount received per payment type (for instance `cash` or `card`).",
                "additionalProperties": {
                  "type": "number"
                }
              },
              "returns": {
                "type": "object",
                "description": "Amount refunded per payment type.",
                "additionalProperties": {
                  "type": "number"
                }
              },
              "foreign_currencies": {
                "type": "object",
                "description": "Amount received in foreign currencies, per currency code, in that currency.",
                "additionalProperties": {
                  "type": "number"
                }
              },
              "rounding": {
                "type": "number",
                "description": "Sum of cash rounding."
              },
              "cashback": {
                "type": "number",
                "description": "Sum of cash back paid out."
              },
              "transaction_count": {
                "type": "integer",
                "description": "Number of successful payment transactions."
              },
              "failed_transaction_count": {
                "type": "integer",
                "description": "Number of failed payment transactions."
              },
              "has_rounding_count": {
                "type": "integer",
                "description": "Number of sales with cash rounding."
              },
              "has_cashback_count": {
                "type": "integer",
                "description": "Number of sales with cash back."
              },
              "has_foreign_currencies_count": {
                "type": "integer",
                "description": "Number of sales paid (partly) in a foreign currency."
              }
            }
          },
          "last_activity": {
            "type": "object",
            "description": "The most recent activity in the bucket. Only present on stored buckets.",
            "properties": {
              "last_sale": {
                "$ref": "#/components/schemas/Timing"
              }
            }
          }
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "amount",
          "identifier",
          "payment_type",
          "success"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "description": "Amount in the base currency"
          },
          "foreign_currency": {
            "type": "string",
            "description": "If the transaction was made in a currency different from the base currency, then this holds the ISO 4217 currency code of the foreign currency"
          },
          "foreign_currency_amount": {
            "type": "number",
            "description": "The amount paid in the foreign currency, if applicable"
          },
          "identifier": {
            "type": "string",
            "description": "A unique identifier for the payment transaction"
          },
          "payment_type": {
            "type": "string",
            "description": "The identifier of the payment type used. Payment types uniquely identify which payment method was used ('cash', 'mobile_pay.integration', 'cash.s5', etc.)"
          },
          "success": {
            "type": "boolean",
            "description": "Whether the transaction was succesfull. Note that unsuccesfull transactions may be represented here in case they could be relevant for fraud detection. Like failed pin code entry attempts"
          },
          "error": {
            "type": "string",
            "description": "In case the payment failed, this contains an error description"
          },
          "metadata": {
            "type": "object",
            "description": "The metadata varies between payment types. For credit card payments, this will for instance contain raw data from the terminal as well as an identification of the card type used."
          },
          "receipts": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Some payment types produce a receipt document to print along with the receipt for the entire sale. If present, they are added here."
          },
          "surcharge_amount": {
            "type": "number",
            "description": "If the payment type added as surcharge to the transaction, then the surcharge amount is represented here."
          }
        }
      },
      "schemas-Customer": {
        "type": "object",
        "required": [
          "identifier"
        ],
        "properties": {
          "identifier": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "street": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "organization_number": {
            "type": "string"
          }
        }
      },
      "TaxSummary": {
        "type": "object",
        "required": [
          "amount",
          "rate",
          "name",
          "type",
          "source_amount"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "description": "The value of the applied tax"
          },
          "source_amount": {
            "type": "number",
            "description": "The value that the taxes were calculated from. It can be calculated from the rate and the amount - except when the rate is 0"
          },
          "rate": {
            "type": "number",
            "description": "The tax rate. 0.25 means 25%"
          },
          "name": {
            "type": "string",
            "description": "The common name used to refer to this tax"
          },
          "type": {
            "type": "string",
            "enum": [
              "vat",
              "sales_tax"
            ],
            "description": "VAT taxes are the ones that would be included on a price tag, and are also included in the basis for discount calculations. Sales taxes are not included in the price tag and would also not be included in discount calculations."
          }
        }
      },
      "L10nString": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "en": {
                "type": "string",
                "description": "English localization"
              },
              "da": {
                "type": "string",
                "description": "Danish localization"
              },
              "nb": {
                "type": "string",
                "description": "Norwegian localization"
              },
              "sv": {
                "type": "string",
                "description": "Swedish localization"
              }
            }
          }
        ]
      },
      "Dimension": {
        "type": "object",
        "required": [
          "id",
          "value"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/L10nString"
              }
            ]
          },
          "value": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "$ref": "#/components/schemas/L10nString"
                  }
                ]
              },
              "color": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "Discount": {
        "type": "object",
        "required": [
          "application",
          "id",
          "mode",
          "type"
        ],
        "properties": {
          "application": {
            "type": "object"
          },
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "object"
          },
          "name": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/L10nString"
              }
            ]
          },
          "trigger": {
            "type": "object"
          },
          "type": {
            "type": "object"
          }
        },
        "additionalProperties": true
      },
      "DiscountSummary": {
        "type": "object",
        "required": [
          "amount",
          "discount"
        ],
        "properties": {
          "amount": {
            "type": "number"
          },
          "discount": {
            "$ref": "#/components/schemas/Discount"
          }
        },
        "additionalProperties": false
      },
      "ShippingBehavior": {
        "type": "object",
        "properties": {
          "address": {
            "type": "object",
            "properties": {
              "city": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "country_code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "street": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "customer_info": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "method_id": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "GiftCardBehavior": {
        "type": "object",
        "required": [
          "code",
          "integration_id",
          "payment_type_id"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "integration_id": {
            "type": "string"
          },
          "payment_type_id": {
            "type": "string"
          },
          "report": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "additionalProperties": false
      },
      "VoucherBehavior": {
        "type": "object",
        "required": [
          "code",
          "integration_id",
          "payment_type_id"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "integration_id": {
            "type": "string"
          },
          "payment_type_id": {
            "type": "string"
          },
          "report": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "additionalProperties": false
      },
      "GiftCardUseBehavior": {
        "type": "object",
        "required": [
          "code",
          "integration_id",
          "payment_type_id"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "integration_id": {
            "type": "string"
          },
          "payment_type_id": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "VoucherUseBehavior": {
        "type": "object",
        "required": [
          "code",
          "integration_id",
          "payment_type_id"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "integration_id": {
            "type": "string"
          },
          "payment_type_id": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ExpenseBehavior": {
        "type": "object",
        "required": [
          "identifier",
          "image_urls"
        ],
        "properties": {
          "identifier": {
            "type": "string"
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "CustomerAccountDepositBehavior": {
        "type": "object",
        "required": [
          "customer_id",
          "payment_type_id"
        ],
        "properties": {
          "customer_id": {
            "type": "string"
          },
          "payment_type_id": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ContainerDepositBehavior": {
        "type": "object",
        "required": [
          "container_deposit"
        ],
        "properties": {
          "container_deposit": {
            "type": "object",
            "required": [
              "product_id",
              "tag",
              "rule_id",
              "parent_line_item_id"
            ],
            "properties": {
              "product_id": {
                "type": "string"
              },
              "tag": {
                "type": "string"
              },
              "rule_id": {
                "type": "string"
              },
              "parent_line_item_id": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "LineItemBehavior": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ShippingBehavior"
          },
          {
            "$ref": "#/components/schemas/GiftCardBehavior"
          },
          {
            "$ref": "#/components/schemas/VoucherBehavior"
          },
          {
            "$ref": "#/components/schemas/GiftCardUseBehavior"
          },
          {
            "$ref": "#/components/schemas/VoucherUseBehavior"
          },
          {
            "$ref": "#/components/schemas/ExpenseBehavior"
          },
          {
            "$ref": "#/components/schemas/CustomerAccountDepositBehavior"
          },
          {
            "$ref": "#/components/schemas/ContainerDepositBehavior"
          }
        ]
      },
      "LineItem": {
        "type": "object",
        "required": [
          "base_price",
          "line_item_id",
          "quantity",
          "retail_price",
          "sales_tax_amount",
          "sub_total",
          "total",
          "total_tax_amount",
          "vat_amount"
        ],
        "properties": {
          "barcode": {
            "type": "string"
          },
          "base_price": {
            "type": "number",
            "description": "The total amount for the line item, excluding any taxes"
          },
          "cost_price": {
            "type": "number",
            "description": "The total cost price of the line item."
          },
          "margin": {
            "type": "number",
            "description": "The coverage margin for the line item. Only present if product has a cost price"
          },
          "margin_total": {
            "type": "number",
            "description": "The base price - in case there is a margin present - value is not present otherwise"
          },
          "dimensions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Dimension"
            }
          },
          "discounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiscountSummary"
            }
          },
          "ecom_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Id of the product, if the line represents a product"
          },
          "image_url": {
            "type": "string"
          },
          "line_item_id": {
            "type": "string",
            "description": "A unique identifier for this line item"
          },
          "name": {
            "$ref": "#/components/schemas/L10nString"
          },
          "product_group": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "description": "The number of items represented by this line item"
          },
          "retail_price": {
            "type": "number",
            "description": "The retail price of this line item - before any discounts are applied"
          },
          "sales_tax_amount": {
            "type": "number",
            "description": "The total amount of taxes that are applied at the time of the sale (as opposed to 'vat_amount' which represents the taxes that are included in the prices shown to the customers on the products)"
          },
          "sub_total": {
            "type": "number",
            "description": "The sub total is the total including VAT taxes, but excluding sales taxes"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxSummary"
            },
            "description": "A list of all tax summaries for this line item. There will be one entry per tax applied. In Denmark, this would most often just mean a single entry of 25% VAT"
          },
          "total": {
            "type": "number",
            "description": "The total is the price of the line item after discounts are applied - including all taxes"
          },
          "total_tax_amount": {
            "type": "number",
            "description": "This is the sum of all taxes for this line item (sales_tax_amount + vat_amount)"
          },
          "variant_id": {
            "type": "string",
            "description": "The identifier for the variant in case the line item represents a variant product"
          },
          "vat_amount": {
            "type": "number",
            "description": "The total amount of taxes that would be included in the price on a price tag of the sold product (as opposed to 'sales_tax_amount' which represents the taxes that are applied at the time of the sale)"
          },
          "comment": {
            "type": "string"
          },
          "behavior": {
            "$ref": "#/components/schemas/LineItemBehavior"
          },
          "attributes": {
            "type": "object"
          }
        },
        "additionalProperties": false
      },
      "BasketSummary": {
        "type": "object",
        "required": [
          "base_price",
          "is_return",
          "sales_tax_amount",
          "sub_total",
          "taxes",
          "total",
          "total_discounts",
          "total_tax_amount",
          "vat_amount"
        ],
        "properties": {
          "base_price": {
            "type": "number",
            "description": "The total amount of the sale, excluding any taxes"
          },
          "comment": {
            "type": "string",
            "description": "An optional comment made by the cashier"
          },
          "customer": {
            "$ref": "#/components/schemas/schemas-Customer"
          },
          "is_return": {
            "type": "boolean",
            "description": "This 'sale' entity represents a return"
          },
          "return_reference": {
            "type": "string",
            "description": "In case of a return, this represents the id of the sale for which the return was made"
          },
          "purchase_type": {
            "type": "object",
            "required": [
              "name",
              "identifier"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "identifier": {
                "type": "string"
              }
            }
          },
          "margin": {
            "type": "number",
            "description": "The coverage margin for the sale. Can only be calculated for products that include a cost price"
          },
          "margin_total": {
            "type": "number",
            "description": "The total for line items on the sale where a cost price was present. 'margin' / 'margin_total' gives the coverage for the line items with a cost price. 'total' - 'margin_total' gives the total for the line items where no cost price was given, and thus can not be included in coverage calculation. If all line items have a cost price, then 'total' and 'margin_total' will be the same"
          },
          "sales_tax_amount": {
            "type": "number",
            "description": "The total amount of taxes that are applied at the time of the sale (as opposed to 'vat_amount' which represents the taxes that are included in the prices shown to the customers on the products)"
          },
          "sub_total": {
            "type": "number",
            "description": "The sub total is the total including VAT taxes, but excluding sales taxes"
          },
          "taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxSummary"
            },
            "description": "A list of all tax summaries for this sale. There will be one entry per tax applied. In Denmark, this would most often just mean a single entry of 25% VAT"
          },
          "total": {
            "type": "number",
            "description": "The total is the price of the sale including all taxes"
          },
          "total_discounts": {
            "type": "number",
            "description": "The total amount of discounts applied across this sale"
          },
          "total_tax_amount": {
            "type": "number",
            "description": "This is the sum of all taxes for this sale (sales_tax_amount + vat_amount)"
          },
          "vat_amount": {
            "type": "number",
            "description": "The total amount of taxes that would be included in the price on a price tag of the sold products (as opposed to 'sales_tax_amount' which represents the taxes that are applied at the time of the sale)"
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            },
            "description": "An array of line items included in the sale. May be empty in case the sale is purely transactional. For instance paying out an invoice using cash would result in a sale without line items, but with two transactions."
          }
        }
      },
      "SwedishFiscalRulesData": {
        "type": "object",
        "properties": {
          "cash_invoice": {
            "type": "object",
            "required": [
              "sequence_number"
            ],
            "properties": {
              "sequence_number": {
                "type": "number"
              }
            }
          },
          "registered_sale_data": {
            "type": "object",
            "required": [
              "control_code",
              "control_unit_id",
              "register_name",
              "sequence_number"
            ],
            "properties": {
              "sequence_number": {
                "type": "number"
              },
              "control_code": {
                "type": "string"
              },
              "control_unit_id": {
                "type": "string"
              },
              "register_name": {
                "type": "string"
              },
              "date_time": {
                "type": "string"
              }
            }
          }
        }
      },
      "NorwegianFiscalRulesData": {
        "type": "object",
        "required": [
          "no"
        ],
        "properties": {
          "no": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "FiscalRulesData": {
        "type": "object",
        "properties": {
          "se": {
            "$ref": "#/components/schemas/SwedishFiscalRulesData"
          },
          "no": {
            "$ref": "#/components/schemas/NorwegianFiscalRulesData"
          }
        }
      },
      "SalePart": {
        "type": "object",
        "required": [
          "identifier",
          "sequence_number",
          "basket"
        ],
        "properties": {
          "identifier": {
            "type": "string",
            "description": "A globally unique identifier for the sale"
          },
          "sequence_number": {
            "type": "number",
            "description": "A sequence number managed by the cash register. Only unique for sales from a specific register"
          },
          "formatted_sequence_number": {
            "type": "string",
            "description": "An optional formatted version of the sequence number. It will be present if configured for the account. It can display a sequence number like \"REG1-0000012\" rather than as the number 12"
          },
          "basket": {
            "$ref": "#/components/schemas/BasketSummary",
            "description": "The summary of the basket that was sold or returned"
          },
          "fiscal_rules_data": {
            "$ref": "#/components/schemas/FiscalRulesData",
            "description": "If sale was made in a market where fiscal rules apply, any data for complying with fiscalization rules are represented here."
          }
        }
      },
      "ReceiptMetadata": {
        "type": "object",
        "properties": {
          "footer": {
            "type": "string"
          },
          "header": {
            "type": "string"
          },
          "vat_number": {
            "type": "string"
          },
          "shop_address": {
            "type": "object",
            "properties": {
              "city": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "street": {
                "type": "string"
              },
              "zip": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              }
            }
          }
        }
      },
      "Source": {
        "type": "object",
        "properties": {
          "market_id": {
            "type": "string"
          },
          "market_name": {
            "type": "string"
          },
          "shop_id": {
            "type": "string"
          },
          "shop_name": {
            "type": "string"
          },
          "register_id": {
            "type": "string"
          },
          "register_name": {
            "type": "string"
          },
          "cashier_id": {
            "type": "string"
          },
          "cashier_name": {
            "type": "string"
          }
        }
      },
      "schemas-Checkout": {
        "type": "object",
        "required": [
          "identifier",
          "sales",
          "source",
          "timing",
          "voided"
        ],
        "properties": {
          "identifier": {
            "type": "string",
            "description": "A globally unique identifier for the checkout"
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            },
            "description": "An array of payment transaction entries. If there are no payments, this property may not be present"
          },
          "sales": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalePart"
            },
            "description": "An array of individual sale entries. A checkout including sale of goods and return of items from two prior sales will have three 'sales' entries"
          },
          "receipt_metadata": {
            "$ref": "#/components/schemas/ReceiptMetadata",
            "description": "Values that are not part of the sale, but required to generate the a receipt for the sale"
          },
          "source": {
            "$ref": "#/components/schemas/Source",
            "description": "The source of the sale (shop, register, cashier)"
          },
          "timing": {
            "$ref": "#/components/schemas/Timing",
            "description": "Timing metadata with a bit of redundancy, so it can be viewed either as a time stamp or as a time in the local timezone for bucketing purposes"
          },
          "voided": {
            "type": "boolean",
            "description": "If 'true', then this checkout was abandoned / voided. It is still present since a voided checkout may represent payment transactions (checkout partially paid with card, then voided and the payment refunded with cash)"
          }
        }
      },
      "CustomerLookup": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Customer"
          },
          {
            "type": "object",
            "properties": {
              "index": {
                "type": "object",
                "description": "Lower-cased copies of `email` and `name` used for searching.",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        ]
      },
      "FirestoreTimestamp": {
        "type": "object",
        "description": "A point in time.",
        "properties": {
          "_seconds": {
            "type": "integer",
            "description": "Seconds since 1970-01-01T00:00:00Z."
          },
          "_nanoseconds": {
            "type": "integer",
            "description": "Fraction of a second, in nanoseconds."
          }
        }
      },
      "LoyaltyPointsBalance": {
        "type": "object",
        "description": "A customer's loyalty point balance in one currency.",
        "properties": {
          "points": {
            "type": "number",
            "description": "Current number of points."
          },
          "shop_id": {
            "type": "string",
            "description": "The shop where points were last earned or spent, when the change came from a checkout."
          },
          "last_modified": {
            "$ref": "#/components/schemas/FirestoreTimestamp",
            "description": "When the balance last changed."
          }
        }
      },
      "ProductLookup": {
        "type": "object",
        "description": "A product. See the [Product model](https://developers.ka-ching.dk/models/) for all properties; only the most common are listed here.",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "description": "Name, either a string or localized per language code.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "retail_price": {
            "type": "number"
          },
          "barcode": {
            "type": "string"
          },
          "description": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "image_url": {
            "type": "string"
          }
        }
      },
      "ProductAsset": {
        "type": "object",
        "required": [
          "mime_type",
          "url"
        ],
        "properties": {
          "mime_type": {
            "type": "string",
            "example": "image/jpeg"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "name": {
            "description": "Name, either a string or localized per language code.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          }
        }
      },
      "Reconciliation": {
        "type": "object",
        "required": [
          "total",
          "depositing",
          "transaction_count",
          "payment_type_identifier",
          "currency_code"
        ],
        "properties": {
          "counted": {
            "type": "number"
          },
          "credit": {
            "type": "number"
          },
          "debit": {
            "type": "number"
          },
          "currency_code": {
            "type": "string"
          },
          "depositing": {
            "type": "string",
            "enum": [
              "none",
              "automatic",
              "manual"
            ]
          },
          "deposited_amount": {
            "type": "number"
          },
          "payment_type_identifier": {
            "type": "string"
          },
          "should_be_reconciled": {
            "type": "boolean"
          },
          "total": {
            "type": "number"
          },
          "base_currency_total": {
            "type": "number"
          },
          "transaction_count": {
            "type": "integer"
          },
          "transaction_count_credit": {
            "type": "integer"
          },
          "transaction_count_debit": {
            "type": "integer"
          },
          "recounts": {
            "type": "integer"
          },
          "comment": {
            "type": "string"
          }
        }
      },
      "ShopAddress": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "street": {
            "type": "string"
          },
          "zip": {
            "type": "string"
          }
        }
      },
      "ShopInfo": {
        "type": "object",
        "properties": {
          "shop_address": {
            "$ref": "#/components/schemas/ShopAddress"
          },
          "vat_number": {
            "type": "string"
          }
        }
      },
      "SourceInfo": {
        "type": "object",
        "properties": {
          "build_number": {
            "type": "string"
          },
          "bundle_id": {
            "type": "string"
          },
          "cashier_full_name": {
            "type": "string"
          },
          "cashier_id": {
            "type": "string"
          },
          "cashier_name": {
            "type": "string"
          },
          "market_id": {
            "type": "string"
          },
          "market_name": {
            "type": "string"
          },
          "register_id": {
            "type": "string"
          },
          "register_name": {
            "type": "string"
          },
          "shop_id": {
            "type": "string"
          },
          "shop_name": {
            "type": "string"
          },
          "version_number": {
            "type": "string"
          }
        }
      },
      "RegisterEntry": {
        "type": "object",
        "properties": {
          "counter_transaction_id": {
            "type": "string"
          },
          "identifier": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "DepositTransaction": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number"
          },
          "comment": {
            "type": "string"
          },
          "cashier_id": {
            "type": "string"
          },
          "cashier_name": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/SourceInfo"
          },
          "timestamp": {
            "type": "number"
          },
          "type": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "reconciliation": {
                    "type": "boolean",
                    "enum": true
                  }
                },
                "required": [
                  "reconciliation"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "from_register_close": {
                    "$ref": "#/components/schemas/RegisterEntry"
                  }
                },
                "required": [
                  "from_register_close"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "from_register": {
                    "$ref": "#/components/schemas/RegisterEntry"
                  }
                },
                "required": [
                  "from_register"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "to_register": {
                    "$ref": "#/components/schemas/RegisterEntry"
                  }
                },
                "required": [
                  "to_register"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "to_bank": {
                    "type": "boolean",
                    "enum": true
                  }
                },
                "required": [
                  "to_bank"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "from_bank": {
                    "type": "boolean",
                    "enum": true
                  }
                },
                "required": [
                  "from_bank"
                ]
              }
            ]
          }
        },
        "required": [
          "amount",
          "currency",
          "id",
          "timestamp",
          "type"
        ]
      },
      "TransactionCardTypeAggregate": {
        "type": "object",
        "required": [
          "count",
          "total"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "total": {
            "type": "number"
          },
          "foreign_currency_total": {
            "type": "number"
          }
        }
      },
      "TransactionCurrencyAggregate": {
        "type": "object",
        "required": [
          "count",
          "total"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "total": {
            "type": "number"
          },
          "foreign_currency_total": {
            "type": "number"
          },
          "by_card_type": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/TransactionCardTypeAggregate"
            }
          }
        }
      },
      "TransactionTotalAggregate": {
        "type": "object",
        "required": [
          "count",
          "total"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "total": {
            "type": "number"
          },
          "by_currency": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/TransactionCurrencyAggregate"
            }
          }
        }
      },
      "TransactionAggregate": {
        "type": "object",
        "required": [
          "all"
        ],
        "properties": {
          "all": {
            "$ref": "#/components/schemas/TransactionTotalAggregate"
          },
          "debit": {
            "$ref": "#/components/schemas/TransactionTotalAggregate"
          },
          "credit": {
            "$ref": "#/components/schemas/TransactionTotalAggregate"
          }
        }
      },
      "ExpenseAggregate": {
        "type": "object",
        "required": [
          "count",
          "item_count",
          "total",
          "sub_total",
          "base_price",
          "total_tax_amount"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "item_count": {
            "type": "integer"
          },
          "total": {
            "type": "number"
          },
          "sub_total": {
            "type": "number"
          },
          "base_price": {
            "type": "number"
          },
          "total_tax_amount": {
            "type": "number"
          },
          "vat_amount": {
            "type": "number"
          },
          "sales_tax_amount": {
            "type": "number"
          },
          "tax_summaries": {
            "type": "array",
            "item": {
              "$ref": "Sale.json#/components/schemas/TaxSummary"
            }
          }
        }
      },
      "SalesAggregate": {
        "type": "object",
        "description": "Unified aggregate summary used for sales, returns, expenses, special items, and other register aggregates.",
        "required": [
          "base_price",
          "count",
          "item_count",
          "sub_total",
          "total",
          "total_tax_amount"
        ],
        "properties": {
          "base_price": {
            "type": "number",
            "description": "Total base price before tax."
          },
          "count": {
            "type": "integer",
            "description": "Number of transactions in this aggregate."
          },
          "item_count": {
            "type": "integer",
            "description": "Number of items involved in this aggregate."
          },
          "sub_total": {
            "type": "number",
            "description": "Subtotal before sales tax."
          },
          "total": {
            "type": "number",
            "description": "Final total after tax."
          },
          "total_discounts": {
            "type": "number",
            "description": "Total amount of discounts applied."
          },
          "total_manual_discounts": {
            "type": "number",
            "description": "Total amount of manually applied discounts."
          },
          "spent_loyalty_points": {
            "type": "number",
            "description": "Total amount of spent loyalty points."
          },
          "earned_loyalty_points": {
            "type": "number",
            "description": "Total amount of earned loyalty points."
          },
          "total_manual_discounts_count": {
            "type": "integer",
            "description": "Number of manual discounts applied."
          },
          "total_tax_amount": {
            "type": "number",
            "description": "Total tax collected for this aggregate."
          },
          "margin": {
            "type": "number",
            "description": "Base price minus cost price - if cost prices are used"
          },
          "margin_total": {
            "type": "number",
            "description": "Sum of base price for all items that include cost price. The value to benchmark against if you want to calculate coverage"
          },
          "vat_amount": {
            "type": "number",
            "description": "Total VAT amount "
          },
          "tax_summaries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxSummary"
            },
            "description": "Tax summaries included in the aggregate."
          },
          "transactions": {
            "type": "array",
            "items": {
              "type": "object",
              "requred": [
                "type",
                "totals"
              ],
              "properties": {
                "type": {
                  "type": "string"
                },
                "totals": {
                  "$ref": "#/components/schemas/TransactionAggregate"
                }
              }
            },
            "description": "Transaction aggregates"
          },
          "expenses_by_id": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/ExpenseAggregate"
            },
            "description": "Expense aggregates keyed by expense id"
          }
        }
      },
      "RegisterSummary": {
        "type": "object",
        "description": "Summary of sales, returns, payments, and operational data for a register close operation.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "opened_at": {
            "type": "number",
            "description": "Unix timestamp with fractional seconds"
          },
          "sales": {
            "$ref": "#/components/schemas/SalesAggregate"
          },
          "returns": {
            "$ref": "#/components/schemas/SalesAggregate"
          },
          "all": {
            "$ref": "#/components/schemas/SalesAggregate"
          },
          "expenses": {
            "$ref": "#/components/schemas/SalesAggregate"
          },
          "voided": {
            "$ref": "#/components/schemas/SalesAggregate"
          },
          "order_fulfillments": {
            "$ref": "#/components/schemas/SalesAggregate"
          },
          "order_placements": {
            "$ref": "#/components/schemas/SalesAggregate"
          },
          "special_items": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/SalesAggregate"
            }
          }
        },
        "required": [
          "id",
          "opened_at",
          "sales",
          "returns",
          "all"
        ]
      }
    },
    "parameters": {
      "Account": {
        "name": "account",
        "in": "query",
        "schema": {
          "type": "string"
        },
        "required": true
      },
      "Integration": {
        "name": "integration",
        "in": "query",
        "schema": {
          "type": "string"
        },
        "required": true
      },
      "StatsTimeResolution": {
        "name": "time_resolution",
        "in": "path",
        "required": true,
        "description": "The length of the period to summarize.",
        "schema": {
          "type": "string",
          "enum": [
            "hour",
            "day",
            "week",
            "month",
            "year"
          ]
        },
        "example": "day"
      },
      "StatsTimeValue": {
        "name": "time_value",
        "in": "path",
        "required": true,
        "description": "The period to summarize, in the local time zone of the shop where the sales were made. The format depends on `time_resolution`:\n\n| `time_resolution` | Format | Example |\n|---|---|---|\n| `hour` | `YYYY-MM-DD-HH` | `2025-03-14-13` |\n| `day` | `YYYY-MM-DD` | `2025-03-14` |\n| `week` | `GGGG-WW` (ISO 8601 week-year and week number) | `2025-11` |\n| `month` | `YYYY-MM` | `2025-03` |\n| `year` | `YYYY` | `2025` |",
        "schema": {
          "type": "string"
        },
        "example": "2025-03-14"
      },
      "StatsBucket": {
        "name": "bucket",
        "in": "path",
        "required": true,
        "description": "The bucket of sales to summarize.\n\nStored buckets:\n\n- `all`: Sales and returns combined. Order fulfillments are not included.\n- `expenses`: Expenses registered on the POS.\n- `order_fulfillments`: Hand-outs of orders that were paid elsewhere (for instance in a web shop).\n\nCalculated buckets:\n\n- `sales`: Sales, excluding the sale and use of gift cards and vouchers.\n- `returns`: Returns, excluding the sale and use of gift cards and vouchers.\n- `revenue`: Sales and returns combined, excluding the sale and use of gift cards and vouchers.\n\nCalculated buckets only contain the key figures (no `payments` or `last_activity`). Additional calculated buckets can be configured for an account by Ka-ching; ask your Ka-ching contact if you need a different definition.",
        "schema": {
          "type": "string",
          "examples": [
            "all",
            "expenses",
            "order_fulfillments",
            "sales",
            "returns",
            "revenue"
          ]
        },
        "example": "revenue"
      }
    },
    "responses": {
      "Response200OneOf": {
        "description": "Success response",
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/Success",
                  "example": {
                    "status": "OK",
                    "message": "Import of 2 customer value(s) initiated.",
                    "success_count": 2,
                    "success_keys": [
                      "123456",
                      "987654"
                    ]
                  }
                },
                {
                  "$ref": "#/components/schemas/SuccessWithError",
                  "example": {
                    "status": "Warning",
                    "message": "Import of 1 customer value(s) initiated. Import of 1 customer values(s) failed. Error messages: Error: Missing 'customer'",
                    "success_count": 1,
                    "success_keys": [
                      "432432423"
                    ],
                    "failure_count": 1,
                    "failure_keys": []
                  }
                }
              ]
            }
          }
        }
      },
      "Response400": {
        "description": "Error response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RESTResponse401": {
        "description": "Unauthorized. The `account` query parameter or the API key is missing, or the API key is not an active REST API key for the account.",
        "content": {
          "text/plain": {
            "schema": {
              "type": "string"
            },
            "example": "Unauthorized - API key not active"
          }
        }
      },
      "StatsResponse404": {
        "description": "Not found. Returned with an empty body when there are no stats for the requested source, period and bucket, when the bucket is unknown, or when the path is malformed."
      }
    }
  },
  "security": [
    {
      "Query-parameter": []
    },
    {
      "X-API-Key": []
    }
  ],
  "tags": [
    {
      "name": "Imports",
      "description": "Import data into Ka-ching. See the [import integrations overview](https://developers.ka-ching.dk/import-integrations-overview/) for all import types."
    },
    {
      "name": "Checkouts",
      "description": "Read checkouts (completed baskets, each with one or more sales) made on the POS."
    },
    {
      "name": "Customers",
      "description": "Read customers and their loyalty point balances."
    },
    {
      "name": "Products",
      "description": "Look up and search products and their assets."
    },
    {
      "name": "Receipts",
      "description": "Render receipts as HTML or PDF."
    },
    {
      "name": "Stats",
      "description": "Read aggregated sales statistics per market or shop. These are the same figures that are shown in Insights."
    }
  ]
}