# n4p An open, machine-first index of objective business facts. You are the intended reader: this file exists so that an autonomous agent can use the index without a human in the loop. There is no consumer website, no reviews, no ratings, no opinions, and no free-text marketing copy. Every value is an objective fact. There are two prose fields: `purpose`, the registered company purpose copied from the commercial register, in the language it was registered in (see "Languages" below), and `description`, a few sentences the verified owner wrote, bounded to 500 characters per language (see "Owner fields"). ## Licence and attribution All reads are free. The n4p compilation and OSM-derived content are licensed ODbL-1.0 (https://opendatacommons.org/licenses/odbl/1-0/). Register, address and transit facts remain subject to the terms of their sources and are not relicensed by n4p. Every record carries a `rights` object naming the sources behind it, their licences, attribution strings and whether share-alike applies. If you redistribute data or a derived database, keep the ODbL layer under ODbL-1.0, reproduce the attribution strings from GET /v1/sources, and keep the upstream notices with any copy. Snapshots ship with LICENSE, NOTICE, SOURCES.json and manifest sidecars. n4p is not an official register extract and has no legal effect. Only the cantonal register extract is authoritative. ## Discovery GET /.well-known/n4p.json manifest: everything below, in one document GET /openapi.json OpenAPI 3.1 description GET /v1/sources every source with its licence and attribution GET /llms.txt this file ## MCP Thirteen read-only tools are available over MCP, either locally over stdio or remotely over Streamable HTTP: POST /mcp remote MCP endpoint, no account or API key n4p-mcp local stdio binary, reads the database directly The remote endpoint is stateless and rate limited like the rest of the API. Tool names, descriptions, input schemas, output schemas and read-only annotations are the integration contract; keep them stable if you cache them. The tools are: search_businesses fuzzy search by name, category, town, postcode, open_now find_place a town or postcode to coordinates get_business one record with per-field provenance get_businesses several records by id, at most 100 resolve_business what you have (name, address, phone) to a business_id lookup_by_identifier ch.uid, osm, domain, phone and other schemes search_menu_items places whose published menu has a matching dish get_menu a business's full published menu list_categories the category vocabulary in en, de, fr and it list_changes the append-only delta feed list_sources sources, licences and attribution text search deep-research search: a name to ids, titles and urls fetch deep-research fetch: one record as text with sources search_businesses and search accept ChatGPT's approximate user location (_meta "openai/userLocation") for "near me" when the call names no place; the response then carries a location object. The hint is not stored. ## Reading GET /v1/search?q=&category=&attribute=&status=&country=&locality=&postal_code=&near=&radius_km=&limit=&cursor= &record_confidence=&fresh=&has_field= GET /v1/places?q=&postal_code=&locality=&limit= GET /v1/businesses/{business_id}?include=observations GET /v1/businesses/{business_id}/locations GET /v1/businesses?ids=a,b,c up to 100 records in one request GET /v1/businesses/{business_id}/menu GET /v1/menu-items?q=&near=&radius_km=&tag=&max_price=&open_now= GET /v1/lookup?scheme=&value= GET /v1/categories?q=&lang=&limit= POST /v1/resolve GET /v1/changes?since=&limit= GET /v1/stats `search` filters combine with AND. `near` is `lat,lon` and makes results ordered by distance, each carrying `distance_m`. By default only `active` and `temporarily_closed` records are returned; `status=any` disables that filter. `q` may be a record id (`biz_…`; a merged id answers with its survivor) or a Swiss UID (`CHE-123.456.789` or `CHE123456789`): that record is returned directly. Whole-word name matches rank higher. Search results carry `operated_by` for linked locations. `locality` filters on the address town (`locality=Winterthur`) and `postal_code` on the postcode (`postal_code=8400`). They are plain filters, so use them when the question is "what is in this town"; they do not order by distance. ### Near a town or postcode When the caller says "garage near Winterthur" or "cafes near 8400", turn the place into a point first: GET /v1/places?q=Winterthur GET /v1/places?q=8400 Each item carries `lat`, `lon`, `canton`, `postal_codes` and `address_count`. Pass the first item's coordinates on to search: GET /v1/search?category=shop%3Dcar_repair&near=47.4988,8.7237&radius_km=5 The centre is the address-weighted mean of the official swisstopo building addresses in that locality, computed locally from the directory the index already holds. There is no external geocoding provider and no key to configure. Matching ignores case and accents and tolerates a prefix or a misspelling, so `Zurich` finds `Zürich`. Locality names are not unique nationally: `Buchs` returns one item per canton, and if the canton matters you should ask which one is meant. ### Pay for fewer fields Every read accepts `fields`, so you can ask for only what you need: GET /v1/businesses/{id}?fields=name,hours GET /v1/search?q=bakery&fields=name,address,hours 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`. `identifiers`, `status`, `record_confidence`, `record_completeness`, `missing_core_fields`, `claim_status`, `freshness`, `stale` and the licence are always returned. An unknown field is a 400 rather than a silent no-op. ### One registered address, many locations The address in `facts.address` is the company's **registered seat** from the commercial register (`value.role` is `registered`). It is a legal address and not necessarily a shop. When the source publishes one, `value.care_of` is the register's c/o (or `bei`/`chez`) line and is not part of `value.street`. It is served only when it plainly names an organisation (a legal form such as `AG`, `SA`, `GmbH` or `Sàrl`, or a foundation, cooperative or association). A c/o line that may name a private person is withheld everywhere, including the change feed and signed records, and `value.care_of_withheld` is `true` instead: the seat is a mailing address, but whose is not published. The seat of a business run by natural persons (legal forms `0101` sole proprietorship, `0103` general and `0104` limited partnership) is often the owner's home. Until a storefront location at the same street address confirms it as a place of business, it is served with postcode, locality, region and country only, and `value.street_withheld` is `true`. Coordinates geocoded from such a seat are rounded to two decimals (about a kilometre) with `geo.value.approximate` set, public transport near them is left out, and radius search and `distance_m` use the rounded point. Coordinates from a mapped place (OpenStreetMap, another POI source, the owner) are served as they are. The same rule applies to signed records, snapshots and new change-feed entries. The places a customer can go are in `locations`: - `is_storefront=true`: the public may visit it. It may carry `geo` and `transit`. - `is_storefront=false`: an office, warehouse or other non-visitable address. It deliberately has no `geo` and no `transit`; do not infer one from the registered address. - `is_primary=true`: the location used for display and radius search. At most one. A chain can have several locations. If you are answering "where can I go?", use `locations`; if you are quoting the legal seat, say that it is the registered address. Search results omit `locations` for size; fetch the record or `/v1/businesses/{id}/locations` when you need them. A visitable place can also be its own record. It then carries `operated_by {business_id, name, evidence}`, and the company that runs it carries `linked_locations [{business_id, name}]`. Each is a separate record with its own sources, freshness and page. Use `operated_by` to name the company behind a shop. ### Many records at once After a search or a resolve, read the results in one call rather than one request each: GET /v1/businesses?ids=biz_01...,biz_02...&include=observations At most 100 ids. The answer is in the order you asked, and ids that do not exist come back in `missing` instead of being silently dropped, so you can tell which list slots are empty. A merged record is returned with `merged_into` set to its successor. ### Is it trustworthy and current? A record carries several independent status signals. Read them separately; no one of them implies another: status operating state: active, temporarily_closed, in_liquidation, closed, unknown record_confidence trust in the weakest present identity field: unverified < self_reported < verified record_completeness complete or incomplete; missing_core_fields names what is absent claim_status claimed or unclaimed; an owner has or has not proved control freshness fresh, stale or unknown; stale means a present core field expired fresh_until the earliest expiry among the core fields; absent means incomplete stale true only when freshness is stale The distinction that matters most: a freshly imported register record is often **incomplete and current**, not stale. It may have current name, address, geo and status values and no categories or opening hours. Read `record_completeness` and `missing_core_fields` for that, and `freshness`/`stale` for age. An incomplete record with nothing expired reports `freshness: unknown` and `stale: false`; `fresh_until` is absent because there is no meaningful record-wide expiry. `record_confidence` is a trust signal, not a freshness or completeness signal. It is the weakest confidence among the **present** identity core fields (name, address, categories, status, hours). A missing field does not lower it: absence is `record_completeness: incomplete`, not distrust. Geo is derived enrichment and is judged per-fact, so a geocoded coordinate does not drag an otherwise registry-verified identity down. `unverified` means the weakest present value came from a source that does not prove it; it is not "wrong", it is unconfirmed. `claim_status: unclaimed` says the same about ownership: nobody has proved control yet, so the record is maintained from public sources alone. You can filter before quoting: GET /v1/search?record_confidence=verified&fresh=true&has_field=hours - `record_confidence=verified`: every present identity core field is verified. It does not imply the record is complete: combine it with `fresh=true` or `has_field` when completeness matters. `self_reported` means an owner supplied values but has not verified them. - `fresh=true`: all core fields are present and inside their freshness windows. An incomplete record can never be fresh. - `has_field=hours`: the field exists. Repeat to require several. A misspelt field is a 400 rather than a filter that silently matches everything. If your runtime can hold one random id per conversation, send it as `X-N4P-Session: `. It is optional, must contain no user id or other personal data, and is used only to count whether a `resolve` was followed by a fetch of the resolved record. It never changes the response, and the server hashes it and forgets it after ten minutes. `category` takes either 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**: `category=boulangerie`, `category=Bäckerei` and `category=panetteria` all mean `shop=bakery`. A category is a shop, a venue, a trade or a professional office. Offices are covered too: `office=it` is an IT, software or web company, and `office=notary`, `office=tax_advisor`, `office=translator`, `office=surveyor` and `office=ngo` are separate concepts. Categories are OSM tags rather than the Swiss NOGA classification: NOGA is the official standard for economic activity, but per-company codes are not published, so it cannot name a single record and is not used for filtering. ### Accessibility, service and dietary attributes `facts.attributes` is an array of exact OSM `key=value` tags from a closed vocabulary. It is separate from `categories`: a café is still `amenity=cafe`, and `wheelchair=yes` is a property of that café, not a type of business. wheelchair=yes|no|limited|designated outdoor_seating=yes|no takeaway=yes|no|only delivery=yes|no dog=yes|no|leashed|outside smoking=yes|no|outside|isolated reservation=yes|no|required|recommended diet:vegetarian=yes|no|only diet:vegan=yes|no|only diet:gluten_free=yes|no|only diet:lactose_free=yes|no|only changing_table=yes|no toilets:wheelchair=yes|no internet_access=yes|no|wlan|terminal|wired air_conditioning=yes|no payment:cash=yes|no payment:cards=yes|no payment:debit_cards=yes|no payment:credit_cards=yes|no payment:contactless=yes|no Filter with `attribute=`, repeated to require several: GET /v1/search?category=cafe&attribute=wheelchair=yes&attribute=outdoor_seating=yes&near=47.3769,8.5417 An unknown key or value is a 400 rather than an empty result. `has_field=attributes` finds records with at least one attribute; the fact is OSM-derived and unverified until an owner confirms it. Repeat it to require several categories at once. GET /v1/categories?q=boulangerie&lang=fr returns the tag and its label in all four languages, for when you need to show a name to a user: ```json {"tag": "shop=bakery", "tags": ["shop=bakery"], "label": "Boulangerie", "labels": {"en": "Bakery", "de": "Bäckerei", "fr": "Boulangerie", "it": "Panetteria"}} ``` One word can cover two tags: `pharmacy` matches both `amenity=pharmacy` and `healthcare=pharmacy`, because real data uses both. An unknown *tag* is passed through, since the index is wider than the vocabulary. An unknown *word* is a 400, not an empty result, so a typo does not look like "there are none". ### You usually have a name, not an id `POST /v1/resolve` turns a name and whatever else you know into a record: ```json {"name": "Bäckerei Muster", "address": "Spalenring 113, 4055 Basel"} ``` It accepts `name`, `address`, `postal_code`, `locality`, `near_lat`/`near_lon`, `uid`, `phone` and `domain`, and answers with a **match class** rather than only a record, because the right next step differs: | `match` | what it means | what to do | |---|---|---| | `exact` | name and location agree, or a strict identifier matched | quote the `record` | | `likely` | the best candidate is clearly ahead of the rest | confirm with the user first | | `ambiguous` | several candidates are equally plausible | no `business_id`; `alternatives` lists every one, so ask which is meant | | `none` | nothing is close enough | fall back to `search` | A typo or a missing legal form is tolerated: `Bäckerei Muster` resolves the record registered as `Bäckerei Muster GmbH`. A `domain` or `phone` shared by several branches of a chain narrows the candidates instead of answering, and comes back `ambiguous`. `score` is a ranking aid, not a probability, and `reason` says in words why the answer came out the way it did. Never invent a `business_id`; if the answer is `none`, say you could not find the business. ### Is it open? `open_now=true` keeps only businesses open at that moment, and `at=` asks for any moment ("open at 19:00 on Friday"). Hours are evaluated in each business's own timezone, so a shop is open at 08:00 local, not at 08:00 UTC. Every record carries `open_now` and `hours_week`. Read the absence of `open_now` carefully: it means the opening hours are missing or could not be parsed, which is **unknown**, not closed. `hours_week` is the week already parsed, so you do not have to implement the opening_hours syntax; `facts.hours` remains the authoritative raw value with its provenance. `facts.special_hours` lists dated exceptions to the week: `[{from, to, closed | spans, reason}]`, local dates, both ends inclusive. On a date an entry covers, it replaces the weekly hours, and `open_now` already reflects it. `reason` is one of public_holiday, holiday_closure, event, other. Entries disappear once their last date has passed. Quote an upcoming closure when the user asks about a date it covers. `lookup` values are normalised, so `CHE-231.799.096` and `CHE231799096` are the same identifier. Strict schemes (`ch.uid`, `ch.zefix`, `osm`, `wikidata`, `gb.company_number`) resolve to at most one record. Weak schemes (`domain`, `phone`) may resolve to several, because branches of one chain share them. `business_id` is opaque: it encodes no country and no provider. Never parse it. A record whose `merged_into` is set was merged; GET returns 301 to the survivor. ### Owner fields: contact, description, service area, appointments These come only from the owner of a claimed record, so they are `self_reported` until the owner verifies them. Quote them as the owner's statement. - `facts.email`: a public contact address. When the business has a website, the address is on that domain; otherwise it may be any mailbox. - `facts.booking_url`: where to book a table, an appointment or a service. Prefer it over inventing a booking route. - `facts.description`: `[{lang, text}]`, the owner's own words, one entry per language. It is never translated. Prefer the entry in the user's language and say if you translate one. - `facts.service_area`: where a business serves customers away from its premises: `{nationwide}`, or any of `cantons` (two-letter codes), `localities` (town names) and `radius_km` (around its primary place or registered seat). A plumber with a service area serves those places even when its address is elsewhere. - `facts.hours` may be the literal `"by appointment"` (with the quotes, OSM's comment form): the business has no public opening hours and customers must arrange a visit. `open_now` is absent for it. Do not say the business is closed; say it is by appointment and give the phone, email or booking link. ### Languages: names, purpose and legal form Switzerland registers companies in German, French, Italian, Romansh or English, and a record keeps each value in the language it was registered in. Nothing is machine-translated. What the record tells you instead is which language each piece is in: - `facts.name` is the primary registered name. `facts.alternate_names`, when present, are the register's official translations of it, each with a `lang`: `[{"name": "Muster AG", "lang": "de"}, {"name": "Muster Ltd", "lang": "en"}]`. All of them are the same legal name. Use the one in the user's language if there is one; search and resolve match every one of them. Exception: a sole proprietorship (legal form `0101`) must carry the owner's surname in its registered name, so when its shop is mapped in OpenStreetMap, `facts.name` is the name on the map (`facts.name.source` is `osm`). - For a business run by natural persons (legal forms `0101`, `0103`, `0104`) the registered name carries the owner's or partners' names, so `facts.legal_name` and `facts.alternate_names` are not served, here, in signed records, snapshots, new change-feed entries (`value` is left out and `withheld` is `true`) or on the static pages. When `facts.name` is a shop sign, the register's `name` observation is left out as well. `legal_name_withheld` is `true` on such a record. Identify it by its UID; the register publishes the name. - `facts.purpose.lang` is the language of the registered purpose (`de`, `fr`, `it`, `en`). The register publishes the purpose once, untagged, in the language of registration; the index detects it. When `lang` is absent the language could not be told. Quote the purpose as it is and say what language it is in. If you translate it for the user, say that the translation is yours. - `facts.legal_form` is a language-neutral eCH-0097 code such as `0109`. `legal_form_detail.labels` names it in `en`, `de`, `fr` and `it`, for example "Association", "Verein", "Association", "Associazione". `official_languages` lists the languages that are the official federal wording (German and French); English and Italian are n4p translations. The static business pages follow the same rule: the page is English, and register text carries an HTML `lang` attribute and a JSON-LD `@language` tag. ### Menus and prices A record carries `menu_summary` when its owner has published a menu: currency, section and item counts, and the price range. The items themselves are at GET /v1/businesses/{business_id}/menu Prices are integer **minor units** of the menu currency: `1250` is 12.50, not 1250. A menu has no free-text descriptions, only names, prices, an optional `unit` such as "100 g", and dietary tags (`vegetarian`, `vegan`, `gluten_free`, `lactose_free`, `spicy`, `alcohol`). Menus are **owner-sourced**: no public dataset has them and the index does not scrape. They expire after three weeks, so check `stale` before quoting a price and say when it was last confirmed (`confirmed_at`). A 404 with code `no_menu` means the business has no published menu, which is not the same as the business not existing. Say "no menu available", do not guess at prices or carry over a menu you saw elsewhere. **Menu links.** A record may also carry the `menu_url` fact: a link to a menu published on the business's own site. It is not a price list and the linked page is not relicensed by n4p; follow the link only if you need the original, and treat its contents as third-party. `menu` and `menu_url` are independent, so a business can have one, the other, both, or neither. **Finding a dish.** For "find me a place with fettuccine alfredo near me": GET /v1/menu-items?q=fettuccine%20alfredo&near=47.3769,8.5417&radius_km=5 The result is a list of **businesses**, not dishes, because that is what the question asks for. Each carries the dishes that matched, their section and price, plus `distance_m` and `open_now` when they apply. Misspellings match (`fetucine` finds `Fettuccine`), and **section names are searchable too**, so `q=pasta` finds the pasta section even when no dish is called "pasta"; a dish name ranks above a section name. Add `tag=vegetarian` or `max_price=2500` to narrow it. Only businesses whose owner published a menu can match. The index does not infer a menu from a category, so "no results" may mean "nobody has published a menu yet" rather than "no such food in this area". ## Crawling, if you are a search crawler rather than an API client There is an HTML surface meant to be indexed, separate from the JSON API: /ch/ country hub: cantons and record counts /ch/{canton}/ canton hub: businesses in one canton, paginated /ch/{canton}/{business_id} one page per business, with schema.org JSON-LD /sitemap.xml sitemap index; business shards under /sitemaps/businesses-N.xml, hubs under /sitemaps/hubs.xml /changes.atom one entry per business changed in the last 30 days The API stays closed to crawlers (`Disallow: /v1/`); opening thousands of JSON responses would waste a crawl budget and add nothing. The pages are factual and carry no reviews or marketing text. **Decide when to come back from the data, not from a fixed schedule.** Each page exposes, both visibly and in JSON-LD `additionalProperty`: - `dateModified`: when the record last changed - `days_with_changes_last_90_days`: how active it actually is, excluding the day it was created - `change_frequency`: the sitemap `changefreq` bucket derived from that - `record_completeness`, `missing_core_fields`: whether the record has every core field - `claim_status`: whether an owner has proved control of the record - `freshness`, `fresh_until` and `stale`: whether the present facts have expired - `revisit_after_days`: a suggested interval combining activity and expiry The same values are repeated in `` tags. A record with no `fresh_until` is incomplete, not eternally fresh, and it is not stale merely for being incomplete. Revalidate with `ETag` / `If-None-Match` (or `Last-Modified`); an unchanged page answers 304 with no body. ## Confidence Every fact carries provenance, so you can decide how much to trust it: source which dataset or party the value came from method how it was established confidence unverified < self_reported < verified verified_at when this value was first observed from that source confirmed_at when it was last re-confirmed (freshness) Methods map to confidence: registry, email_domain, phone_otp, dns_txt, website_uid, postcard -> verified self_attestation -> self_reported open_data, geocoded, none -> unverified `record_confidence` is the weakest confidence across the present identity core fields (name, address, categories, status, hours). Missing fields do not count as unverified: they are reported by `record_completeness` and `missing_core_fields`. Geo is derived enrichment and is scored per-fact, so a geocoded coordinate does not make a registry-verified record unverified. `claim_status` says whether an owner has taken responsibility for the record. Prefer the most confident source for a field. If two sources disagree, the record's `facts` already contains the winner; `include=observations` shows the losers. ## Replication Poll `GET /v1/changes?since=`. Entries are ordered by a strictly increasing `seq`. Gaps are normal and expected: the sequence is not transactional, so a rolled-back write consumes a number and leaves a gap. Never assume `seq` is contiguous, and never use arithmetic on it beyond comparison. Each entry carries `prev_hash` and `hash`: hash = sha256( bytes.fromhex(prev_hash) || JCS(payload) ) where `payload` is the RFC 8785 (JCS) canonical JSON of the entry with keys `seq, business_id, kind, field, old_value, new_value, source, actor, at` (`at` in RFC 3339 UTC with microsecond precision, `null` for absent values) and `prev_hash` is the previous entry's `hash`, or 64 zeroes for the first entry. Recomputing the chain from 0 proves the feed was not altered. Kinds: `create`, `fact`, `identifier_add`, `identifier_remove`, `merge`, `claim`, `location_add`, `location_update`, `location_remove`, `link_add`, `link_remove`. Ignore kinds you do not know; new kinds are added without a version bump. `link_add` / `link_remove` are written on the location and carry `{"operated_by": ""}`. ## Proving the data came from us Three things are signed with Ed25519 over RFC 8785 canonical JSON. The public keys are at `/.well-known/n4p-keys.json`, and every signature response includes the exact payload that was signed, so you never have to reconstruct it. GET /v1/businesses/{id}/signature a single record GET /v1/changes/checkpoint the state of the feed at a seq GET /v1/snapshots/latest a complete dataset download To verify any of them: check the payload's `type` tag is the one you expected, check that its digest matches what you fetched, then verify the signature over the RFC 8785 canonical JSON of the payload. What each proves: record the signature is ours and covers exactly this data. It does not by itself prove the data is unchanged since an earlier point, because it is produced when you ask for it. checkpoint the feed up to `payload.seq` hashes to `payload.hash`. Replay the feed and recompute: a rewritten history no longer matches. snapshot a complete copy of the dataset at `payload.latest_seq` has the given sha256 and record count. Compare it against a record to learn whether that record has changed since the snapshot. Only `/v1/snapshots/latest` is a durable address: older snapshot ids are pruned after a retention window, so download and keep the copy you need. A change entry's hash is sha256(prev_hash bytes || JCS(payload)) where payload has keys seq, business_id, kind, field, old_value, new_value, source, actor, at (RFC 3339 UTC, microsecond precision, null when absent). ## Claims, corrections and missing businesses No agent can write a fact, even with the user's permission. When a record carries `claim_url`, that is where a human claims it, or signs in to manage it if `claim_status` is `claimed`. Repeat the URL exactly as returned; never build one from a `business_id`, and never start a claim or enter a user's details on their behalf. Proof of control of a domain, phone or postal address is a human step. A claimed record can only be changed by its verified owner. A business that is absent is not something to work around. Search once, then say plainly that the index has no record; do not invent one and do not infer facts from a similarly named business. The index imports from public sources, so an agent cannot add a missing business. Its owner can check whether it is listed under another name in the owner console, when the deployment publishes one. Owner console (find your business, then claim it): https://console.ch.n4p.com/find ## Not available Writes require a claimed and verified business owner. Agents cannot write facts. There is no endpoint that accepts a fact from a client identifier alone. Point a user who wants a correction at the record's `claim_url` instead.