{
  "openapi": "3.1.0",
  "info": {
    "title": "n4p",
    "version": "v1",
    "description": "Open, machine-first index of objective business facts. Reads are free. The n4p compilation and OSM-derived content are licensed ODbL-1.0; register, address and transit facts remain subject to their source terms and are listed in the rights object of each record and at /v1/sources. There are no reviews, ratings or opinions. Every fact carries its source, the verification method, the verification time and a confidence level. Owner endpoints require a session token from POST /v1/auth/verify. Agents cannot write facts: there is no machine credential that grants a write. Signatures are Ed25519 over RFC 8785 canonical JSON; the published keys are at /.well-known/n4p-keys.json. n4p is not an official register extract and has no legal effect. A record's claim_url, when present, is where a human claims it or corrects it; no agent can write a fact through it, and no client can add a business that is absent from the index.",
    "license": {
      "name": "ODbL-1.0",
      "identifier": "ODbL-1.0",
      "url": "https://opendatacommons.org/licenses/odbl/1-0/",
      "x-scope": "n4p compilation and OSM-derived content"
    },
    "contact": {
      "name": "n4p",
      "url": "https://n4p.example"
    }
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "tags": [
    {
      "name": "meta",
      "description": "Discovery, health and schema documents"
    },
    {
      "name": "read",
      "description": "Open read endpoints"
    },
    {
      "name": "owner",
      "description": "Endpoints for a signed-in business owner"
    }
  ],
  "paths": {
    "/healthz": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Liveness and database readiness",
        "operationId": "healthz",
        "responses": {
          "200": {
            "description": "The service and its database are reachable"
          },
          "503": {
            "description": "The database is not reachable, or this instance is shutting down"
          }
        }
      }
    },
    "/.well-known/n4p.json": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Machine discovery manifest",
        "description": "The entry point for an agent that has found only one URL. Points at the OpenAPI document, the agent guide, the change feed and the licence.",
        "operationId": "manifest",
        "responses": {
          "200": {
            "description": "The manifest"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "OpenAPI 3.1 description of this API",
        "operationId": "openapi",
        "responses": {
          "200": {
            "description": "This document"
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Plain-text guide for language-model agents",
        "operationId": "llmsTxt",
        "responses": {
          "200": {
            "description": "The guide",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/search": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Search businesses",
        "description": "Filters combine with AND. When `near` is given, results are ordered by distance and each item carries `distance_m`. Otherwise, when `q` is given, results are ordered by name similarity. Otherwise results are ordered by business_id. Merged records are never returned.",
        "operationId": "searchBusinesses",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "A name, or a record id (biz_…, a merged id answers with its survivor) or a Swiss UID (CHE-123.456.789 or CHE123456789), which return that record directly and ignore the other filters. A whole-word name match ranks higher.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Filter on a category. Either a business type as an OSM tag (`shop=bakery`, `amenity=cafe`, `craft=plumber`, `office=lawyer`, `leisure=fitness_centre`, `cuisine=pizza`), or a plain word in English, German, French or Italian (`bakery`, `Bäckerei`, `boulangerie`, `panetteria`, `pizza`), which is resolved through the vocabulary at `/v1/categories`. Repeat to require several categories at once (AND). One word can cover several tags, such as `pharmacy` matching `amenity=pharmacy`, `healthcare=pharmacy` and `shop=chemist`. A category is a shop, venue, trade or professional office: `office=it` covers IT, software and web companies, and `office=notary`, `office=tax_advisor` and `office=translator` exist too. These are OSM tags, not the Swiss NOGA classification, which is not used for filtering because per-business codes are not published; a record with no published category cannot be matched by one.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "examples": {
              "tag": {
                "value": "shop=bakery"
              },
              "french": {
                "value": "boulangerie"
              }
            }
          },
          {
            "name": "attribute",
            "in": "query",
            "description": "Require an accessibility, service or dietary attribute, as an exact OSM tag from the closed vocabulary: `wheelchair=yes`, `wheelchair=limited`, `outdoor_seating=yes`, `takeaway=yes`, `dog=leashed`, `diet:vegan=only`, `payment:cards=yes`. Repeat to require several (AND). An unknown key or value is a 400, not an empty result.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "examples": {
              "accessible": {
                "value": "wheelchair=yes"
              },
              "outside": {
                "value": "outdoor_seating=yes"
              }
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Operating status. Omitted means `active` and `temporarily_closed` only. Use `any` to disable the filter.",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "temporarily_closed",
                "in_liquidation",
                "closed",
                "any"
              ]
            }
          },
          {
            "name": "country",
            "in": "query",
            "description": "ISO 3166-1 alpha-2 country code.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locality",
            "in": "query",
            "description": "Filter on the address town or city, case-insensitively. For example `Winterthur`. This is a plain filter and does not order by distance; call `/v1/places` first when the caller wants the nearest results.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "postal_code",
            "in": "query",
            "description": "Filter on the address postcode, ignoring spaces. For example `8400`. This is a plain filter and does not order by distance; call `/v1/places` first when the caller wants the nearest results.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "near",
            "in": "query",
            "description": "Centre point as `lat,lon` in WGS84 decimal degrees.",
            "schema": {
              "type": "string",
              "pattern": "^-?[0-9.]+,-?[0-9.]+$"
            }
          },
          {
            "name": "radius_km",
            "in": "query",
            "description": "Radius around `near`. Default 1, clamped to at most 50.",
            "schema": {
              "type": "number",
              "default": 1,
              "maximum": 50
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size.",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque cursor from a previous response's `next_cursor`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "open_now",
            "in": "query",
            "description": "Keep only businesses open at `at`, or now. Opening hours are evaluated in each business's own timezone. A business whose hours are missing or unparseable is excluded unless a `special_hours` entry covers that date, because it cannot otherwise be shown to be open.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "at",
            "in": "query",
            "description": "RFC 3339 timestamp at which to evaluate opening hours. Defaults to now.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "record_confidence",
            "in": "query",
            "description": "Filter on the record's confidence, which is the weakest confidence among its present identity core fields (name, address, categories, status, hours). `verified` means every present one is verified; `self_reported` means the weakest present value is owner-stated; `unverified` means the weakest present value is third-party or machine-derived. A missing field does not lower this value: absence is reported by `record_completeness`, not by confidence. Geo is judged per-fact and does not lower the record. Unverified is not wrong, it is unconfirmed.",
            "schema": {
              "type": "string",
              "enum": [
                "verified",
                "self_reported",
                "unverified",
                "any"
              ]
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "description": "`true` keeps only records whose core fields are all present and inside their freshness windows. `false` keeps the rest, including incomplete records, which can never be fresh.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "has_field",
            "in": "query",
            "description": "Require a field to be present. Repeat to require several (AND). Known fields: name, legal_name, alternate_names, address, geo, categories, status, hours, legal_form, purpose, website, phone, menu, menu_url, attributes, transit, description, email, booking_url, service_area, special_hours. An unknown field is a 400, not an empty result.",
            "schema": {
              "type": "string"
            },
            "example": "hours"
          },
          {
            "name": "fields",
            "in": "query",
            "description": "Return only these facts, comma separated, for example `fields=name,hours`. Cheaper when you pay per token. It changes which keys are present, never their shape. Derived values follow their source field: `hours_week` and `open_now` need `hours`, and `hours` also returns `special_hours`, `menu_summary` needs `menu`, `legal_form_detail` needs `legal_form`. Identifiers, status, record_confidence, record_completeness, missing_core_fields, claim_status, claim_url, freshness, stale and the licence are always returned. An unknown field is a 400.",
            "schema": {
              "type": "string"
            },
            "example": "name,hours"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SearchItem"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "license": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/v1/places": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Resolve a town or postcode to coordinates",
        "description": "Turns \"Winterthur\" or \"8400\" into a search centre so a caller can run a distance search without already having a map pin. The coordinates are the address-weighted mean of the official swisstopo building addresses in that locality, restricted to the postcode when one is given. This is a local lookup in the directory the deployment already holds for geocoding; there is no external geocoding provider. Locality matching ignores case and accents and tolerates a prefix or a misspelling, so `Zurich` finds `Zürich`.\n\nPass an item's `lat` and `lon` to `/v1/search` as `near=lat,lon`. Locality names are not unique nationally, so `Buchs` returns one item per canton; ask the user which one is meant if the canton matters.",
        "operationId": "findPlaces",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "A town or city name, or a four- or five-digit postcode. A bare number is treated as a postcode.",
            "schema": {
              "type": "string"
            },
            "example": "Winterthur"
          },
          {
            "name": "locality",
            "in": "query",
            "description": "The town or city name when it is known separately from the postcode.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "postal_code",
            "in": "query",
            "description": "A postcode when it is known separately from the town. Spaces are ignored.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of candidate centres. Default 10, clamped to at most 20.",
            "schema": {
              "type": "integer",
              "default": 10,
              "maximum": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Candidate search centres, best first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Place"
                      }
                    },
                    "license": {
                      "type": "string"
                    },
                    "rights": {
                      "$ref": "#/components/schemas/Rights"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/v1/businesses/{business_id}": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Full record with per-field provenance",
        "description": "Returns the winning value for every field together with the source that won. Set `include=observations` to also return every competing observation.",
        "operationId": "getBusiness",
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "include",
            "in": "query",
            "description": "Set to `observations` to include every observation for every field.",
            "schema": {
              "type": "string",
              "enum": [
                "observations"
              ]
            }
          },
          {
            "name": "at",
            "in": "query",
            "description": "RFC 3339 timestamp at which to evaluate `open_now`. Defaults to now.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "Return only these facts, comma separated, for example `fields=name,hours`. Cheaper when you pay per token. It changes which keys are present, never their shape. Derived values follow their source field: `hours_week` and `open_now` need `hours`, and `hours` also returns `special_hours`, `menu_summary` needs `menu`, `legal_form_detail` needs `legal_form`. Identifiers, status, record_confidence, record_completeness, missing_core_fields, claim_status, claim_url, freshness, stale and the licence are always returned. An unknown field is a 400.",
            "schema": {
              "type": "string"
            },
            "example": "name,hours"
          }
        ],
        "responses": {
          "200": {
            "description": "The record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "301": {
            "description": "The record was merged. The response names the surviving record in `merged_into` and in the Location header."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/lookup": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Resolve an external identifier to records",
        "description": "Values are normalised before the lookup, so `CHE-231.799.096` and `CHE231799096` are the same identifier. Strict schemes return at most one record; weak schemes such as `domain` may return several because branches of one chain share them.",
        "operationId": "lookupByIdentifier",
        "parameters": [
          {
            "name": "scheme",
            "in": "query",
            "required": true,
            "description": "Identifier scheme, for example `ch.uid`, `osm`, `domain`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching records, always as a list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Record"
                      }
                    },
                    "license": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/v1/changes": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Delta feed since a change cursor",
        "description": "Poll with `since=<next_since>` to replicate the index. Entries are ordered by a strictly increasing `seq`. Gaps are normal: the sequence is not transactional, so a rolled-back write consumes a number. Every entry carries `prev_hash` and `hash`; hashing a change with the previous entry's hash must reproduce its own hash, so a tampered feed is detectable.",
        "operationId": "listChanges",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Return entries with `seq` greater than this. Default 0.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 500,
              "maximum": 5000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the feed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Change"
                      }
                    },
                    "next_since": {
                      "type": "integer"
                    },
                    "latest_seq": {
                      "type": "integer"
                    },
                    "license": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/v1/stats": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Counts and the current change cursor",
        "operationId": "stats",
        "responses": {
          "200": {
            "description": "Index statistics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Stats"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sources": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Data sources with licence and attribution text",
        "description": "Reusers must reproduce the attribution shown here.",
        "operationId": "listSources",
        "responses": {
          "200": {
            "description": "Every source",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    },
                    "license": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/login": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Request a login code by email",
        "description": "Always answers 202, whether or not the address has an account, so that the endpoint cannot be used to discover which addresses are registered. Rate limited per address and per caller.",
        "operationId": "authLogin",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language of the login email: en, de, fr or it. A regional tag such as de-CH is read as de. Without it the language comes from Accept-Language, then the owner's stored email language, then English. Any other value is ignored."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "If the address is valid, a code has been sent"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/v1/auth/verify": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Exchange a login code for a session token",
        "description": "Returns a bearer token valid for 30 days. A code can be used once and tolerates five wrong guesses.",
        "operationId": "authVerify",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "code"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "locale": {
                    "type": "string",
                    "description": "The console language at sign-in, read like the login locale. It becomes the owner's email language only when none is stored yet; Settings (PUT /v1/me/preferences) changes it afterwards."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A session token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "401": {
            "description": "The code is wrong, expired or already used"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/v1/auth/logout": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "End the current session",
        "operationId": "authLogout",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Signed out"
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "The signed-in owner",
        "description": "Every owner who claims a business may correct and verify its facts; while subscriptions are switched off (the default) entitled is always true and entitlement_source is \"free\".",
        "operationId": "getMe",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The owner",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/me/preferences": {
      "put": {
        "tags": [
          "owner"
        ],
        "summary": "Change the signed-in owner's email preferences",
        "description": "The monthly usage report and the weekly stale-facts reminder are opt-in: both are off until the owner turns them on here. A field left out keeps its value; at least one is required. `locale` sets the email language; changing the console's language does not.",
        "operationId": "putPreferences",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "usage_report_email": {
                    "type": "boolean",
                    "description": "Receive the monthly usage report by email."
                  },
                  "staleness_email": {
                    "type": "boolean",
                    "description": "Receive the weekly reminder to confirm stale facts."
                  },
                  "locale": {
                    "type": "string",
                    "enum": ["en", "de", "fr", "it"],
                    "description": "The language of the emails n4p sends to this owner. Any other value is refused with 400 invalid_locale."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The preferences as stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "usage_report_email": {
                      "type": "boolean"
                    },
                    "staleness_email": {
                      "type": "boolean"
                    },
                    "locale": {"type": "string", "enum": ["en", "de", "fr", "it"]}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed body, or an unsupported locale (invalid_locale)"
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/claims": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Claim a business and start proving control",
        "description": "Claiming by email, phone, DNS or an owner-supplied website is free. The method decides how control is proved: `email_domain` sends a code to an address at the business's domain and is granted immediately when the owner's login address is already at that domain; `phone_otp` sends a code by SMS to the business's phone number, and is refused with 503 `phone_unavailable` when the deployment cannot send text messages (no SMS provider is wired up yet, so it is off unless SMS_LOG_ONLY is set for development); `dns_txt` returns a token to publish as a DNS TXT record; `website_uid` is for a record with no website or phone: it crawls the supplied website for the business's Swiss UID and, when found, returns a DNS record and a well-known-file token that prove control of the domain; `postcard` posts a code to the business's recorded postal address. A postcard claim is paid once when POSTCARD_PRICE is set; with no postal provider, or with no price and no payment provider, it is refused with 503 `postcard_unavailable`. A business can only be claimed and verified by one owner.",
        "operationId": "createClaim",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "business_id",
                  "method"
                ],
                "properties": {
                  "business_id": {
                    "type": "string"
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "email_domain",
                      "phone_otp",
                      "dns_txt",
                      "website_uid",
                      "postcard"
                    ]
                  },
                  "email_local": {
                    "type": "string",
                    "description": "Local part to send the code to, for email_domain claims where the login address is not at the business domain."
                  },
                  "website": {
                    "type": "string",
                    "description": "For website_uid claims, the business website to crawl. Only accepted when the record has no domain of its own. The site must name the business's Swiss UID."
                  },
                  "publish_website": {
                    "type": "boolean",
                    "default": false,
                    "description": "For website_uid claims, also publish the website as the owner's (self-reported) value of the website field once the domain is proved."
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language of the claim-code email for email_domain claims: en, de, fr or it. Falls back to Accept-Language, then the claimer's stored email language, then English. Any other value is ignored."
                  },
                  "address_id": {
                    "type": "string",
                    "description": "For postcard claims, one of the record's location ids or `registered`. Omit to use the primary storefront when there is one, otherwise the registered address. A free-form address is deliberately not accepted."
                  },
                  "challenge": {
                    "type": "boolean",
                    "default": false,
                    "description": "Ask to challenge the business's direct approved claim, held by another owner. The claim is stored pending with challenge_of set; proving it opens a challenge the incumbent answers instead of approving it. Coverage through an operating business's claim, the re-claim cooldown and a merged record refuse as for an ordinary claim, and an open challenge answers 409 challenge_open. Every method works, a paid postcard included: the order carries the challenge, and the claim created when the card is posted names the approved claim. A paid card is not refunded when the challenge does not succeed; an order whose challenged claim changed before the card went out is parked for a manual refund. Cannot be combined with `reprove`."
                  },
                  "reprove": { "type": "boolean", "default": false, "description": "Re-prove a claim you already hold that came from an owner handover or an operator transfer (method owner_handover or operator_transfer), so your edits stop being self-reported. Every method works, a paid postcard included; the re-claim cooldown, the already-claimed refusal and the instant email-domain approval do not apply, so an email claim always sends a code. Proving it upgrades the approved claim in place: same claim id, its method becomes the one you proved, reproved_at is set, and the change feed gets one claim row with that claim id; nothing is revoked and the manager does not change. Any other claim answers 409 reprove_not_allowed. Cannot be combined with challenge (400 invalid_parameter)." }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An identical postcard claim is already pending; the existing claim is returned and no second card is sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "201": {
            "description": "The claim, and what to do next",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "202": {
            "description": "Postcard claim that is paid once: an order was created; pay at `payment_url`. The card is posted, and the claim created, only after the payment provider confirms the payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostcardOrder"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "409": {
            "description": "Already claimed (`already_claimed`), the record is a location managed through its operator's claim (`claim_taken`), your claim on it was revoked recently (`reclaim_cooldown`: until `retry_after`, only `dns_txt` and `postcard` are accepted), the requested challenge is refused (`challenge_not_allowed`: there is no direct approved claim, or you hold it already) or already in play (`challenge_open`), or there is nothing to re-prove (`reprove_not_allowed`: you do not hold the approved claim, or it already rests on a proof). The error object carries `claim_status` and `proven_on` for the first two, `retry_after` (date) for the cooldown, and `review_url`, where a refused claimant can ask for a review.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": ["code", "message"],
                      "properties": {
                        "code": { "type": "string", "enum": ["already_claimed", "claim_taken", "reclaim_cooldown", "challenge_not_allowed", "challenge_open", "reprove_not_allowed"] },
                        "message": { "type": "string" },
                        "claim_status": { "type": "string", "example": "claimed" },
                        "proven_on": { "type": "string", "format": "date", "example": "2026-11-02" },
                        "retry_after": { "type": "string", "format": "date", "example": "2027-02-26" },
                        "review_url": { "type": "string", "example": "https://console.n4p.ch/contact?topic=claim&business=biz_..." }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The website was reachable but does not name the business's Swiss UID"
          },
          "429": {
            "description": "Too many postcard claims or website crawls from this owner in the last 24 hours"
          },
          "502": {
            "description": "The website or postal provider could not be reached, so no claim was created"
          },
          "503": {
            "description": "No postal provider is configured, or postcards cannot be bought on this deployment (`postcard_unavailable`); or the deployment cannot send text messages (`phone_unavailable`)"
          }
        }
      }
    },
    "/v1/claims/{claim_id}": {
      "get": {
        "tags": ["owner"],
        "summary": "Read one of your own claims and its challenge",
        "description": "Returns what is needed to finish a pending claim: the DNS record and verification file to publish, or where a postcard was sent. Codes sent by email, SMS or post are never returned. Another owner's claim answers 404, like a missing one.",
        "operationId": "getClaim",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "claim_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": { "description": "The claim", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Claim" } } } },
          "404": { "description": "No such claim, or not yours" }
        }
      }
    },
    "/v1/claims/{claim_id}/challenge": {
      "get": {
        "tags": ["owner"],
        "summary": "The challenge one of your claims opened",
        "description": "Returns the challenge your claim opened, whatever its state, with both claims' proof method and rank, your statement, the deadline and the incumbent's response. Another owner's claim answers 404, like the claim endpoint itself.",
        "operationId": "getClaimChallenge",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "claim_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": {
            "description": "The challenge your claim opened",
            "content": { "application/json": { "schema": { "type": "object", "properties": { "challenge": { "$ref": "#/components/schemas/ClaimChallenge" } } } } }
          },
          "404": { "description": "No such claim or challenge, or not yours" }
        }
      },
      "delete": {
        "tags": ["owner"],
        "summary": "Withdraw a claim challenge you opened",
        "description": "Closes the challenge while it is open or contested and rejects the claim that opened it. Once it is resolved or withdrawn it answers 409 challenge_not_open.",
        "operationId": "withdrawClaimChallenge",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "claim_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": {
            "description": "Withdrawn",
            "content": { "application/json": { "schema": { "type": "object", "properties": {
              "challenge_id": { "type": "string" },
              "status": { "type": "string", "enum": ["withdrawn"] }
            } } } }
          },
          "404": { "description": "No such claim or challenge, or not yours" },
          "409": { "description": "challenge_not_open: the challenge was already resolved or withdrawn" }
        }
      }
    },
    "/v1/claims/{claim_id}/prove": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Submit proof for a pending claim",
        "description": "For email and phone claims, send the code. For DNS claims the record is looked up; a missing record is 412 and can take a few minutes to propagate. For a website_uid claim, the TXT record or the well-known verification file is checked, whichever the owner published. A claim that challenges another claim does not become approved: it opens a challenge for the incumbent and answers 202.",
        "operationId": "proveClaim",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "claim_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "statement": {
                    "type": "string",
                    "description": "For a claim opened with challenge: true, the challenger's explanation. Shown to the incumbent; at most 2000 characters. Ignored for an ordinary claim."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The claim",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "202": {
            "description": "The proof succeeded and a challenge is now open (or, when the same challenge claim is proved again, the challenge that is already in play); the incumbent has been mailed once and must answer by respond_by. A retry may repeat the statement but cannot change it.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["status", "challenge_id", "business_id", "respond_by"],
                  "properties": {
                    "status": { "type": "string", "enum": ["challenge_open"] },
                    "challenge_id": { "type": "string" },
                    "business_id": { "type": "string" },
                    "respond_by": { "type": "string", "format": "date-time" }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Wrong code"
          },
          "409": {
            "description": "The claim is not pending. If another owner has already been approved on the business, the refusal is `already_claimed` and the error object carries `claim_status`, `proven_on` and `review_url`, like POST /v1/claims. A claim closed because another account's claim was approved answers `claim_superseded` with `review_url`. An owner in the re-claim cooldown proving with a method other than `dns_txt` or `postcard` answers `reclaim_cooldown` with `retry_after` and `review_url`. A challenge claim answers `challenge_open` when the business already has a challenge in play (proving the same claim again answers 202 with that challenge), and `challenge_not_allowed` when it can no longer challenge the approved claim. Proving the same challenge claim again with a different non-empty statement answers `challenge_statement_fixed`: the statement is fixed once the challenge opens, so the retry must omit it or repeat the first wording. When the challenged claim is no longer approved the message says so and asks the challenger to start an ordinary claim. A re-prove claim answers `reprove_not_allowed` when the claim it re-proves is no longer yours or no longer a handed-over or transferred claim."
          },
          "410": {
            "description": "The challenge expired"
          },
          "412": {
            "description": "The DNS record or the verification file was not found"
          },
          "429": {
            "description": "Too many failed attempts"
          }
        }
      }
    },
    "/v1/invites/lookup": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Look up a claim-invite code from a card",
        "description": "Public. The code travels in the body, never in the path. Rate limited per caller and by a global budget of failed lookups. Counts a visit on the invite; no IP is stored.",
        "operationId": "inviteLookup",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The invite and the business it belongs to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InviteLookup"
                }
              }
            }
          },
          "404": {
            "description": "No invite matches this code"
          },
          "429": {
            "description": "Too many requests"
          },
          "503": {
            "description": "Claim invites are not configured on this deployment"
          }
        }
      }
    },
    "/v1/invites/redeem": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Claim a business with an invite code",
        "description": "Needs a session. Accepts the owner terms like POST /v1/claims and returns an approved claim with method postcard_invite. Proves control only: facts stay self-reported until the owner verifies them.",
        "operationId": "inviteRedeem",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code",
                  "terms_version",
                  "terms_accepted"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "terms_version": {
                    "type": "string"
                  },
                  "terms_accepted": {
                    "type": "boolean"
                  },
                  "capacity": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "An approved claim"
          },
          "200": {
            "description": "Already redeemed by this owner"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Not signed in"
          },
          "404": {
            "description": "No invite matches this code"
          },
          "409": {
            "description": "The invite was already used, was reported as the wrong business, or the business is already claimed. An `already_claimed` / `claim_taken` answer carries `claim_status`, `proven_on` and `review_url` like POST /v1/claims. An owner whose claim on the business was revoked within the last 90 days answers `reclaim_cooldown` with `retry_after` and `review_url`."
          },
          "410": {
            "description": "The invite expired or was withdrawn"
          },
          "423": {
            "description": "The invite is locked after too many attempts"
          },
          "429": {
            "description": "Too many requests"
          },
          "503": {
            "description": "Claim invites are not configured on this deployment"
          }
        }
      }
    },
    "/v1/invites/reject": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Report that a card reached the wrong business",
        "description": "Public, no account. Records not_mine, closed or moved and stops further mail to the business.",
        "operationId": "inviteReject",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code",
                  "reason"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "not_mine",
                      "closed",
                      "moved"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The reason was recorded"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "description": "No invite matches this code"
          },
          "409": {
            "description": "The invite was already used or withdrawn"
          },
          "410": {
            "description": "The invite was withdrawn"
          },
          "423": {
            "description": "The invite is locked after too many attempts"
          },
          "429": {
            "description": "Too many requests"
          },
          "503": {
            "description": "Claim invites are not configured on this deployment"
          }
        }
      }
    },
    "/v1/owner/businesses": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "The businesses this owner has claimed",
        "operationId": "listOwnerBusinesses",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Claimed businesses",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Record"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/owner/claims": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "Claims this owner has started and not finished",
        "description": "Pending claims whose challenge has not expired (a code to enter, a DNS record or file to check again) and postcard orders that have not become a claim yet. The console's dashboard lists them so an owner can finish a claim after the session it was started in has ended.",
        "operationId": "listOwnerClaims",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Unfinished claims and orders, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "claims": {
                      "type": "array",
                      "items": {
                        "allOf": [
                          {"$ref": "#/components/schemas/Claim"},
                          {"type": "object", "properties": {"business_name": {"type": "string"}}}
                        ]
                      }
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "allOf": [
                          {"$ref": "#/components/schemas/PostcardOrder"},
                          {"type": "object", "properties": {"business_name": {"type": "string"}}}
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/owner/challenges": {
      "get": {
        "tags": ["owner"],
        "summary": "The challenges in play where this owner is the incumbent",
        "description": "Every open or contested challenge on a business where the caller holds the incumbent claim, each with the business, the deadline and the status. It carries no challenger identity and no statement: the answer page reads those. The console uses this one request for all of the dashboard's challenge tasks.",
        "operationId": "listOwnerChallenges",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": {
            "description": "In-play challenges, soonest deadline first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["challenge_id", "business_id", "business_name", "respond_by", "status"],
                        "properties": {
                          "challenge_id": { "type": "string" },
                          "business_id": { "type": "string" },
                          "business_name": { "type": "string" },
                          "respond_by": { "type": "string", "format": "date-time" },
                          "status": { "type": "string", "enum": ["open", "contested"] },
                          "incumbent_dormant": { "type": "boolean" }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/facts/{field}": {
      "delete": {
        "tags": [
          "owner"
        ],
        "summary": "Withdraw the owner's value of a field",
        "description": "Free. Removes this owner's value of the field, nothing else. If another source also publishes the field (for example OpenStreetMap opening hours), its value becomes the record's value again, and the returned record shows it; otherwise the field disappears. To replace a wrong value from another source, write the correct one with PUT instead. Derived fields (`transit`) cannot be withdrawn.",
        "operationId": "deleteOwnerFact",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "field",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The updated record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "description": "The owner has not proved control of this business"
          },
          "404": {
            "description": "`nothing_to_delete`: this owner has no value for the field"
          }
        }
      },
      "put": {
        "tags": [
          "owner"
        ],
        "summary": "Write a fact about a claimed business",
        "description": "Free. The value is recorded with method `self_attestation`, which is `self_reported` confidence: the owner says so, but has not proved this particular value. Use POST /v1/businesses/{business_id}/verify to raise it to `verified` using the method the claim was proved with.",
        "operationId": "putOwnerFact",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "field",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "description": "The field's value. Its JSON shape depends on the field."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "description": "The owner has not proved control of this business"
          }
        }
      }
    },
    "/v1/businesses/{business_id}/verify": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Raise a fact's confidence to verified",
        "description": "Free for an owner with an approved claim. The verification method is never taken from the request: the server uses how the owner proved control of the business, so a client cannot call a value verified by asserting it. If the owner has not written a value for the field, the value already on record is confirmed.",
        "operationId": "verifyFact",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "field"
                ],
                "properties": {
                  "field": {
                    "type": "string"
                  },
                  "method": {
                    "type": "string",
                    "description": "Ignored. Accepted so that clients written against the documented request shape do not break. The server always uses the method the claim was proved with."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "403": {
            "description": "The owner has not proved control of this business"
          },
          "409": {
            "description": "nothing_to_verify when there is no value to confirm, or claim_unproven when the claim was handed over or transferred and has no proof method yet; re-prove it with POST /v1/claims and \"reprove\": true"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/holiday-suggestions": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "Suggested public holidays for a claimed business's canton",
        "description": "Free. The public holidays of the business's canton (from its primary location, else its registered address) between today and 364 days ahead, as suggestions for `special_hours`. Nothing is stored and nothing affects `open_now` until the owner saves an entry. Communal holidays are not included. Without a known canton, only the holidays every canton observes are listed.",
        "operationId": "getHolidaySuggestions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Suggested holidays in the next 12 months",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HolidaySuggestions"
                }
              }
            }
          },
          "403": {
            "description": "The owner has not proved control of this business"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/staleness": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "Which facts of a claimed business have gone stale",
        "description": "Lists every field the record has, with the moment it was last re-confirmed and when its freshness window expires, plus the core fields the record does not have at all. A missing core field keeps the record at unverified confidence, so it is the first thing worth filling in.\n\nStaleness never changes confidence. A stale value is reported, not demoted: an owner who has not re-confirmed something has not made it wrong, and a consuming agent should weigh the age rather than be told the value is bad.",
        "operationId": "getStaleness",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The freshness report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Staleness"
                }
              }
            }
          },
          "403": {
            "description": "The owner has not proved control of this business"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/claim-attempts": {
      "get": {
        "tags": ["owner"],
        "summary": "Refused attempts to claim a business you manage",
        "description": "Lists attempts that were refused because this business already had an approved claim. Each item carries the date, method and stage only: never the claimant's identity. The notice to the incumbent is throttled to one per business per week.",
        "operationId": "getClaimAttempts",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "business_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": {
            "description": "Attempts, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["at", "method", "stage"],
                        "properties": {
                          "at": { "type": "string", "format": "date-time" },
                          "method": { "type": "string" },
                          "stage": { "type": "string", "enum": ["create", "prove", "invite", "postcard_order"] }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": { "description": "The owner has not proved control of this business" }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/challenge": {
      "get": {
        "tags": ["owner"],
        "summary": "The challenge on a business you manage, or the last resolved one",
        "description": "The challenge in play against your claim, or the most recent resolved one. It carries the status, the deadline, the incumbent's answer, both claims' proof method and rank, and the challenger's statement. It never names the challenger: no address, name or owner id.",
        "operationId": "getOwnerChallenge",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "business_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": {
            "description": "The challenge, or null",
            "content": { "application/json": { "schema": { "type": "object", "properties": {
              "challenge": { "oneOf": [{ "$ref": "#/components/schemas/ClaimChallenge" }, { "type": "null" }] }
            } } } }
          },
          "403": { "description": "not_claimed when you do not manage the business and it has no challenge, or forbidden when the challenge belongs to another approved claim" }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/challenge/accept": {
      "post": {
        "tags": ["owner"],
        "summary": "Accept a challenge and give the claim up",
        "description": "The incumbent's own claim is revoked with revoked_by = challenge and the challenger claim is approved in place with its own proof method. The challenger gets claim_transferred and the incumbent claim_revoked, both with the challenge wording.",
        "operationId": "acceptChallenge",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "business_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "requestBody": {
          "required": false,
          "content": { "application/json": { "schema": { "type": "object", "properties": {
            "statement": { "type": "string", "description": "Optional words for the challenger and the operator. At most 2000 characters." }
          } } } }
        },
        "responses": {
          "200": {
            "description": "The transfer",
            "content": { "application/json": { "schema": { "type": "object", "properties": {
              "challenge_id": { "type": "string" },
              "status": { "type": "string", "enum": ["transferred"] },
              "claim_id": { "type": "string", "description": "The challenger's claim, now approved" },
              "transferred_from": { "type": "string", "description": "The incumbent's claim, now revoked" }
            } } } }
          },
          "400": { "description": "challenge_statement_too_long, or invalid_body" },
          "403": { "description": "forbidden: the challenge belongs to another approved claim" },
          "409": { "description": "challenge_not_open: there is no challenge in play, or it can no longer be answered" }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/challenge/decline": {
      "post": {
        "tags": ["owner"],
        "summary": "Decline a challenge and send it to an operator",
        "description": "A statement is required: the operator decides on the incumbent's and the challenger's words. The challenge becomes contested and the challenger is told that an operator will review the case.",
        "operationId": "declineChallenge",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "business_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "required": ["statement"], "properties": {
            "statement": { "type": "string", "description": "Why the challenge is refused. At most 2000 characters." }
          } } } }
        },
        "responses": {
          "200": {
            "description": "The challenge is contested",
            "content": { "application/json": { "schema": { "type": "object", "properties": {
              "challenge_id": { "type": "string" },
              "status": { "type": "string", "enum": ["contested"] }
            } } } }
          },
          "400": { "description": "missing_parameter, challenge_statement_too_long, or invalid_body" },
          "403": { "description": "forbidden: the challenge belongs to another approved claim" },
          "409": { "description": "challenge_not_open: there is no challenge in play, or it can no longer be answered" }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/handover": {
      "get": {
        "tags": ["owner"],
        "summary": "The latest handover of a business you manage",
        "description": "The latest handover this owner started on the business, with its status. Needs the approved claim made on this business itself.",
        "operationId": "getHandover",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "business_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": {
            "description": "The latest handover, or null",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "handover": {
                      "oneOf": [
                        { "$ref": "#/components/schemas/Handover" },
                        { "type": "null" }
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": { "description": "not_claimed, or handover_needs_direct_claim for a location managed through its operator's claim" }
        }
      },
      "post": {
        "tags": ["owner"],
        "summary": "Hand a business you manage over to another email address",
        "description": "Sends an offer to to_email. The recipient signs in or signs up with that address and accepts the owner terms; the claim then moves to them with method owner_handover. Valid 14 days; one open handover per business; at most 3 offers per business and 10 per owner in 24 hours. When it is accepted, the outgoing owner's claim is revoked, their channel connections are disconnected and they enter the 90-day re-claim cooldown; subscriptions, grants and API keys stay with them.",
        "operationId": "startHandover",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "business_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["to_email"],
                "properties": {
                  "to_email": { "type": "string" },
                  "locale": { "type": "string", "enum": ["en", "de", "fr", "it"], "description": "The language of the offer email." }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The offer was sent",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "handover": { "$ref": "#/components/schemas/Handover" } }
                }
              }
            }
          },
          "400": { "description": "invalid_email, or handover_self for your own address" },
          "403": { "description": "not_claimed, or handover_needs_direct_claim for a location managed through its operator's claim" },
          "409": { "description": "handover_pending, merged, or challenge_open while custody of the business is disputed" },
          "429": { "description": "Too many offers" }
        }
      },
      "delete": {
        "tags": ["owner"],
        "summary": "Cancel the open handover of a business you manage",
        "operationId": "cancelHandover",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "business_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": { "description": "Cancelled" },
          "403": { "description": "not_claimed, or handover_needs_direct_claim for a location managed through its operator's claim" },
          "404": { "description": "no_handover: there is no open handover" }
        }
      }
    },
    "/v1/handovers/lookup": {
      "post": {
        "tags": ["owner"],
        "summary": "Look up a handover code from an email",
        "description": "Public. The code travels in the body, never in the path. Returns only the business name and the expiry. Rate limited per caller.",
        "operationId": "handoverLookup",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["token"],
                "properties": { "token": { "type": "string" } }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The business name and the expiry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HandoverLookup" }
              }
            }
          },
          "404": { "description": "No handover matches this code" },
          "409": { "description": "handover_closed: accepted, declined, withdrawn, or the business changed hands" },
          "410": { "description": "handover_expired" },
          "429": { "description": "Too many requests" }
        }
      }
    },
    "/v1/handovers/accept": {
      "post": {
        "tags": ["owner"],
        "summary": "Accept a handover and become the business's manager",
        "description": "Needs a session whose email is the address the handover was sent to. Accepts the owner terms like POST /v1/claims and returns an approved claim with method owner_handover. Accepting by email proves the address, not control of the business: facts stay self-reported until the new owner proves control with POST /v1/claims and \"reprove\": true.",
        "operationId": "handoverAccept",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["token", "terms_version", "terms_accepted"],
                "properties": {
                  "token": { "type": "string" },
                  "terms_version": { "type": "string" },
                  "terms_accepted": { "type": "boolean" },
                  "capacity": { "type": "string", "enum": ["owner", "manager", "franchisee", "authorised_agent"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Already accepted by you" },
          "201": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "business_id": { "type": "string" },
                    "claim_id": { "type": "string" },
                    "status": { "type": "string" },
                    "method": { "type": "string" },
                    "terms_version": { "type": "string" },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "400": { "description": "terms_required or invalid_capacity" },
          "401": { "description": "unauthenticated" },
          "403": { "description": "handover_wrong_account" },
          "404": { "description": "No handover matches this code" },
          "409": { "description": "handover_closed, handover_self, or challenge_open while custody of the business is disputed" },
          "410": { "description": "handover_expired" },
          "429": { "description": "Too many requests" }
        }
      }
    },
    "/v1/handovers/decline": {
      "post": {
        "tags": ["owner"],
        "summary": "Decline a handover",
        "description": "Public, no account. The current owner keeps the business.",
        "operationId": "handoverDecline",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["token"],
                "properties": { "token": { "type": "string" } }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Declined" },
          "404": { "description": "No handover matches this code" },
          "409": { "description": "handover_closed: accepted, declined, withdrawn, or the business changed hands" },
          "410": { "description": "handover_expired" },
          "429": { "description": "Too many requests" }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/usage": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "Aggregate reads of a claimed business",
        "description": "How often the listing was returned in a search, fetched as a record, read as a menu, resolved from a name, or found by an external identifier, over the last 1 to 90 days. The report stores no query text, IP address, user agent or session id: only daily counts by kind and the coarse client class already used by the traffic statistics.",
        "operationId": "getBusinessUsage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The aggregate report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BusinessUsage"
                }
              }
            }
          },
          "403": {
            "description": "The owner has not proved control of this business"
          }
        }
      }
    },
    "/v1/owner/api-keys": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Create an API key for the signed-in owner",
        "description": "Returns the raw key exactly once; only its SHA-256 hash is stored. A request that presents the key as a bearer token is rate limited against the key's own per-minute quota instead of the shared anonymous limit.",
        "operationId": "createAPIKey",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key, including the raw key that is never shown again",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_id": {
                      "type": "string"
                    },
                    "raw_key": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "tier": {
                      "type": "string"
                    },
                    "rate_limit_per_min": {
                      "type": "integer"
                    },
                    "raw_key_note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Not signed in"
          }
        }
      },
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "List active API keys for the signed-in owner",
        "description": "Revoked keys are not listed. The raw key is never returned here.",
        "operationId": "listAPIKeys",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The owner's active keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key_id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "tier": {
                            "type": "string"
                          },
                          "rate_limit_per_min": {
                            "type": "integer"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/owner/api-keys/{key_id}": {
      "delete": {
        "tags": [
          "owner"
        ],
        "summary": "Revoke one of the signed-in owner's API keys",
        "operationId": "revokeAPIKey",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The key is revoked"
          },
          "401": {
            "description": "Not signed in"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/owner/listing-requests": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Submit a request to have a missing business imported",
        "description": "If a Swiss UID or a single name and locality match already resolves to a record, the response is matched_existing with that record's id and no request is stored. Otherwise a request is queued for the worker. At most three requests are accepted per owner in 24 hours.",
        "operationId": "createListingRequest",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "street",
                  "postcode",
                  "locality"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "street": {
                    "type": "string"
                  },
                  "postcode": {
                    "type": "string"
                  },
                  "locality": {
                    "type": "string"
                  },
                  "canton": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string",
                    "default": "CH"
                  },
                  "website": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "uid": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An existing record already matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListingRequestStatus"
                }
              }
            }
          },
          "201": {
            "description": "The request was queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListingRequestStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Not signed in"
          },
          "429": {
            "description": "Too many listing requests in the last 24 hours"
          }
        }
      },
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "List the signed-in owner's listing requests",
        "operationId": "listListingRequests",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The owner's listing requests, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "requests": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListingRequestStatus"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/owner/listing-requests/{request_id}": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "Get one listing request by id",
        "operationId": "getListingRequest",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The listing request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "result_business_id": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/reconfirm": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Re-confirm facts, resetting their freshness",
        "description": "Free, like every owner feature. The value is never changed, only when it was last confirmed. Where the owner is entitled, re-confirming also asserts the value with a proven identity, which earns the same confidence that verifying does; with subscriptions switched off that is every owner, so the value is verified.\n\nA re-confirmation that only moves the timestamp writes nothing to the change feed, because ``still true'' is not a fact change. A re-confirmation that also raises confidence does, because confidence is part of a fact.",
        "operationId": "reconfirmFacts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Fields to re-confirm. Omit or leave empty to re-confirm every stale fact."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What was re-confirmed and what was skipped",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconfirmResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "description": "The owner has not proved control of this business"
          }
        }
      }
    },
    "/.well-known/n4p-keys.json": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Published Ed25519 public keys",
        "description": "The keys that sign records, checkpoints and snapshots. Retired keys stay listed, because signatures made with them must remain verifiable.",
        "operationId": "publicKeys",
        "responses": {
          "200": {
            "description": "The published keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "alg": {
                      "type": "string",
                      "const": "Ed25519"
                    },
                    "keys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kid": {
                            "type": "string"
                          },
                          "alg": {
                            "type": "string"
                          },
                          "public_key": {
                            "type": "string",
                            "description": "base64url of the raw 32-byte key"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "retired_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{business_id}/signature": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Signature over a single record",
        "description": "Proves a record was issued by this index and has not been altered. The digest covers the record's canonical form, which deliberately excludes `stale` and `fresh_until` because those depend on the time of the request; a signature that changed every second would be useless.\n\nEvery signature response includes the exact payload that was signed, so a verifier never has to reconstruct it. Check the payload's type tag, check that its digest matches the data you fetched, then verify the signature over the RFC 8785 canonical JSON of the payload with the public key from /.well-known/n4p-keys.json.",
        "operationId": "getRecordSignature",
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The signature",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Signature"
                }
              }
            }
          },
          "301": {
            "description": "The record was merged; re-request the survivor's signature"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "This deployment has no signing key configured, so it cannot sign"
          }
        }
      }
    },
    "/v1/changes/checkpoint": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Signed promise about the state of the change feed",
        "description": "A checkpoint says that the change feed up to and including `payload.seq` has `payload.hash`. Replay the feed, recompute every hash, and check the entry at that seq: a feed that has been rewritten no longer matches the signed promise.\n\nEvery signature response includes the exact payload that was signed, so a verifier never has to reconstruct it. Check the payload's type tag, check that its digest matches the data you fetched, then verify the signature over the RFC 8785 canonical JSON of the payload with the public key from /.well-known/n4p-keys.json.",
        "operationId": "getChangeCheckpoint",
        "responses": {
          "200": {
            "description": "The checkpoint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Signature"
                }
              }
            }
          },
          "404": {
            "description": "No checkpoint has been signed yet"
          }
        }
      }
    },
    "/v1/snapshots/latest": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Metadata for the most recent signed snapshot",
        "description": "A snapshot is a complete copy of the dataset at a point in the feed, for a consumer that would rather download everything than replay the feed. Download it from `download_url`, hash the compressed bytes, and compare with `sha256`.\n\nEvery signature response includes the exact payload that was signed, so a verifier never has to reconstruct it. Check the payload's type tag, check that its digest matches the data you fetched, then verify the signature over the RFC 8785 canonical JSON of the payload with the public key from /.well-known/n4p-keys.json.",
        "operationId": "latestSnapshot",
        "responses": {
          "200": {
            "description": "Snapshot metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Snapshot"
                }
              }
            }
          },
          "404": {
            "description": "No snapshot has been produced yet"
          }
        }
      }
    },
    "/v1/snapshots/{snapshot_id}": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Download a snapshot",
        "description": "gzip-compressed NDJSON: one RFC 8785 canonical record per line, ordered by business_id.",
        "operationId": "downloadSnapshot",
        "parameters": [
          {
            "name": "snapshot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The snapshot file",
            "content": {
              "application/gzip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "No such snapshot"
          },
          "410": {
            "description": "The snapshot record exists but its file is no longer on disk"
          }
        }
      }
    },
    "/v1/snapshots/{snapshot_id}/{asset}": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "Download a snapshot licence, notice, source list or manifest",
        "description": "The sidecars that must travel with a conveyed database under ODbL 4.2. `asset` is one of `license`, `notice`, `sources` or `manifest`.",
        "operationId": "downloadSnapshotAsset",
        "parameters": [
          {
            "name": "snapshot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "asset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "license",
                "notice",
                "sources",
                "manifest"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested sidecar",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "No such snapshot or unknown asset"
          },
          "410": {
            "description": "The snapshot exists but this sidecar is missing"
          }
        }
      }
    },
    "/v1/postcard-quote": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "What a postcard claim costs the signed-in owner: included, a one-time price, or unavailable",
        "operationId": "getPostcardQuote",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The business the postcard would be sent to. Required so phase 2 promotions can price per business without changing the contract."
          }
        ],
        "responses": {
          "200": {
            "description": "The price of a postcard claim for this owner and business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostcardQuote"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Not signed in"
          }
        }
      }
    },
    "/v1/postcard-orders/{order_id}": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "Read one of your own postcard orders and its payment state",
        "operationId": "getPostcardOrder",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order and what happens next",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostcardOrder"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          },
          "404": {
            "description": "No such order, or it belongs to another owner"
          }
        }
      }
    },
    "/v1/plans": {
      "get": {
        "tags": [
          "billing"
        ],
        "summary": "Whether this deployment takes payments, and the one-time postcard price",
        "description": "Reads are always free, and so is every owner feature. This endpoint publishes the one-time postcard price so a client can show it before sign-in. It never carries owner data.",
        "operationId": "getPlans",
        "responses": {
          "200": {
            "description": "The configured plan, or `billing_configured: false` when this deployment cannot take payments",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/checkout": {
      "post": {
        "tags": [
          "billing"
        ],
        "summary": "Discontinued: subscriptions are switched off",
        "description": "n4p no longer sells subscriptions (#50). Answers 410 `subscriptions_discontinued` unless the deployment sets SUBSCRIPTIONS_ENABLED=true.",
        "operationId": "startCheckout",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "A checkout URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          },
          "410": {
            "description": "Subscriptions are switched off (`subscriptions_discontinued`)"
          },
          "503": {
            "description": "This deployment has no payment provider configured"
          }
        }
      }
    },
    "/v1/billing/webhook": {
      "post": {
        "tags": [
          "billing"
        ],
        "summary": "Payment provider webhook",
        "description": "Called by the payment provider, not by agents. The body's signature is verified before it is interpreted, and events are deduplicated by their provider id, so a retried delivery is a no-op. It is documented here only so that the endpoint list is complete.",
        "operationId": "billingWebhook",
        "responses": {
          "200": {
            "description": "Applied, or already applied"
          },
          "400": {
            "description": "The signature could not be verified"
          },
          "503": {
            "description": "This deployment has no payment provider configured"
          }
        }
      }
    },
    "/v1/billing/subscription": {
      "delete": {
        "tags": [
          "billing"
        ],
        "summary": "Cancel a leftover subscription of the signed-in owner",
        "description": "Cancels a subscription left over from before #50 at the payment provider. It keeps working while subscriptions are switched off, so nobody stays billed.",
        "operationId": "cancelSubscription",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The subscription will not renew",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "access_until": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in"
          },
          "409": {
            "description": "The owner has no active subscription"
          },
          "502": {
            "description": "The payment provider could not be reached"
          },
          "503": {
            "description": "This deployment has no payment provider configured"
          }
        }
      }
    },
    "/robots.txt": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Crawler policy",
        "description": "This API is for machines that call it, not for crawlers that index pages. There is no consumer site and no HTML to index.",
        "operationId": "robots",
        "responses": {
          "200": {
            "description": "The crawler policy",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/resolve": {
      "post": {
        "operationId": "resolveBusiness",
        "summary": "Resolve a name and an address to a business record",
        "description": "Turns what a caller actually has (a name from a conversation, an address, a phone number, a domain or a national identifier) into a record, and says how sure it is.\n\nThe answer is a *class*, not only a record, because the right action differs:\n\n* `exact`: name and location agree, or a strict identifier matched. Quote the record.\n* `likely`: the best candidate is clearly ahead of the rest. Confirm before relying on it.\n* `ambiguous`: several candidates are equally plausible. No `business_id` is returned; the `alternatives` array lists every candidate, best first, and the caller should ask which is meant.\n* `none`: nothing is close enough. Fall back to `/v1/search` or to the caller's own knowledge.\n\nA UID, phone number or domain short-circuits the name matching. A domain or phone shared by several branches of a chain narrows the candidates instead of answering, and comes back as `ambiguous`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The resolution, with its class, score and reasoning",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResolveResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "The category vocabulary, with labels in en, de, fr and it",
        "description": "Businesses store categories as OSM tags (`shop=bakery`, `amenity=cafe`, `cuisine=pizza`, `leisure=fitness_centre`, `office=it`, `craft=plumber`), which is the right thing to store and the wrong thing to make a caller guess. This endpoint maps a word in any of the four languages the index speaks to the tag, and labels a tag for display.\n\nA category is a shop, venue, trade or professional office, so the vocabulary covers IT, software and web companies (`office=it`), notaries, tax advisors, translators and the other professional services a customer searches for. It does not use the Swiss NOGA classification: NOGA is the official standard for economic activity, but per-business codes are not published, so it cannot name a record.\n\nIt is optional: `/v1/search?category=boulangerie` works directly. Use it when you want to show a label to a user, or to discover which tag a concept has.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "A word, phrase or tag to look up. Empty lists the whole vocabulary.",
            "schema": {
              "type": "string"
            },
            "example": "boulangerie"
          },
          {
            "name": "lang",
            "in": "query",
            "description": "Language of the `label` field. Defaults to `en`.",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "de",
                "fr",
                "it"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum entries to return, 1 to 500. Defaults to 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching categories, best match first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Category"
                      }
                    },
                    "language": {
                      "type": "string",
                      "example": "fr"
                    },
                    "license": {
                      "type": "string",
                      "example": "ODbL-1.0"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/v1/businesses/{business_id}/menu": {
      "get": {
        "operationId": "getMenu",
        "summary": "The full menu with prices and provenance",
        "description": "Menus are owner-sourced: no public dataset has a restaurant's prices and the index does not scrape. A business with no published menu returns 404 `no_menu`, which is different from `not_found` and should be reported to a user as \"no menu available\" rather than as an unknown business.\n\nPrices are integer minor units of the menu currency: 1250 is 12.50 in CHF. There are no free-text descriptions anywhere in a menu (an item is a name, a price and optional tags), so nothing here is marketing copy.\n\nA record carries only `menu_summary`. Fetch this endpoint when a user asks what is on the menu or what something costs.",
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "description": "The opaque business id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The menu, its provenance and its freshness",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MenuResponse"
                }
              }
            }
          },
          "301": {
            "description": "The business was merged; the Location header names its successor"
          },
          "404": {
            "description": "No such business (`not_found`), or it has no menu (`no_menu`)"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/menu": {
      "put": {
        "operationId": "putMenu",
        "summary": "Publish a menu, granting the licence it requires",
        "description": "Publishing and verifying a menu are free, like every owner feature. Only an owner who has proved control of the business can publish, which is what makes the licence unambiguous.\n\nValidation is strict, deliberately. Prices are non-negative integer minor units, tags come from a closed list, and unknown fields, including `description`, are rejected, so marketing text cannot enter the index.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "description": "The opaque business id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutMenuRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated record, carrying the new menu_summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "description": "The owner has not proved control of this business"
          }
        }
      },
      "delete": {
        "operationId": "deleteMenu",
        "summary": "Withdraw the menu this owner published",
        "description": "Removes the owner's menu. The record's `menu_summary` disappears with it.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "description": "The opaque business id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The menu was withdrawn"
          },
          "403": {
            "description": "The owner has not proved control of this business"
          },
          "404": {
            "description": "The owner had published no menu"
          }
        }
      }
    },
    "/v1/menu-items": {
      "get": {
        "operationId": "searchMenuItems",
        "summary": "Find places whose menu has a dish matching a query",
        "description": "Answers \"find me a place with fettuccine alfredo near me\". The unit of the result is the business, not the dish, because that is what the question asks for; each result carries the dishes that matched, their section, price and dietary tags.\n\nDish names **and section names** are matched with trigram similarity over the projected menu items, so a misspelling (`fetucine`) still finds the place and `q=pasta` finds the pasta section even when no dish is called that. A dish-name match ranks above a section-name match. Only businesses whose owner published a menu can match: the index does not infer a menu from a category.\n\nPrices are integer minor units of the item's currency. Check `menu_stale` before quoting a price: menus are owner-sourced and expire after three weeks.\n\nReturns at most `limit` businesses, best first, with up to five matching dishes each. It is a discovery query, not an enumeration of every menu in the index.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "The dish to look for. Misspellings are tolerated.",
            "schema": {
              "type": "string"
            },
            "example": "fettuccine alfredo"
          },
          {
            "name": "near",
            "in": "query",
            "description": "`lat,lon`. Results are ordered by distance when given.",
            "schema": {
              "type": "string"
            },
            "example": "47.3769,8.5417"
          },
          {
            "name": "radius_km",
            "in": "query",
            "description": "Radius in kilometres around `near`. Defaults to 25.",
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "example": 5
          },
          {
            "name": "country",
            "in": "query",
            "description": "ISO 3166-1 alpha-2 country code.",
            "schema": {
              "type": "string"
            },
            "example": "CH"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Business status filter. By default closed businesses are excluded; `any` disables the filter.",
            "schema": {
              "type": "string"
            },
            "example": "any"
          },
          {
            "name": "open_now",
            "in": "query",
            "description": "Keep only businesses open at `at`, or now.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "at",
            "in": "query",
            "description": "RFC 3339 timestamp at which to evaluate `open_now`. Defaults to now.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "description": "Require a dietary tag. Repeat to require several. `vegetarian`, `vegan`, `gluten_free`, `lactose_free`, `spicy`, `alcohol`.",
            "schema": {
              "type": "string"
            },
            "example": "vegetarian"
          },
          {
            "name": "max_price",
            "in": "query",
            "description": "Highest item price in minor units, for example 2500 for 25.00.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum businesses to return, 1 to 100. Defaults to 10.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Businesses with matching dishes, best first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MenuHit"
                      }
                    },
                    "query": {
                      "type": "string"
                    },
                    "license": {
                      "type": "string",
                      "example": "ODbL-1.0"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/businesses": {
      "get": {
        "operationId": "getBusinesses",
        "summary": "Fetch up to 100 records by id in one request",
        "description": "The common shape of an agent's work is: search or resolve, then read several of the results. One request instead of one per record is faster and spends less of the rate-limit budget.\n\nResults are in the order the ids were given, duplicates are removed, and ids that do not exist are returned in `missing` rather than silently dropped: a caller rendering a list needs to know which slots are empty.\n\nA merged record is returned with `merged_into` set; follow it if the current record matters.",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "description": "Comma-separated business ids, at most 100.",
            "schema": {
              "type": "string"
            },
            "example": "biz_01m53598gzv8t6,biz_01m5359cgc3ky4"
          },
          {
            "name": "include",
            "in": "query",
            "description": "Set to `observations` to include every source's value for every field.",
            "schema": {
              "type": "string",
              "enum": [
                "observations"
              ]
            }
          },
          {
            "name": "at",
            "in": "query",
            "description": "RFC 3339 timestamp at which to evaluate `open_now`. Defaults to now.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "Return only these facts, comma separated, for example `fields=name,hours`. Cheaper when you pay per token. It changes which keys are present, never their shape. Derived values follow their source field: `hours_week` and `open_now` need `hours`, and `hours` also returns `special_hours`, `menu_summary` needs `menu`, `legal_form_detail` needs `legal_form`. Identifiers, status, record_confidence, record_completeness, missing_core_fields, claim_status, claim_url, freshness, stale and the licence are always returned. An unknown field is a 400.",
            "schema": {
              "type": "string"
            },
            "example": "name,hours"
          }
        ],
        "responses": {
          "200": {
            "description": "The records that exist, in the requested order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "missing",
                    "license"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Record"
                      }
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Ids that do not exist."
                    },
                    "license": {
                      "type": "string",
                      "example": "ODbL-1.0"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/businesses/{business_id}/locations": {
      "get": {
        "tags": [
          "read"
        ],
        "summary": "The business's physical locations with provenance",
        "description": "Returns the places the business operates. The registered address remains in facts.address with role=registered; locations have role=location. A location with is_storefront=false never carries geo or transit.",
        "operationId": "listLocations",
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The locations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocationsResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/locations": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Add a location to a claimed business",
        "description": "The owner must have proved control of the business. The first location becomes primary. Correcting a location is free; the address is recorded as self-reported until verified.",
        "operationId": "createLocation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LocationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "400": {
            "description": "Invalid location, including a non-storefront with coordinates"
          },
          "403": {
            "description": "The business is not claimed by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/locations/{location_id}": {
      "put": {
        "tags": [
          "owner"
        ],
        "summary": "Correct a location",
        "operationId": "updateLocation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "location_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^loc_[0-9a-z]{26}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LocationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "400": {
            "description": "Invalid location"
          },
          "403": {
            "description": "The business is not claimed by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "owner"
        ],
        "summary": "Remove a location",
        "operationId": "deleteLocation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "location_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^loc_[0-9a-z]{26}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The updated record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "403": {
            "description": "The business is not claimed by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/locations/{location_id}/verify": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Verify a location with the claim's proof method",
        "description": "Marks the location verified using how the owner proved control of the business. The method is never taken from the request. Adding, correcting and verifying a location are free.",
        "operationId": "verifyLocation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "location_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^loc_[0-9a-z]{26}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The updated record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "403": {
            "description": "The business is not claimed by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "claim_unproven: the claim was handed over or transferred and has no proof method yet; re-prove it with POST /v1/claims and \"reprove\": true"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/link-suggestions": {
      "get": {
        "tags": [
          "owner"
        ],
        "summary": "Records that look like this company's locations",
        "description": "Open suggestions for a company the owner claimed directly. auto_confirmable is true when the claim's proof covers one of the child's domains; confirming such a suggestion links it at once, otherwise the suggestion waits for an operator.",
        "operationId": "listLinkSuggestions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The open suggestions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LinkSuggestion"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The business is not claimed directly by this owner"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/link-suggestions/{candidate_id}/confirm": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Confirm a suggested location",
        "description": "When the claim's proof covers the child's domain the link is made at once. Otherwise the suggestion is marked owner-confirmed and waits for an operator, who sees it first in the queue.",
        "operationId": "confirmLinkSuggestion",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "candidate_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Linked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["linked"]
                    },
                    "business_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "Confirmed by the owner and waiting for an operator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["pending_review"]
                    },
                    "business_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The candidate id is not an integer"
          },
          "403": {
            "description": "The business is not claimed directly by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/link-suggestions/{candidate_id}/dismiss": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Say a suggested record is not yours",
        "description": "Rejects the suggestion and records the decision, so the pair is not suggested again.",
        "operationId": "dismissLinkSuggestion",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "candidate_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["rejected"]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The candidate id is not an integer"
          },
          "403": {
            "description": "The business is not claimed directly by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/linked-locations": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Add a visitable place as its own record, operated by this company",
        "description": "Creates a separate record for a place the owner runs and links it to the company. An owner may add at most 20 locations per day.",
        "operationId": "createLinkedLocation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkedLocationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "400": {
            "description": "Missing street, postcode or town"
          },
          "403": {
            "description": "The business is not claimed directly by this owner"
          },
          "422": {
            "description": "Neither the request nor the company has a category"
          },
          "429": {
            "description": "More than 20 locations were added in the last 24 hours"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/linked-locations/{child_id}": {
      "delete": {
        "tags": [
          "owner"
        ],
        "summary": "Remove a location you did not create from this company",
        "description": "Unlinks a record the owner did not create. A location the owner added cannot be unlinked here; its own page closes it instead.",
        "operationId": "unlinkLinkedLocation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "child_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The updated company record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "403": {
            "description": "The business is not claimed directly by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The location was added by the owner and cannot be unlinked"
          }
        }
      }
    },
    "/v1/owner/businesses/{business_id}/locations/{location_id}/own-page": {
      "post": {
        "tags": [
          "owner"
        ],
        "summary": "Give a storefront location its own record and page",
        "description": "An owner-created location converts at once into its own linked record. An OSM-derived location becomes a split request an operator performs, so the next import updates the new record.",
        "operationId": "giveLocationOwnPage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "business_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^biz_[0-9a-z]{26}$"
            }
          },
          {
            "name": "location_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^loc_[0-9a-z]{26}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Converted into its own record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["converted"]
                    },
                    "business_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "A split request was recorded for an operator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["split_requested"]
                    },
                    "request_id": {
                      "type": "integer",
                      "format": "int64"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The location is not a storefront"
          },
          "403": {
            "description": "The business is not claimed directly by this owner"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The company is itself a location, or the place is at the registered address"
          },
          "422": {
            "description": "The company has no register identity, so it cannot have shops with their own pages"
          }
        }
      }
    },
      "/v1/owner/businesses/{business_id}/channels": {
        "get": {
          "operationId": "listChannels",
          "summary": "The business's channels with their connection and last publish status",
          "description": "Lists the pull-based website snippets and every push channel, connected or not, with its last publish status. The website snippets and JSON-LD are free; push channels are free too.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "The channel list",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "business_id": {
                        "type": "string"
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            },
            "403": {
              "description": "The owner has not proved control of this business"
            },
            "404": {
              "$ref": "#/components/responses/NotFound"
            }
          }
        }
      },
      "/v1/owner/businesses/{business_id}/channels/{provider}": {
        "post": {
          "operationId": "connectChannel",
          "summary": "Connect or reconfigure a push channel",
          "description": "The webhook body is `{\"url\": string}` and the response carries `signing_secret` once; store it then, because a new secret is created every time the URL is saved.\n\nEvery delivery is a POST with `X-N4P-Event: facts.changed`, `X-N4P-Delivery` (a unique id per POST) and `X-N4P-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>`.\n\nThe payload fields are `event`, `delivery_id`, `business_id`, `trigger`, `sent_at`, `fields`, `removed` and `record_url`.\n\nA 2xx answer is success. 408, 429 and 5xx are retried after 1m, 5m, 30m, 2h and 12h, at most 6 attempts. Other 4xx and 3xx answers are not retried. The URL must be https on port 443 and a public host; private, loopback and IP-literal targets are refused.\n\nFor Google the body is empty and the response is `{\"auth_url\": string}`. For the development fake the body is `{\"fail\": \"none|transient|transient_once|permanent|reauth\"}`.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "provider",
              "in": "path",
              "required": true,
              "description": "The push channel provider.",
              "schema": {
                "type": "string",
                "enum": [
                  "webhook",
                  "google",
                  "fake"
                ]
              }
            }
          ],
          "requestBody": {
            "required": true,
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "fail": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": "For Google: the URL to send the owner to",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "auth_url": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "201": {
              "description": "The channel is connected. A webhook response also carries the signing secret, shown only once."
            },
            "400": {
              "$ref": "#/components/responses/BadRequest"
            },
            "403": {
              "description": "The owner has not proved control of this business"
            },
            "404": {
              "$ref": "#/components/responses/NotFound"
            },
            "409": {
              "description": "The channel changed at the same time; try again"
            },
            "503": {
              "description": "This channel is not available on this deployment yet"
            }
          }
        },
        "delete": {
          "operationId": "disconnectChannel",
          "summary": "Disconnect a channel",
          "description": "Ends the connection: the stored credential is erased and queued work is cancelled. Disconnecting always works.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "provider",
              "in": "path",
              "required": true,
              "description": "The push channel provider.",
              "schema": {
                "type": "string",
                "enum": [
                  "webhook",
                  "google",
                  "fake"
                ]
              }
            }
          ],
          "responses": {
            "204": {
              "description": "The channel was disconnected"
            },
            "400": {
              "description": "The website channel needs no connection"
            },
            "403": {
              "description": "The owner has not proved control of this business"
            },
            "404": {
              "description": "No such channel or the channel is not connected"
            }
          }
        }
      },
      "/v1/owner/businesses/{business_id}/channels/{provider}/publish": {
        "post": {
          "operationId": "publishChannel",
          "summary": "Publish the current values to a channel now",
          "description": "Queues the current winning values of every published field for this channel. The worker publishes within a minute.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "provider",
              "in": "path",
              "required": true,
              "description": "The push channel provider.",
              "schema": {
                "type": "string",
                "enum": [
                  "webhook",
                  "google",
                  "fake"
                ]
              }
            }
          ],
          "responses": {
            "202": {
              "description": "The job was queued",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "job_id": {
                        "type": "integer"
                      },
                      "state": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "403": {
              "description": "The owner has not proved control of this business"
            },
            "404": {
              "$ref": "#/components/responses/NotFound"
            },
            "409": {
              "description": "The channel is not connected, or a Google location has not been chosen"
            },
            "503": {
              "description": "This channel is not available on this deployment yet"
            }
          }
        }
      },
      "/v1/owner/businesses/{business_id}/channels/{provider}/events": {
        "get": {
          "operationId": "listChannelEvents",
          "summary": "Recent publish audit rows of a channel",
          "description": "Returns the newest publish audit rows for this channel, including those of a disconnected account.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "provider",
              "in": "path",
              "required": true,
              "description": "The push channel provider.",
              "schema": {
                "type": "string",
                "enum": [
                  "webhook",
                  "google",
                  "fake"
                ]
              }
            },
            {
              "name": "limit",
              "in": "query",
              "required": false,
              "description": "How many audit rows, 1-200. Default 50.",
              "schema": {
                "type": "integer",
                "minimum": 1,
                "maximum": 200
              }
            }
          ],
          "responses": {
            "200": {
              "description": "The audit rows",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            },
            "400": {
              "$ref": "#/components/responses/BadRequest"
            },
            "403": {
              "description": "The owner has not proved control of this business"
            },
            "404": {
              "$ref": "#/components/responses/NotFound"
            }
          }
        }
      },
      "/v1/owner/businesses/{business_id}/channels/google/locations": {
        "get": {
          "operationId": "listGoogleLocations",
          "summary": "Google locations the connected account can manage",
          "description": "Reads the locations of the connected Google account. Only the first page of accounts and locations is read.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "The locations",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "address": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "403": {
              "description": "The owner has not proved control of this business"
            },
            "409": {
              "description": "Google is not connected or asks to be reconnected"
            },
            "502": {
              "description": "Google refused or could not be reached"
            },
            "503": {
              "description": "This channel is not available on this deployment yet"
            }
          }
        }
      },
      "/v1/owner/businesses/{business_id}/channels/google/location": {
        "put": {
          "operationId": "setGoogleLocation",
          "summary": "Choose the Google location to publish to",
          "description": "Records which Google location this business publishes to. It does not publish anything on its own.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            }
          ],
          "requestBody": {
            "required": true,
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "location"
                  ],
                  "properties": {
                    "location": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": "The updated Google channel"
            },
            "400": {
              "description": "That location is not one this Google account can manage"
            },
            "403": {
              "description": "The owner has not proved control of this business"
            },
            "409": {
              "description": "Google is not connected or asks to be reconnected"
            },
            "502": {
              "description": "Google refused or could not be reached"
            },
            "503": {
              "description": "This channel is not available on this deployment yet"
            }
          }
        }
      },
      "/v1/owner/channels/google/callback": {
        "post": {
          "operationId": "googleCallback",
          "summary": "Finish connecting Google with the OAuth code and state",
          "description": "Exchanges the code from Google and stores the encrypted credential. The state is signed, valid for ten minutes and bound to the owner and business that started the flow.",
          "tags": [
            "owner"
          ],
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "requestBody": {
            "required": true,
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "state"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": "Google is connected",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "business_id": {
                        "type": "string"
                      },
                      "needs_location": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            },
            "400": {
              "$ref": "#/components/responses/BadRequest"
            },
            "403": {
              "description": "The sign-in was started by another account, or the business is not claimed"
            },
            "503": {
              "description": "This channel is not available on this deployment yet"
            }
          }
        }
      },
      "/w/{business_id}/jsonld": {
        "get": {
          "operationId": "widgetJsonld",
          "summary": "The record's schema.org JSON-LD for the owner's website",
          "description": "Returns exactly the JSON-LD embedded in the record's public page. Only claimed, published records are served.",
          "tags": [
            "read"
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "The widget body",
              "content": {
                "application/ld+json": {
                  "schema": {
                    "type": "string"
                  }
                }
              }
            },
            "404": {
              "$ref": "#/components/responses/NotFound"
            }
          }
        }
      },
      "/w/{business_id}/hours.js": {
        "get": {
          "operationId": "widgetHoursScript",
          "summary": "Embeddable opening-hours widget",
          "description": "A self-contained script that renders a localized heading and the record's current opening hours. It does not render the business name, because the site that embeds the widget owns it. It uses DOM APIs and textContent only, and it ends with a \"Data from n4p\" link to the record. Returns 404 as JavaScript when the record has no hours.",
          "tags": [
            "read"
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "lang",
              "in": "query",
              "description": "Language of the heading and labels. Defaults to the language of the business's canton, else `de`; an unknown value falls back to that default.",
              "schema": {
                "type": "string",
                "enum": [
                  "de",
                  "fr",
                  "it",
                  "en"
                ]
              }
            }
          ],
          "responses": {
            "200": {
              "description": "The widget body",
              "content": {
                "text/javascript": {
                  "schema": {
                    "type": "string"
                  }
                }
              }
            },
            "404": {
              "$ref": "#/components/responses/NotFound"
            }
          }
        }
      },
      "/w/{business_id}/menu.js": {
        "get": {
          "operationId": "widgetMenuScript",
          "summary": "Embeddable menu widget",
          "description": "A self-contained script that renders a localized heading and the record's current menu. It does not render the business name, because the site that embeds the widget owns it. It uses DOM APIs and textContent only, and it ends with a \"Data from n4p\" link to the record. Returns 404 as JavaScript when the record has no menu.",
          "tags": [
            "read"
          ],
          "parameters": [
            {
              "name": "business_id",
              "in": "path",
              "required": true,
              "description": "The opaque business id.",
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "lang",
              "in": "query",
              "description": "Language of the heading and labels. Defaults to the language of the business's canton, else `de`; an unknown value falls back to that default.",
              "schema": {
                "type": "string",
                "enum": [
                  "de",
                  "fr",
                  "it",
                  "en"
                ]
              }
            }
          ],
          "responses": {
            "200": {
              "description": "The widget body",
              "content": {
                "text/javascript": {
                  "schema": {
                    "type": "string"
                  }
                }
              }
            },
            "404": {
              "$ref": "#/components/responses/NotFound"
            }
          }
        }
      }
  },
  "components": {
    "responses": {
      "BadRequest": {
        "description": "The request was malformed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "No such record",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "ListingRequestStatus": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "Absent when an existing record matched and no request was stored"
          },
          "status": {
            "type": "string",
            "enum": [
              "received",
              "matched_existing",
              "imported",
              "needs_review",
              "not_found",
              "claimed"
            ]
          },
          "result_business_id": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Fact": {
        "type": "object",
        "description": "One authoritative field value and the provenance of the observation that won it.",
        "required": [
          "value",
          "source",
          "method",
          "confidence",
          "verified_at",
          "confirmed_at",
          "fresh_until",
          "stale"
        ],
        "properties": {
          "value": {
            "description": "The value. Its JSON shape depends on the field."
          },
          "source": {
            "type": "string",
            "description": "Which source won, for example `zefix`, `osm`, `owner`."
          },
          "method": {
            "type": "string",
            "enum": [
              "none",
              "open_data",
              "geocoded",
              "self_attestation",
              "email_domain",
              "phone_otp",
              "dns_txt",
              "postcard",
              "website_uid",
              "registry"
            ]
          },
          "confidence": {
            "type": "string",
            "enum": [
              "unverified",
              "self_reported",
              "verified"
            ]
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When a source last re-confirmed this value. Freshness is measured from here, not from verified_at: a value first observed three years ago and re-confirmed today is fresh."
          },
          "fresh_until": {
            "type": "string",
            "format": "date-time",
            "description": "When the value's freshness window expires."
          },
          "stale": {
            "type": "boolean",
            "description": "True once now is past fresh_until. Staleness never changes confidence: a stale value is reported, not demoted."
          },
          "lang": {
            "type": "string",
            "enum": ["de", "fr", "it", "rm", "en"],
            "description": "The language a prose value is written in, as ISO 639-1. Set on `purpose`, which the commercial register publishes untagged in the language the company registered in. Absent when the language cannot be told. The value is never translated: quote it as it is and say which language it is in. Derived from the value, so it is not part of the signed record."
          },
          "register_locked": {
            "type": "boolean",
            "description": "True when a commercial register value decides this field: the legal name, legal form, purpose, name translations and registered seat, and a status of `in_liquidation` or `closed`. Such a value outranks every other source, an owner's verified correction included, and owner writes to the field are refused with `register_field`. It changes only at the register. Derived from the source, so it is not part of the signed record."
          }
        }
      },
      "LegalFormDetail": {
        "type": "object",
        "description": "The `legal_form` code resolved to its name in each language, so a form can be named in the user's language without a lookup. The code in `facts.legal_form` remains the fact; this is derived and not signed.",
        "required": ["code", "scheme", "uri", "labels", "official_languages"],
        "properties": {
          "code": { "type": "string", "example": "0109", "description": "The eCH-0097 code, the same value as `facts.legal_form`." },
          "scheme": { "type": "string", "example": "eCH-0097" },
          "uri": { "type": "string", "format": "uri", "example": "https://ld.admin.ch/ech/97/legalforms/0109", "description": "The code's definition in the federal LINDAS service." },
          "labels": {
            "type": "object",
            "additionalProperties": { "type": "string" },
            "example": { "en": "Association", "de": "Verein", "fr": "Association", "it": "Associazione" },
            "description": "The form's name by ISO 639-1 language: en, de, fr and it."
          },
          "abbreviations": {
            "type": "object",
            "additionalProperties": { "type": "string" },
            "example": { "de": "GmbH", "fr": "Sàrl", "it": "Sagl" },
            "description": "The abbreviation used in company names, by language. Absent for forms without one."
          },
          "official_languages": {
            "type": "array",
            "items": { "type": "string" },
            "example": ["de", "fr"],
            "description": "Languages whose labels are the official LINDAS wording. The others are n4p translations."
          }
        }
      },
      "Identifier": {
        "type": "object",
        "required": [
          "scheme",
          "value",
          "source",
          "method",
          "confidence",
          "verified_at"
        ],
        "properties": {
          "scheme": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "confidence": {
            "type": "string"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Observation": {
        "type": "object",
        "description": "One source's view of one field. Present only when `include=observations`.",
        "properties": {
          "field": {
            "type": "string"
          },
          "value": {},
          "source": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "confidence": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Record": {
        "type": "object",
        "required": [
          "business_id",
          "status",
          "record_confidence",
          "record_completeness",
          "missing_core_fields",
          "claim_status",
          "freshness",
          "stale",
          "facts",
          "identifiers",
          "updated_at",
          "license",
          "rights"
        ],
        "properties": {
          "business_id": {
            "type": "string",
            "pattern": "^biz_[0-9a-z]{26}$",
            "description": "Opaque. Carries no country and no provider."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "temporarily_closed",
              "in_liquidation",
              "closed",
              "unknown"
            ]
          },
          "record_confidence": {
            "type": "string",
            "enum": [
              "unverified",
              "self_reported",
              "verified"
            ],
            "description": "The weakest confidence among the present identity core fields (name, address, categories, status, hours). Missing fields do not lower it: they are reported by `record_completeness`, so a register-only record is verified for what it states even when categories or hours are absent. Geo is derived enrichment and is judged per-fact. This is a trust signal, not a freshness signal: read `record_completeness`, `freshness` and `claim_status` alongside it."
          },
          "record_completeness": {
            "type": "string",
            "enum": [
              "complete",
              "incomplete"
            ],
            "description": "Complete when every core field (name, address, geo, categories, status, hours) has a value. A freshly imported register record is often incomplete without being stale."
          },
          "missing_core_fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Core fields with no value. Empty when the record is complete."
          },
          "claim_status": {
            "type": "string",
            "enum": [
              "claimed",
              "unclaimed"
            ],
            "description": "Claimed when an owner has proved control of the record. Unclaimed means nobody has. A pending claim is not counted as claimed. This exposes no owner identity."
          },
          "claim_url": {
            "type": "string",
            "format": "uri",
            "description": "Where a human can claim this record, or sign in to manage it when claim_status is claimed. Present only when the deployment publishes an owner console. It is not a write path: agents cannot change a fact through it."
          },
          "freshness": {
            "type": "string",
            "enum": [
              "fresh",
              "stale",
              "unknown"
            ],
            "description": "Fresh when every core field is present and inside its window. Stale when a present core field has expired. Unknown when the record is incomplete and nothing has expired: there is no record-wide expiry to promise."
          },
          "facts": {
            "type": "object",
            "description": "The authoritative value of every present field, keyed by field name. `facts.special_hours.value` is an array of SpecialHoursEntry, sorted by `from`.",
            "additionalProperties": {
              "$ref": "#/components/schemas/Fact"
            }
          },
          "identifiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Identifier"
            }
          },
          "locations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Location"
            },
            "description": "Physical places the business operates. The address fact is the registered seat, which may not be visitable. Omitted from search results."
          },
          "operated_by": {
            "$ref": "#/components/schemas/LinkedBusiness",
            "description": "The legal entity that operates this location. Absent when the record is not a linked location."
          },
          "linked_locations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LinkedBusiness"
            },
            "description": "Visitable locations this legal entity operates. Each is its own record with its own page. Omitted from search results."
          },
          "observations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Observation"
            }
          },
          "merged_into": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "license": {
            "type": "string"
          },
          "open_now": {
            "type": "boolean",
            "description": "Whether the business is open at the moment of the request (or `at`). On a date covered by `special_hours`, that entry decides; otherwise the weekly hours. Absent means unknown: no special entry for the date and no parseable weekly hours. It is absent rather than false so that a client never tells somebody a shop is shut when nobody knows."
          },
          "hours_week": {
            "type": "array",
            "description": "Opening hours parsed into a week, Monday first, so a client does not have to implement the syntax. The raw string stays in facts.hours as the authoritative value with its provenance.",
            "items": {
              "type": "object",
              "properties": {
                "weekday": {
                  "type": "string",
                  "example": "Mo"
                },
                "spans": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "open": {
                        "type": "string",
                        "example": "08:00"
                      },
                      "close": {
                        "type": "string",
                        "example": "18:00"
                      }
                    }
                  }
                },
                "closed": {
                  "type": "boolean"
                }
              }
            }
          },
          "legal_form_detail": {
            "$ref": "#/components/schemas/LegalFormDetail"
          },
          "menu_summary": {
            "$ref": "#/components/schemas/MenuSummary"
          },
          "fresh_until": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest expiry among the core fields. Absent when a core field is missing, because an incomplete record has no meaningful expiry."
          },
          "stale": {
            "type": "boolean",
            "description": "True when any present core field is past its freshness window. False for an incomplete record whose present values are current: that record is `record_completeness: incomplete` with `freshness: unknown`, not stale. Like a fact's stale flag, it is a warning and does not lower confidence."
          },
          "rights": {
            "$ref": "#/components/schemas/Rights"
          }
        }
      },
      "SearchItem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Record"
          },
          {
            "type": "object",
            "properties": {
              "distance_m": {
                "type": "number",
                "description": "Present only when searching with `near`."
              },
              "operated_by": {
                "$ref": "#/components/schemas/LinkedBusiness",
                "description": "The legal entity that operates this location, for showing \"… · operated by …\"."
              }
            }
          }
        ]
      },
      "Place": {
        "type": "object",
        "required": [
          "locality",
          "canton",
          "country",
          "postal_codes",
          "lat",
          "lon",
          "address_count",
          "source"
        ],
        "properties": {
          "locality": {
            "type": "string",
            "description": "Town or city name, as spelled in the official address directory."
          },
          "canton": {
            "type": "string",
            "description": "Swiss canton code, for example ZH. A locality name can exist in several cantons."
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code."
          },
          "postal_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Postcodes this centre covers, largest first."
          },
          "lat": {
            "type": "number",
            "description": "Latitude of the centre in WGS84 decimal degrees; pass as near_lat."
          },
          "lon": {
            "type": "number",
            "description": "Longitude of the centre in WGS84 decimal degrees; pass as near_lon."
          },
          "address_count": {
            "type": "integer",
            "description": "Number of official building addresses behind the centre. A larger place has a more reliable centre."
          },
          "source": {
            "type": "string",
            "description": "Source of the coordinates, swisstopo."
          }
        }
      },
      "Change": {
        "type": "object",
        "required": [
          "seq",
          "business_id",
          "kind",
          "actor",
          "at",
          "prev_hash",
          "hash"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "description": "Monotonic cursor. Use it as `since`."
          },
          "business_id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "create",
              "fact",
              "identifier_add",
              "identifier_remove",
              "merge",
              "claim",
              "claim_revoke",
              "location_add",
              "location_update",
              "location_remove",
              "link_add",
              "link_remove"
            ],
            "description": "Clients must ignore kinds they do not know: new kinds are added without a version bump. link_add / link_remove are written on the location; new_value / old_value carry {\"operated_by\": parent_id}. claim_revoke carries {\"claim_id\": ..., \"method\": ...} in old_value; the operator's reason stays out of the public feed."
          },
          "field": {
            "type": "string"
          },
          "old_value": {},
          "new_value": {},
          "source": {
            "type": "string"
          },
          "actor": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "prev_hash": {
            "type": "string",
            "description": "Hex sha256 of the previous entry, or 64 zeroes for the first entry."
          },
          "hash": {
            "type": "string",
            "description": "Hex sha256 of the previous hash bytes followed by the RFC 8785 canonical JSON of this entry."
          }
        }
      },
      "Stats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "by_status": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "by_country": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "by_record_confidence": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "by_source": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "latest_seq": {
            "type": "integer",
            "description": "The current change cursor, read live on every request."
          },
          "merged_businesses": {
            "type": "integer"
          },
          "stale_facts_by_field": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Facts whose freshness window has expired, per field."
          },
          "businesses_with_stale_core_fact": {
            "type": "integer",
            "description": "Records where at least one core fact is stale, which is the number worth watching."
          },
          "machine_reads_30d": {
            "type": "integer",
            "description": "Listing reads by AI agents and crawlers over the last 30 days, summed across all businesses. People and the owner console are not counted."
          },
          "computed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the aggregates were computed. They are a snapshot refreshed on every static generation run (hourly in production); latest_seq is always current."
          }
        }
      },
      "Source": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "licence": {
            "type": "string"
          },
          "licence_url": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          },
          "homepage": {
            "type": "string"
          },
          "licence_id": {
            "type": "string"
          },
          "licence_type": {
            "type": "string",
            "enum": [
              "licence",
              "terms"
            ]
          },
          "attribution_required": {
            "type": "boolean"
          },
          "share_alike": {
            "type": "boolean"
          },
          "commercial_use": {
            "type": "boolean"
          },
          "redistribution": {
            "type": "boolean"
          },
          "terms_version": {
            "type": "string"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "Session": {
        "type": "object",
        "required": [
          "token",
          "expires_at",
          "owner_id"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "Send as `Authorization: Bearer <token>`."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "owner_id": {
            "type": "string"
          }
        }
      },
      "Plan": {
        "type": "object",
        "required": [
          "billing_configured"
        ],
        "properties": {
          "billing_configured": {
            "type": "boolean",
            "description": "False when this deployment has no payment provider, in which case a postcard cannot be bought."
          },
          "amount": {
            "type": "integer",
            "description": "Subscription price in the currency's smallest unit. Absent while subscriptions are switched off."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency of amount."
          },
          "postcard_price": {
            "type": "integer",
            "description": "One-time postcard price in the currency's smallest unit; absent when not sold"
          },
          "interval": {
            "type": "string",
            "description": "Billing interval in the PHP DateInterval form used by the provider, for example P1M. Absent while subscriptions are switched off."
          }
        }
      },
      "Me": {
        "type": "object",
        "properties": {
          "owner_id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "entitled": {
            "type": "boolean",
            "description": "Whether this owner may use the owner features. Always true while subscriptions are switched off."
          },
          "claimed_businesses": {
            "type": "integer"
          },
          "subscription_status": {
            "type": "string",
            "description": "The payment provider's status verbatim. Absent while subscriptions are switched off, and when the owner has never subscribed."
          },
          "entitlement_source": {
            "type": "string",
            "enum": ["", "free", "subscription", "grant", "dev_override"],
            "description": "\"free\" while subscriptions are switched off (the default). Otherwise a live subscription, access granted by an operator, or a development override; empty when the owner is not entitled."
          },
          "grant_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When access granted by an operator runs out. Present whenever the account holds a live grant with an end date, including when a subscription is what entitles it; absent for an indefinite grant."
          },
          "billing_configured": {
            "type": "boolean",
            "description": "False when the deployment has no payment provider, in which case a postcard cannot be bought."
          },
          "billing_amount": {
            "type": "integer",
            "description": "Configured subscription price in the currency's smallest unit. Absent while subscriptions are switched off, when billing is unconfigured or the price is zero."
          },
          "billing_currency": {
            "type": "string",
            "description": "ISO 4217 currency of billing_amount."
          },
          "billing_interval": {
            "type": "string",
            "description": "Billing interval in the PHP DateInterval form used by the provider, for example P1M. Absent while subscriptions are switched off."
          },
          "postcard_available": {
            "type": "boolean",
            "description": "True when a postal provider is configured. Whether a card is paid or unavailable is answered by GET /v1/postcard-quote."
          },
          "phone_available": {
            "type": "boolean",
            "description": "True when the deployment can send text messages. When false, POST /v1/claims refuses phone_otp and the console does not offer it."
          },
          "usage_report_email": {
            "type": "boolean",
            "description": "Whether the owner receives the monthly usage report by email. Off until the owner turns it on."
          },
          "staleness_email": {
            "type": "boolean",
            "description": "Whether the owner receives the weekly reminder to confirm facts that have gone stale. Off until the owner turns it on."
          },
          "locale": {
            "type": "string",
            "enum": ["en", "de", "fr", "it"],
            "description": "The language of the owner's emails. en until the owner signs in from the console with a language set or chooses one in Settings."
          }
        }
      },
      "InviteLookup": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "live",
              "expired",
              "revoked",
              "redeemed",
              "rejected",
              "locked"
            ]
          },
          "business_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "description": "The public form of the address the card was sent to, lines separated by \\n"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "claimed": {
            "type": "boolean"
          },
          "yours": {
            "type": "boolean"
          }
        }
      },
      "Handover": {
        "type": "object",
        "required": ["handover_id", "business_id", "to_email", "status", "created_at", "expires_at"],
        "properties": {
          "handover_id": { "type": "string" },
          "business_id": { "type": "string" },
          "to_email": { "type": "string", "description": "The address the offer was sent to, lower-cased" },
          "status": { "type": "string", "enum": ["live", "expired", "accepted", "declined", "cancelled", "void"],
                      "description": "void: the claim it was made from is no longer the approved claim on the business" },
          "created_at": { "type": "string", "format": "date-time" },
          "expires_at": { "type": "string", "format": "date-time" },
          "accepted_at": { "type": "string", "format": "date-time" },
          "declined_at": { "type": "string", "format": "date-time" },
          "cancelled_at": { "type": "string", "format": "date-time" },
          "cancel_reason": { "type": "string", "enum": ["owner", "expired", "void"] }
        }
      },
      "HandoverLookup": {
        "type": "object",
        "required": ["business_name", "expires_at"],
        "properties": {
          "business_name": { "type": "string" },
          "expires_at": { "type": "string", "format": "date-time" }
        }
      },
      "ClaimChallenge": {
        "type": "object",
        "required": ["challenge_id", "business_id", "status", "opened_at", "respond_by", "incumbent", "challenger"],
        "properties": {
          "challenge_id": { "type": "string" },
          "business_id": { "type": "string" },
          "status": { "type": "string", "enum": ["open", "contested", "transferred", "kept", "withdrawn", "void"],
                      "description": "open waits for the incumbent, contested for an operator; the other four are final" },
          "opened_at": { "type": "string", "format": "date-time" },
          "respond_by": { "type": "string", "format": "date-time", "description": "The deadline: 14 days, 30 when the incumbent was active on the business recently, or 7 when the incumbent was dormant" },
          "responded_at": { "type": "string", "format": "date-time" },
          "response": { "type": "string", "enum": ["accept", "decline"] },
          "incumbent": {
            "type": "object",
            "required": ["claim_id", "method", "rank"],
            "properties": {
              "claim_id": { "type": "string" },
              "method": { "type": "string" },
              "rank": { "type": "integer", "description": "5 postcard to the registered seat, 4 another postcard, 3 dns_txt, 2 email_domain, 1 website_uid or phone_otp, 0 a handed-over or transferred claim" }
            }
          },
          "challenger": {
            "type": "object",
            "required": ["claim_id", "method", "rank"],
            "properties": {
              "claim_id": { "type": "string" },
              "method": { "type": "string" },
              "rank": { "type": "integer" }
            }
          },
          "statement": { "type": "string", "description": "The challenger's words. The incumbent's own statement is never returned here." },
          "resolved_at": { "type": "string", "format": "date-time" },
          "resolved_by": { "type": "string", "enum": ["challenger", "incumbent", "operator", "system"] },
          "incumbent_dormant": { "type": "boolean", "description": "Only in the incumbent's and the operator's views: true when the incumbent had shown no sign of life (no activity on the business and no sign-in) for a year when the challenge opened. The window is then 7 days, and a proof by email at the business's domain also transfers on silence. Never shown to the challenger." }
        }
      },
      "Claim": {
        "type": "object",
        "properties": {
          "claim_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected",
              "revoked"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "email_domain",
              "phone_otp",
              "dns_txt",
              "website_uid",
              "postcard",
              "postcard_invite",
              "operator_transfer",
              "owner_handover"
            ]
          },
          "domain": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "website": {
            "type": "string",
            "description": "The website that was checked, for website_uid claims."
          },
          "uid": {
            "type": "string",
            "description": "The Swiss UID found on the website, for website_uid claims."
          },
          "publish_website": {
            "type": "boolean",
            "description": "For website_uid claims, whether the website is published on the record once the claim is proved."
          },
          "uid_page": {
            "type": "string",
            "description": "The page where the UID was found, for website_uid claims."
          },
          "verify_url": {
            "type": "string",
            "description": "The well-known file URL to publish, for website_uid claims."
          },
          "verify_token": {
            "type": "string",
            "description": "The line to write into the verification file, for website_uid claims."
          },
          "dns_record": {
            "type": "string",
            "description": "The TXT record name to publish."
          },
          "dns_token": {
            "type": "string",
            "description": "The value to publish, for dns_txt and website_uid claims."
          },
          "postcard_address": {
            "type": "string",
            "description": "Where the card was posted, for postcard claims."
          },
          "postcard_status": {
            "type": "string",
            "enum": ["queued", "printed", "posted", "cancelled", "sent"],
            "description": "Where a postcard claim's card is: queued (waiting to be printed in-house), printed, posted, cancelled, or sent (handed to a mailing provider)."
          },
          "postcard_posted_at": {
            "type": "string",
            "format": "date-time",
            "description": "When an in-house card was posted."
          },
          "business_id": {
            "type": "string",
            "description": "The business the claim is for, on a stored claim."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the challenge stops being usable; absent when it does not expire."
          },
          "message": {
            "type": "string",
            "description": "What happens next, in plain words."
          },
          "other_pending": {
            "type": "boolean",
            "description": "Only on a new pending claim from POST /v1/claims, omitted when false: another account also has a live pending claim on this business. No identity, count or method is given."
          },
          "challenge": {
            "type": "boolean",
            "description": "True when this pending claim challenges another approved claim. Omitted when false."
          },
          "challenge_of": {
            "type": "string",
            "description": "The approved claim a challenge claim names. Empty or absent for an ordinary claim."
          },
          "reprove": { "type": "boolean", "description": "True when this claim re-proves the caller's handed-over or transferred claim. Omitted when false." },
          "reproves": { "type": "string", "description": "The approved claim a re-prove claim upgrades." },
          "reproved_at": { "type": "string", "format": "date-time", "description": "On an approved claim: when a re-prove upgraded it to its current method. On a re-prove claim: when it succeeded." }
        }
      },
      "BusinessUsage": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string"
          },
          "since": {
            "type": "string",
            "format": "date"
          },
          "until": {
            "type": "string",
            "format": "date"
          },
          "days": {
            "type": "integer"
          },
          "totals": {
            "type": "object",
            "properties": {
              "lookups": { "type": "integer" },
              "search_hits": { "type": "integer" },
              "record_reads": { "type": "integer" },
              "menu_reads": { "type": "integer" },
              "resolutions": { "type": "integer" },
              "lookup_reads": { "type": "integer" },
              "crawl_reads": { "type": "integer" }
            }
          },
          "by_kind": {
            "type": "object",
            "additionalProperties": { "type": "integer" }
          },
          "by_class": {
            "type": "object",
            "additionalProperties": { "type": "integer" }
          },
          "by_family": {
            "type": "object",
            "description": "Reads per coarse client family. Recognised agents and crawlers use their family key, for example openai-search, anthropic-training, mcp or google. Reads not recognised as an agent or crawler (browsers, scripts and crawlers that are not on the list) are counted under the key unrecognised. That key is not a count of people.",
            "additionalProperties": { "type": "integer" }
          },
          "timeline": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": { "type": "string", "format": "date" },
                "lookups": { "type": "integer" }
              }
            }
          }
        }
      },
      "Staleness": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "record_confidence": {
            "type": "string"
          },
          "stale": {
            "type": "boolean",
            "description": "True when any present fact is past its freshness window. Missing fields are reported in `missing_core` and are not stale."
          },
          "stale_core": {
            "type": "boolean",
            "description": "True when a present core fact is past its freshness window."
          },
          "missing_core": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Core fields with no value at all."
          },
          "claim_website": {
            "type": "string",
            "description": "The website the owner proved control of with a website_uid claim, if that is how the business was claimed."
          },
          "claim_method": { "type": "string", "description": "The method of the caller's direct approved claim on this business; empty when it is managed through its operator's claim. owner_handover and operator_transfer can be re-proved with POST /v1/claims and \"reprove\": true." },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "present": {
                  "type": "boolean"
                },
                "missing": {
                  "type": "boolean"
                },
                "core": {
                  "type": "boolean"
                },
                "source": {
                  "type": "string"
                },
                "confidence": {
                  "type": "string"
                },
                "confirmed_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "fresh_until": {
                  "type": "string",
                  "format": "date-time"
                },
                "stale": {
                  "type": "boolean"
                },
                "age_days": {
                  "type": "integer"
                },
                "freshness_days": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "ReconfirmResult": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string"
          },
          "reconfirmed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "skipped": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Fields with no value and nothing to confirm against."
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Signature": {
        "type": "object",
        "required": [
          "kid",
          "alg",
          "payload",
          "signature"
        ],
        "properties": {
          "kid": {
            "type": "string",
            "description": "Which published key signed this."
          },
          "alg": {
            "type": "string",
            "const": "Ed25519"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "description": "The exact object that was signed, canonicalised with RFC 8785. Its `type` field says which kind of payload it is: n4p.record, n4p.changes or n4p.snapshot."
          },
          "signature": {
            "type": "string",
            "description": "base64url Ed25519 over the canonical payload."
          },
          "digest": {
            "type": "string",
            "description": "sha256:<hex> of the canonical data, for a record signature."
          },
          "verify": {
            "type": "string",
            "description": "How to check it, in plain words."
          }
        }
      },
      "Snapshot": {
        "type": "object",
        "properties": {
          "snapshot_id": {
            "type": "string"
          },
          "latest_seq": {
            "type": "integer"
          },
          "record_count": {
            "type": "integer"
          },
          "sha256": {
            "type": "string",
            "description": "Hex digest of the compressed file bytes."
          },
          "size_bytes": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "kid": {
            "type": "string"
          },
          "alg": {
            "type": "string"
          },
          "payload": {
            "description": "The signed payload."
          },
          "signature": {
            "type": "string"
          },
          "download_url": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "verify": {
            "type": "string"
          }
        }
      },
      "ResolveRequest": {
        "type": "object",
        "description": "What the caller knows. Everything except an identifier is optional, and a name alone is allowed.",
        "properties": {
          "name": {
            "type": "string",
            "description": "The business name as the caller has it, including a misspelling or without the legal form.",
            "example": "Bäckerei Muster"
          },
          "address": {
            "type": "string",
            "description": "A free-text address. A postcode inside it is used when `postal_code` is absent.",
            "example": "Spalenring 113, 4055 Basel"
          },
          "postal_code": {
            "type": "string",
            "description": "Postcode. Spaces are ignored, so `SW1A 1AA` and `sw1a1aa` are the same.",
            "example": "4055"
          },
          "locality": {
            "type": "string",
            "description": "Town or city.",
            "example": "Basel"
          },
          "near_lat": {
            "type": "number",
            "description": "Latitude of a map pin or device location. Requires `near_lon`.",
            "example": 47.5604
          },
          "near_lon": {
            "type": "number",
            "description": "Longitude of a map pin or device location. Requires `near_lat`.",
            "example": 7.5735
          },
          "uid": {
            "type": "string",
            "description": "A Swiss UID (CHE…) or a UK Companies House number. Resolves directly, with no name matching.",
            "example": "CHE-106.145.086"
          },
          "phone": {
            "type": "string",
            "description": "A phone number. Resolves directly when exactly one record carries it."
          },
          "domain": {
            "type": "string",
            "description": "A website domain. Narrows the candidates; a shared domain is ambiguous rather than exact."
          }
        }
      },
      "ResolveResponse": {
        "type": "object",
        "required": [
          "match",
          "score",
          "reason",
          "alternatives",
          "license"
        ],
        "properties": {
          "match": {
            "type": "string",
            "enum": [
              "exact",
              "likely",
              "ambiguous",
              "none"
            ],
            "description": "How confident the answer is, and therefore what the caller should do with it."
          },
          "business_id": {
            "type": "string",
            "description": "The chosen record. Present only for `exact` and `likely`."
          },
          "score": {
            "type": "number",
            "description": "0 to 1. A blended name-and-location score, or 1 for an identifier hit. It is a ranking aid, not a probability."
          },
          "matched_by": {
            "type": "string",
            "description": "The signal that decided it: a scheme such as `ch.uid`, or `name+postcode`."
          },
          "reason": {
            "type": "string",
            "description": "The decision in words, for logs and for an agent to relay. A score alone does not say whether to trust it."
          },
          "record": {
            "$ref": "#/components/schemas/Record"
          },
          "alternatives": {
            "type": "array",
            "description": "Other plausible candidates, best first. For an ambiguous answer this includes every candidate, the best one too.",
            "items": {
              "$ref": "#/components/schemas/ResolveAlternative"
            }
          },
          "license": {
            "type": "string",
            "example": "ODbL-1.0"
          }
        }
      },
      "ResolveAlternative": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "score": {
            "type": "number"
          },
          "postal_code": {
            "type": "string"
          },
          "locality": {
            "type": "string"
          },
          "distance_m": {
            "type": "number",
            "description": "Distance from the search point, when one was known."
          }
        }
      },
      "Category": {
        "type": "object",
        "required": [
          "tag",
          "tags",
          "label",
          "labels"
        ],
        "properties": {
          "tag": {
            "type": "string",
            "example": "shop=bakery",
            "description": "The canonical OSM tag."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every tag this concept is stored under, canonical first. Matching any of them is correct."
          },
          "label": {
            "type": "string",
            "example": "Boulangerie",
            "description": "The name in the requested language."
          },
          "labels": {
            "type": "object",
            "description": "The name in every supported language.",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "MenuResponse": {
        "type": "object",
        "required": [
          "business_id",
          "menu",
          "source",
          "method",
          "confidence",
          "confirmed_at",
          "fresh_until",
          "stale",
          "license"
        ],
        "properties": {
          "business_id": {
            "type": "string"
          },
          "menu": {
            "$ref": "#/components/schemas/Menu"
          },
          "source": {
            "type": "string",
            "example": "owner"
          },
          "method": {
            "type": "string",
            "example": "self_attestation"
          },
          "confidence": {
            "type": "string",
            "enum": [
              "self_reported",
              "verified"
            ]
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the owner last confirmed the menu. Freshness is measured from here."
          },
          "fresh_until": {
            "type": "string",
            "format": "date-time",
            "description": "Menus expire after three weeks."
          },
          "stale": {
            "type": "boolean",
            "description": "True once the three-week window has passed. The items are still served; they may be out of date."
          },
          "license": {
            "type": "string",
            "example": "ODbL-1.0"
          }
        }
      },
      "PutMenuRequest": {
        "type": "object",
        "required": [
          "menu"
        ],
        "properties": {
          "menu": {
            "$ref": "#/components/schemas/Menu"
          }
        },
        "description": "A menu. Publishing is free; only a claimed owner can write one."
      },
      "Menu": {
        "type": "object",
        "required": [
          "currency",
          "sections"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217 code. Every price in the menu is in minor units of it.",
            "example": "CHF"
          },
          "sections": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/MenuSection"
            }
          }
        }
      },
      "MenuSection": {
        "type": "object",
        "required": [
          "name",
          "items"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80,
            "example": "Breads"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/MenuItem"
            }
          }
        }
      },
      "MenuItem": {
        "type": "object",
        "required": [
          "name",
          "price"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120,
            "example": "Ruchbrot"
          },
          "price": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Minor units of the menu currency: 1250 is 12.50.",
            "example": 480
          },
          "unit": {
            "type": "string",
            "maxLength": 20,
            "description": "Qualifies the price, for example \"100 g\" or \"per person\".",
            "example": "per loaf"
          },
          "tags": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "type": "string",
              "enum": [
                "vegetarian",
                "vegan",
                "gluten_free",
                "lactose_free",
                "spicy",
                "alcohol"
              ]
            }
          }
        }
      },
      "MenuSummary": {
        "type": "object",
        "description": "The menu projected onto a record. Its presence means the business has a menu; the items are at /v1/businesses/{business_id}/menu.",
        "required": [
          "currency",
          "section_count",
          "item_count",
          "price_min",
          "price_max",
          "source",
          "method",
          "confidence",
          "confirmed_at",
          "fresh_until",
          "stale"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "example": "CHF"
          },
          "section_count": {
            "type": "integer",
            "example": 3
          },
          "item_count": {
            "type": "integer",
            "example": 24
          },
          "price_min": {
            "type": "integer",
            "description": "Lowest item price in minor units.",
            "example": 300
          },
          "price_max": {
            "type": "integer",
            "description": "Highest item price in minor units.",
            "example": 4200
          },
          "source": {
            "type": "string",
            "example": "owner"
          },
          "method": {
            "type": "string",
            "example": "self_attestation"
          },
          "confidence": {
            "type": "string",
            "enum": [
              "self_reported",
              "verified"
            ]
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time"
          },
          "fresh_until": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "type": "boolean",
            "description": "True once the three-week menu window has passed."
          }
        }
      },
      "MenuHit": {
        "type": "object",
        "required": [
          "business_id",
          "name",
          "status",
          "menu_stale",
          "matched_items"
        ],
        "properties": {
          "business_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "address": {
            "type": "object",
            "description": "The address fact, when the record has one.",
            "additionalProperties": true
          },
          "country": {
            "type": "string",
            "example": "CH"
          },
          "status": {
            "type": "string",
            "example": "active"
          },
          "open_now": {
            "type": "boolean",
            "description": "Absent when the opening hours are missing or unparseable."
          },
          "distance_m": {
            "type": "number"
          },
          "menu_stale": {
            "type": "boolean",
            "description": "True when the menu is older than three weeks; the prices may be out of date."
          },
          "menu_confidence": {
            "type": "string",
            "enum": [
              "self_reported",
              "verified"
            ]
          },
          "menu_confirmed_at": {
            "type": "string",
            "format": "date-time"
          },
          "matched_items": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/MenuMatch"
            }
          }
        }
      },
      "MenuMatch": {
        "type": "object",
        "required": [
          "name",
          "section",
          "price",
          "currency",
          "score"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "Fettuccine Alfredo"
          },
          "section": {
            "type": "string",
            "example": "Pasta"
          },
          "price": {
            "type": "integer",
            "description": "Minor units of currency.",
            "example": 2200
          },
          "currency": {
            "type": "string",
            "example": "CHF"
          },
          "unit": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "score": {
            "type": "number",
            "description": "Trigram similarity of the dish name to the query, 0 to 1."
          }
        }
      },
      "Location": {
        "type": "object",
        "description": "A place the business operates. The address fact is the registered seat; a location is somewhere a visitor may go. A location that is not a storefront has no geo and no transit by design.",
        "required": [
          "location_id",
          "is_storefront",
          "is_primary",
          "address",
          "source",
          "method",
          "confidence",
          "verified_at",
          "confirmed_at"
        ],
        "properties": {
          "location_id": {
            "type": "string",
            "pattern": "^loc_[0-9a-z]{26}$"
          },
          "source_key": {
            "type": "string",
            "description": "The owning source's stable id for this place, for example \"node/123\" for OpenStreetMap. Absent for an owner-created location."
          },
          "label": {
            "type": "string",
            "description": "Human label such as \"Zentrale\" or \"Filiale Basel\"."
          },
          "is_storefront": {
            "type": "boolean",
            "description": "True when the public may visit this location. An office or warehouse is false and then has no geo or transit."
          },
          "is_primary": {
            "type": "boolean",
            "description": "The location used for display and radius search. At most one per business."
          },
          "address": {
            "type": "object",
            "description": "A physical address. role is always location here.",
            "properties": {
              "street": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "locality": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "location"
                ]
              }
            },
            "required": [
              "locality",
              "country"
            ]
          },
          "geo": {
            "type": "object",
            "description": "WGS84 coordinates. Present only for a storefront and only after geocoding or an owner-supplied position.",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            }
          },
          "transit": {
            "type": "object",
            "description": "Nearby public transport, derived from geo. Absent when the location is not a storefront."
          },
          "source": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "confidence": {
            "type": "string",
            "enum": [
              "unverified",
              "self_reported",
              "verified"
            ]
          },
          "verified_by": {
            "type": "string",
            "description": "The owner actor that verified this location. Verification does not replace source: an OSM place can be owner-verified and remain attributed to OSM."
          },
          "verification_method": {
            "type": "string",
            "description": "How the owner proved control when verifying, for example email_domain."
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time"
          },
          "geo_source": {
            "type": "string"
          },
          "geo_method": {
            "type": "string"
          },
          "geo_confidence": {
            "type": "string"
          },
          "geo_confirmed_at": {
            "type": "string",
            "format": "date-time"
          },
          "transit_source": {
            "type": "string"
          },
          "transit_method": {
            "type": "string"
          },
          "transit_confidence": {
            "type": "string"
          },
          "transit_confirmed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "LinkedBusiness": {
        "type": "object",
        "required": [
          "business_id",
          "name"
        ],
        "properties": {
          "business_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "evidence": {
            "type": "string",
            "description": "On operated_by: what the link rests on (operator, owner, owner_created, proven_domain, shared_domain, shared_phone, osm_operator, osm_brand, merge, split)."
          },
          "owner_created": {
            "type": "boolean",
            "description": "On linked_locations: the owner added this location."
          }
        }
      },
      "LocationRequest": {
        "type": "object",
        "required": [
          "address"
        ],
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 120
          },
          "is_storefront": {
            "type": "boolean",
            "default": true,
            "description": "Set false for an office or warehouse. A non-storefront location cannot carry geo or transit."
          },
          "is_primary": {
            "type": "boolean"
          },
          "address": {
            "type": "object",
            "properties": {
              "street": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "locality": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2."
              }
            },
            "required": [
              "locality",
              "country"
            ]
          },
          "geo": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            }
          }
        }
      },
      "LinkSuggestion": {
        "type": "object",
        "required": [
          "candidate_id",
          "business_id",
          "name",
          "evidence",
          "auto_confirmable",
          "owner_confirmed"
        ],
        "properties": {
          "candidate_id": {
            "type": "integer",
            "format": "int64"
          },
          "business_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "address": {
            "type": "object",
            "properties": {
              "street": {
                "type": "string",
                "description": "Withheld for a record run by natural persons."
              },
              "postal_code": {
                "type": "string"
              },
              "locality": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string"
              }
            }
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auto_confirmable": {
            "type": "boolean",
            "description": "The owner's claim proof already covers one of the suggested record's domains, so confirming links it at once."
          },
          "owner_confirmed": {
            "type": "boolean",
            "description": "The owner already confirmed the suggestion; an operator still has to decide."
          }
        }
      },
      "LinkedLocationRequest": {
        "type": "object",
        "required": [
          "address"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Empty uses the company's name."
          },
          "address": {
            "type": "object",
            "properties": {
              "street": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "locality": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2."
              }
            },
            "required": [
              "street",
              "postal_code",
              "locality",
              "country"
            ]
          },
          "geo": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Empty uses the company's categories."
          },
          "phone": {
            "type": "string"
          },
          "hours": {
            "type": "string"
          },
          "website": {
            "type": "string"
          }
        }
      },
      "LocationsResponse": {
        "type": "object",
        "required": [
          "business_id",
          "items",
          "license"
        ],
        "properties": {
          "business_id": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Location"
            }
          },
          "license": {
            "type": "string"
          }
        }
      },
      "Rights": {
        "type": "object",
        "required": [
          "dataset",
          "sources",
          "notice",
          "official_status"
        ],
        "properties": {
          "dataset": {
            "$ref": "#/components/schemas/DatasetRight"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceRight"
            }
          },
          "notice": {
            "type": "string",
            "description": "ODbL 4.3 notice for a Produced Work."
          },
          "official_status": {
            "type": "string",
            "enum": [
              "not_an_official_extract"
            ]
          }
        }
      },
      "DatasetRight": {
        "type": "object",
        "required": [
          "id",
          "url",
          "scope"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "ODbL-1.0"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "scope": {
            "type": "string",
            "example": "n4p compilation and OSM-derived content"
          }
        }
      },
      "SourceRight": {
        "type": "object",
        "required": [
          "id",
          "licence_id",
          "licence_type",
          "licence_url",
          "attribution",
          "attribution_required",
          "share_alike",
          "commercial_use",
          "redistribution"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "licence_id": {
            "type": "string",
            "example": "terms_by"
          },
          "licence_type": {
            "type": "string",
            "enum": [
              "licence",
              "terms"
            ]
          },
          "licence_url": {
            "type": "string",
            "format": "uri"
          },
          "attribution": {
            "type": "string"
          },
          "attribution_required": {
            "type": "boolean"
          },
          "share_alike": {
            "type": "boolean"
          },
          "commercial_use": {
            "type": "boolean"
          },
          "redistribution": {
            "type": "boolean"
          },
          "homepage": {
            "type": "string",
            "format": "uri"
          },
          "terms_version": {
            "type": "string"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "HolidaySuggestions": {
        "type": "object",
        "required": [
          "business_id",
          "canton",
          "from",
          "to",
          "items"
        ],
        "properties": {
          "business_id": {
            "type": "string"
          },
          "canton": {
            "type": "string",
            "description": "Two-letter canton code of the primary location or the registered address; empty when unknown."
          },
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "date",
                "key",
                "names"
              ],
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "key": {
                  "type": "string"
                },
                "names": {
                  "type": "object",
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "de": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    },
                    "it": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "SpecialHoursEntry": {
        "type": "object",
        "description": "One dated exception to the weekly hours, in the business's local calendar. Dates are inclusive. Either `closed: true` or 1–3 spans; no overnight spans. Entries never overlap. An entry is removed automatically once its last date has passed.",
        "required": [
          "from",
          "to"
        ],
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "closed": {
            "type": "boolean"
          },
          "spans": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "object",
              "required": [
                "open",
                "close"
              ],
              "properties": {
                "open": {
                  "type": "string",
                  "pattern": "^([01][0-9]|2[0-4]):[0-5][05]$"
                },
                "close": {
                  "type": "string",
                  "pattern": "^([01][0-9]|2[0-4]):[0-5][05]$"
                }
              }
            }
          },
          "reason": {
            "type": "string",
            "enum": [
              "public_holiday",
              "holiday_closure",
              "event",
              "other"
            ]
          }
        }
      },
      "PostcardQuote": {
        "type": "object",
        "description": "What a postcard claim costs the signed-in owner.",
        "required": [
          "source",
          "amount"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "included",
              "paid",
              "unavailable"
            ],
            "description": "included: an enabled subscription or grant pays for it (never while subscriptions are switched off). paid: a one-time price applies. unavailable: no card can be sold here."
          },
          "amount": {
            "type": "integer",
            "description": "One-time price in the currency's smallest unit. Zero when the card is included or unavailable."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency of amount."
          },
          "reason": {
            "type": "string",
            "enum": [
              "no_postal_provider",
              "payment_unavailable"
            ],
            "description": "Why the card is unavailable: no postal provider, or no payment provider or price."
          },
          "breakdown": {
            "type": "object",
            "description": "Where a paid card's price goes. Present only when the card is paid and POSTCARD_COST_POSTAGE or POSTCARD_COST_MATERIAL is set; absent otherwise.",
            "required": [
              "postage",
              "material",
              "payment_fee"
            ],
            "properties": {
              "postage": {
                "type": "integer",
                "description": "Postage per card, in the currency's smallest unit."
              },
              "material": {
                "type": "integer",
                "description": "Card stock per card, in the currency's smallest unit."
              },
              "payment_fee": {
                "type": "integer",
                "description": "The rest of the price: the payment provider's fee and rounding up. Zero or more, because the price is set at cost."
              }
            }
          }
        }
      },
      "PostcardOrder": {
        "type": "object",
        "description": "A postcard an owner pays for once. The card is posted only after the payment provider confirms the payment.",
        "required": [
          "order_id",
          "business_id",
          "status",
          "method",
          "amount",
          "currency",
          "postcard_address",
          "created_at",
          "message"
        ],
        "properties": {
          "order_id": {
            "type": "string"
          },
          "business_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_payment",
              "paid",
              "sent",
              "needs_attention",
              "refunded",
              "expired"
            ]
          },
          "method": {
            "type": "string",
            "const": "postcard"
          },
          "amount": {
            "type": "integer",
            "description": "One-time price in the currency's smallest unit."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency of amount."
          },
          "postcard_address": {
            "type": "string",
            "description": "The formatted public address the card is posted to."
          },
          "payment_url": {
            "type": "string",
            "description": "The payment page, present only while awaiting_payment."
          },
          "claim_id": {
            "type": "string",
            "description": "The claim created once the card was posted."
          },
          "postcard_status": {
            "type": "string",
            "enum": ["queued", "printed", "posted", "cancelled", "sent"],
            "description": "Once sent: where the card is. See Claim.postcard_status."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "paid_at": {
            "type": "string",
            "format": "date-time"
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          },
          "message": {
            "type": "string"
          },
          "challenge": { "type": "boolean", "description": "The card opens a challenge. Omitted when false." },
          "reprove": { "type": "boolean", "description": "The card re-proves the owner's handed-over or transferred claim. Omitted when false." }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A session token from POST /v1/auth/verify."
      }
    }
  }
}
