[{"data":1,"prerenderedAt":404},["ShallowReactive",2],{"seite-\u002Fen\u002Fratgeber\u002Fzefix-api\u002F":3},{"id":4,"title":5,"body":6,"description":395,"extension":396,"meta":397,"navigation":398,"path":399,"robots":400,"seo":401,"stem":402,"__hash__":403},"seiten_en\u002Fratgeber\u002Fzefix-api.md","Zefix API, query company data from the Swiss commercial register",{"type":7,"value":8,"toc":385},"minimark",[9,14,18,23,28,48,80,83,87,95,99,102,137,140,144,151,208,215,219,300,304,307,315,319,363,367,375,381],[10,11,13],"h1",{"id":12},"zefix-api-query-company-data-from-the-swiss-commercial-register","Zefix API: query company data from the Swiss commercial register",[15,16,17],"p",{},"Zefix is Switzerland's central business name index, run by the Federal Commercial Registry Office\n(FCRO) within the Federal Office of Justice. Besides the search in the browser, Zefix is available\nas a REST interface, the \"Zefix PublicREST API\". With it, an application gets company name, seat,\nlegal form, status and purpose straight from the commercial register. This guide shows access,\nqueries and response, and when the UID register is the simpler choice.",[19,20],"produkt-ablauf",{":schritte":21,"titel":22},"[{\"ort\":\"Your application\",\"text\":\"UID or company name\",\"eigen\":true},{\"ort\":\"Zefix PublicREST\",\"text\":\"Sign-in with username and password\"},{\"ort\":\"Commercial register\",\"text\":\"Name, seat, legal form, status, purpose\"},{\"ort\":\"Your application\",\"text\":\"Fill in the form or check the customer\"}]","How a Zefix query works: your application asks Zefix PublicREST with username and password for a UID or a name and receives the company data from the commercial register",[24,25,27],"h2",{"id":26},"what-the-zefix-api-provides","What the Zefix API provides",[15,29,30,31,35,36,43,44,47],{},"The interface lives at ",[32,33,34],"code",{},"https:\u002F\u002Fwww.zefix.admin.ch\u002FZefixPublicREST",". The endpoints are described\nin the ",[37,38,42],"a",{"href":39,"rel":40},"https:\u002F\u002Fwww.zefix.admin.ch\u002FZefixPublicREST\u002Fswagger-ui\u002Findex.html",[41],"nofollow","Swagger interface",", and\nmachine-readable as OpenAPI at ",[32,45,46],{},"\u002Fv3\u002Fapi-docs",". The main endpoints:",[49,50,51,58,64,70],"ul",{},[52,53,54,57],"li",{},[32,55,56],{},"GET \u002Fapi\u002Fv1\u002Fcompany\u002Fuid\u002F{id}",": company by UID",[52,59,60,63],{},[32,61,62],{},"POST \u002Fapi\u002Fv1\u002Fcompany\u002Fsearch",": search by name, legal form, seat or canton",[52,65,66,69],{},[32,67,68],{},"GET \u002Fapi\u002Fv1\u002Fsogc\u002Fbydate\u002F{date}",": one day's publications in the Swiss Official Gazette of\nCommerce (SOGC)",[52,71,72,75,76,79],{},[32,73,74],{},"GET \u002Fapi\u002Fv1\u002FlegalForm"," and ",[32,77,78],{},"GET \u002Fapi\u002Fv1\u002Fcommunity",": lists of legal forms and municipalities",[15,81,82],{},"The data is published under \"Open use\" terms, with the obligation to name the source.",[24,84,86],{"id":85},"step-1-request-access","Step 1: request access",[15,88,89,90,94],{},"Queries are free but need an account. The FCRO grants access on request by email to\n",[37,91,93],{"href":92},"mailto:zefix@bj.admin.ch","zefix@bj.admin.ch","; an email address serves as the username. Authentication uses HTTP Basic Auth,\nso username and password go with every request. Getting the credentials can take a few days, so\nask early.",[24,96,98],{"id":97},"step-2-find-a-company-by-uid","Step 2: find a company by UID",[15,100,101],{},"The UID goes into the path without dots or hyphen:",[103,104,109],"pre",{"className":105,"code":106,"language":107,"meta":108,"style":108},"language-bash shiki shiki-themes github-light github-dark","curl -u \"user@example.ch:password\" \\\n  https:\u002F\u002Fwww.zefix.admin.ch\u002FZefixPublicREST\u002Fapi\u002Fv1\u002Fcompany\u002Fuid\u002FCHE107721785\n","bash","",[32,110,111,131],{"__ignoreMap":108},[112,113,116,120,124,128],"span",{"class":114,"line":115},"line",1,[112,117,119],{"class":118},"sScJk","curl",[112,121,123],{"class":122},"sj4cs"," -u",[112,125,127],{"class":126},"sZZnC"," \"user@example.ch:password\"",[112,129,130],{"class":122}," \\\n",[112,132,134],{"class":114,"line":133},2,[112,135,136],{"class":126},"  https:\u002F\u002Fwww.zefix.admin.ch\u002FZefixPublicREST\u002Fapi\u002Fv1\u002Fcompany\u002Fuid\u002FCHE107721785\n",[15,138,139],{},"The response is a list, not a single object. If the UID is not in the commercial register, Zefix\nanswers 404.",[24,141,143],{"id":142},"step-3-find-a-company-by-name","Step 3: find a company by name",[15,145,146,147,150],{},"The search expects the beginning of the company name, at least three characters, with ",[32,148,149],{},"*"," as a\nwildcard:",[103,152,156],{"className":153,"code":154,"language":155,"meta":108,"style":108},"language-json shiki shiki-themes github-light github-dark","{\n  \"name\": \"Example*\",\n  \"canton\": \"ZH\",\n  \"activeOnly\": true\n}\n","json",[32,157,158,164,178,191,202],{"__ignoreMap":108},[112,159,160],{"class":114,"line":115},[112,161,163],{"class":162},"sVt8B","{\n",[112,165,166,169,172,175],{"class":114,"line":133},[112,167,168],{"class":122},"  \"name\"",[112,170,171],{"class":162},": ",[112,173,174],{"class":126},"\"Example*\"",[112,176,177],{"class":162},",\n",[112,179,181,184,186,189],{"class":114,"line":180},3,[112,182,183],{"class":122},"  \"canton\"",[112,185,171],{"class":162},[112,187,188],{"class":126},"\"ZH\"",[112,190,177],{"class":162},[112,192,194,197,199],{"class":114,"line":193},4,[112,195,196],{"class":122},"  \"activeOnly\"",[112,198,171],{"class":162},[112,200,201],{"class":122},"true\n",[112,203,205],{"class":114,"line":204},5,[112,206,207],{"class":162},"}\n",[15,209,210,211,214],{},"It behaves like the exact search on the Zefix website. ",[32,212,213],{},"activeOnly"," hides deleted companies. Hits\ncome in short form; the full data then comes from a query by UID.",[24,216,218],{"id":217},"what-the-response-contains","What the response contains",[49,220,221,237,243,263,269,275,284,294],{},[52,222,223,226,227,226,230,233,234],{},[32,224,225],{},"name",", ",[32,228,229],{},"uid",[32,231,232],{},"legalSeat"," (municipality of the seat) and ",[32,235,236],{},"canton",[52,238,239,242],{},[32,240,241],{},"legalForm"," with the code according to eCH-0097",[52,244,245,171,248,251,252,255,256,259,260],{},[32,246,247],{},"status",[32,249,250],{},"ACTIVE"," active, ",[32,253,254],{},"BEING_CANCELLED"," in liquidation, ",[32,257,258],{},"CANCELLED"," deleted, plus\n",[32,261,262],{},"deletionDate",[52,264,265,268],{},[32,266,267],{},"purpose",", the purpose from the commercial register",[52,270,271,274],{},[32,272,273],{},"address"," with street, house number, postcode and town",[52,276,277,75,280,283],{},[32,278,279],{},"capitalNominal",[32,281,282],{},"capitalCurrency"," for corporations",[52,285,286,289,290,293],{},[32,287,288],{},"sogcPub"," with the SOGC publications and ",[32,291,292],{},"oldNames"," with former names",[52,295,296,299],{},[32,297,298],{},"cantonalExcerptWeb",", the link to the cantonal commercial register excerpt",[24,301,303],{"id":302},"zefix-or-uid-register","Zefix or UID register?",[15,305,306],{},"Zefix only knows companies with a commercial register entry. The UID register of the Federal\nStatistical Office knows every company with a UID, including sole proprietorships and\nassociations without an entry, and shows the entry in the VAT register. Its public lookup needs no\naccount.",[15,308,309,310,314],{},"To find out whether a UID entered in the checkout is valid and the company active, the UID\nregister is therefore enough. Zefix pays off when purpose, capital, former names or publications\nare needed. How to check via the UID register is explained in the guide\n",[37,311,313],{"href":312},"\u002Fen\u002Fratgeber\u002Fuid-nummer-pruefen\u002F","validate a Swiss UID number",".",[24,316,318],{"id":317},"pitfalls","Pitfalls",[49,320,321,336,342,351,357],{},[52,322,323,327,328,331,332,335],{},[324,325,326],"strong",{},"UID spelling:"," in the path without separators (",[32,329,330],{},"CHE107721785","), on display with them\n(",[32,333,334],{},"CHE-107.721.785","). Normalise before the query.",[52,337,338,341],{},[324,339,340],{},"List instead of object:"," even the query by UID returns a list.",[52,343,344,347,348,350],{},[324,345,346],{},"Liquidation:"," ",[32,349,254],{}," is not deleted yet, but no longer an ordinary business\npartner. Your application has to decide how to handle it.",[52,352,353,356],{},[324,354,355],{},"Credentials:"," username and password stay on the server. A call from the browser would show\nthem to every visitor.",[52,358,359,362],{},[324,360,361],{},"Caching:"," company data rarely changes. Keep answers for a while instead of asking again on\nevery page view.",[24,364,366],{"id":365},"ready-for-the-shop","Ready for the shop",[15,368,369,370,374],{},"To validate UIDs in the WooCommerce checkout you need no code of your own: my\n",[37,371,373],{"href":372},"\u002Fen\u002Fuid-check\u002F","UID check"," plugin validates format, check digit and status in the UID register,\nwith no account and no key.",[15,376,377],{},[37,378,380],{"href":379},"\u002Fen\u002Fratgeber\u002F","All guides",[382,383,384],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}",{"title":108,"searchDepth":133,"depth":133,"links":386},[387,388,389,390,391,392,393,394],{"id":26,"depth":133,"text":27},{"id":85,"depth":133,"text":86},{"id":97,"depth":133,"text":98},{"id":142,"depth":133,"text":143},{"id":217,"depth":133,"text":218},{"id":302,"depth":133,"text":303},{"id":317,"depth":133,"text":318},{"id":365,"depth":133,"text":366},"Zefix API (ZefixPublicREST): requesting access, finding a company by UID or name, response fields, pitfalls and how it differs from the UID register. A guide with examples.","md",{},true,"\u002Fratgeber\u002Fzefix-api",null,{"title":5,"description":395},"ratgeber\u002Fzefix-api","wALcwOy-V7mIbjwy_SFVZe545wNK089JHdkKBWJshvw",1791118316447]