Zefix API: query company data from the Swiss commercial register
Zefix is Switzerland's central business name index, run by the Federal Commercial Registry Office (FCRO) within the Federal Office of Justice. Besides the search in the browser, Zefix is available as a REST interface, the "Zefix PublicREST API". With it, an application gets company name, seat, legal form, status and purpose straight from the commercial register. This guide shows access, queries and response, and when the UID register is the simpler choice.
What the Zefix API provides
The interface lives at https://www.zefix.admin.ch/ZefixPublicREST. The endpoints are described
in the Swagger interface, and
machine-readable as OpenAPI at /v3/api-docs. The main endpoints:
GET /api/v1/company/uid/{id}: company by UIDPOST /api/v1/company/search: search by name, legal form, seat or cantonGET /api/v1/sogc/bydate/{date}: one day's publications in the Swiss Official Gazette of Commerce (SOGC)GET /api/v1/legalFormandGET /api/v1/community: lists of legal forms and municipalities
The data is published under "Open use" terms, with the obligation to name the source.
Step 1: request access
Queries are free but need an account. The FCRO grants access on request by email to zefix@bj.admin.ch; an email address serves as the username. Authentication uses HTTP Basic Auth, so username and password go with every request. Getting the credentials can take a few days, so ask early.
Step 2: find a company by UID
The UID goes into the path without dots or hyphen:
curl -u "user@example.ch:password" \
https://www.zefix.admin.ch/ZefixPublicREST/api/v1/company/uid/CHE107721785
The response is a list, not a single object. If the UID is not in the commercial register, Zefix answers 404.
Step 3: find a company by name
The search expects the beginning of the company name, at least three characters, with * as a
wildcard:
{
"name": "Example*",
"canton": "ZH",
"activeOnly": true
}
It behaves like the exact search on the Zefix website. activeOnly hides deleted companies. Hits
come in short form; the full data then comes from a query by UID.
What the response contains
name,uid,legalSeat(municipality of the seat) andcantonlegalFormwith the code according to eCH-0097status:ACTIVEactive,BEING_CANCELLEDin liquidation,CANCELLEDdeleted, plusdeletionDatepurpose, the purpose from the commercial registeraddresswith street, house number, postcode and towncapitalNominalandcapitalCurrencyfor corporationssogcPubwith the SOGC publications andoldNameswith former namescantonalExcerptWeb, the link to the cantonal commercial register excerpt
Zefix or UID register?
Zefix only knows companies with a commercial register entry. The UID register of the Federal Statistical Office knows every company with a UID, including sole proprietorships and associations without an entry, and shows the entry in the VAT register. Its public lookup needs no account.
To find out whether a UID entered in the checkout is valid and the company active, the UID register is therefore enough. Zefix pays off when purpose, capital, former names or publications are needed. How to check via the UID register is explained in the guide validate a Swiss UID number.
Pitfalls
- UID spelling: in the path without separators (
CHE107721785), on display with them (CHE-107.721.785). Normalise before the query. - List instead of object: even the query by UID returns a list.
- Liquidation:
BEING_CANCELLEDis not deleted yet, but no longer an ordinary business partner. Your application has to decide how to handle it. - Credentials: username and password stay on the server. A call from the browser would show them to every visitor.
- Caching: company data rarely changes. Keep answers for a while instead of asking again on every page view.
Ready for the shop
To validate UIDs in the WooCommerce checkout you need no code of your own: my UID check plugin validates format, check digit and status in the UID register, with no account and no key.