The SHAB API: Reading the Swiss Gazette Programmatically
This guide is for developers building a SHAB data import. If you need to interpret a gazette entry for sales, start with Reading SHAB/FOSC, which explains what each entry type means commercially.
Here we cover the publication endpoints and XML fields. We also explain four API behaviours that can waste a day when you meet them in production.
Use the public API for machine access
SHAB's robots.txt applies to automated crawling of the website. For machine access, the Amtsblattportal provides a public REST API intended for production use. Use the API endpoints below for published material. They require no login.
| Environment | Base URL |
|---|---|
| Production | https://amtsblattportal.ch/api/v1/ |
| Integration | https://int.amtsblattportal.ch/api/v1/ |
The login endpoint is for submitting publications. The open endpoints above serve published material.
List publications, then fetch each record
GET /api/v1/publications/xml returns a paginated list of publication metadata and ids. Fetch each publication body with GET /api/v1/publications/{id}/xml.
Store the id as the publication key. Check it before fetching the detail document so reruns can skip bodies you already hold.
Both endpoints support /xml, /csv, /pdf, and /docx variants.
A typical list request for a day of HR publications:
GET https://amtsblattportal.ch/api/v1/publications/xml
?publicationStates=PUBLISHED
&tenant=shab
&rubrics=HR
&publicationDate.start=2026-07-09
&publicationDate.end=2026-07-09
&pageRequest.page=0
&pageRequest.size=2000
Parameters for an HR publication list
| Parameter | Value | Note |
|---|---|---|
publicationStates | PUBLISHED | Mandatory. Include it to receive records. |
tenant | shab | The federal commercial gazette. Cantonal tenants exist. |
rubrics | HR | Handelsregister. Use HR. The documentation listed BH when last checked. |
subRubrics | — | Ignored by the live API. See below. |
publicationDate.start / .end | ISO date | Inclusive dates at day granularity. |
cantons | ZH, GE, … | Optional. |
pageRequest.page / .size | 0-based / max 2,000 | The only documented hard limit. |
pageRequest.sortOrders | column:PUBLICATION_DATE|direction:DESC |
The subRubrics trap. In our production test, subRubrics=HR01 also returned HR02 and HR03 records. Request rubrics=HR, then classify each fetched publication from meta.subRubric. Otherwise, a new-registration table can quietly include changes and deletions.
Classify each HR publication into one of these sub-rubrics:
HR01: Neueintragungen, new entries. Incorporations and branch creations.HR02: Mutationen, changes. Seat moves, address changes, name changes, capital increases, mergers.HR03: Löschungen, deletions.
Read the structured fields first
An HR detail document contains structured meta and content blocks. Use those fields for company identity and attributes. They also cover common change types. Keep publicationText for acts that lack a dedicated structured field.
| Need | Read from | Detail |
|---|---|---|
| Identity and deduplication | meta.id | Publication UUID |
| Publication type | meta.rubric, meta.subRubric | Classify after fetching the detail document |
| Company identity | content.company | Name, seat, UID, legal form, address |
| Change type | content.transaction | Flags for seat, address, name, and capital changes |
| Register journal reference | journalDate, journalNumber | Tagebuch entry and effective date |
| Previous notice | lastFosc* | Reference to the publication this one supersedes |
HR02 records expose change flags in transaction, including seatChanged, addressChanged, nameChanged, and capitalChanged. Name changes include old and new values. To identify a capital increase, compare the old and new nominal figures when capitalChanged is set. Keyword detection over the publication text is still useful for mergers and branch creations, which lack a dedicated structured flag.
The schemas are published at https://amtsblattportal.ch/api/v1/schemas/bulk-export.xsd and per sub-rubric at https://amtsblattportal.ch/api/v1/schemas/shab/1.26/HR0x-export.xsd.
Validate capital figures
Swiss display text uses an apostrophe as the thousands separator, and the gazette occasionally publishes one where a decimal point belongs. We have seen a capital figure overstated by a factor of a hundred that way. The record rose to the top of a monthly capital-increase report before the anomaly was caught.
Flag an SA below CHF 100,000 nominal capital and a GmbH below CHF 20,000 for review. Also flag a single mutation that changes nominal capital by 100 times or more. These checks identify likely parsing or source-data errors. Send the record to review and preserve the original value.
Reconcile cancellations in every daily run
A publication can be PUBLISHED or CANCELLED. Reconcile both states on every run because a cancellation may affect a publication already stored or acted on.
Run the two states as separate passes and dedupe the overlapping ids with CANCELLED winning. Reconcile the body against the state you discovered it under. Some bodies omit the field.
The daily reconciliation algorithm:
- List both
PUBLISHEDandCANCELLEDrecords for the previous seven calendar days through today. Keep one row per id, withCANCELLEDtaking precedence if the id appears in both lists. - Upsert the state for every listed id, including ids already stored. This is how a previous publication becomes cancelled in your database.
- Fetch detail documents for ids whose body is missing or whose state change requires another copy. Cap concurrency and retry transient failures with exponential backoff.
- Parse structured fields first. Use
publicationTextfor the remaining acts.
In 305,902 publications measured over the past twelve months, the median interval between a change taking effect and its publication was five days. Of those publications, 38% appeared within three days. We re-list the previous seven calendar days on every daily run to absorb late and corrected records.
For scale: on 9 July 2026 there were about 1,310 HR publications out of roughly 1,813 SHAB publications that day.
An open-source parser for these publications
The parser behind our own import is published under the MIT licence as python-shab-parser. It reads an Amtsblattportal XML document into typed dataclasses, then classifies each publication into events: incorporation, seat move, capital increase, deletion. Namespace differences between the sub-rubrics are absorbed, so an HR01, HR02 or HR03 document parses the same way.
Its optional HTTP client covers the discovery and fetch loop described above, rate-limited to one request per second, with exponential backoff on transient failures. The documentation sets out the event types and the full API reference.
Usage terms and legal status
The operator's terms disclaim completeness and accuracy. The signed PDF is the legally authoritative version of each publication. Review the current API terms before commercial reuse. This guide describes our technical implementation and is not legal advice.
A gazette notice tells you which legal change was published. Deciding whether the company is worth contacting usually requires context from its website and current hiring.
Where Swiss company data actually lives explains those sources, and what each of them is good for compares them on the questions a daily import has to answer.