API documentation

Geographical data

Read out Geo-IDs

Data set with the geographical tree of Switzerland, with FSO number.

API: GeoTree/CH

Chapters:

API: GeoTree/CH

Function

Outputs the geographical tree of Switzerland. With Geo-ID and FSO municipality number.

URL for requests

To retrieve the data, use the following URL. Please pay attention to upper case lower case.

Request parameters

With the following variables you can complete the query and control the API results.

Parameter Explanation Examples
api_key
required

Your API Key

?api_key=abc-123-def-456
charset

The desired coding of the response

Variants:
UTF-8 (= default)
ISO-8859-1

&charset=iso-8859-1
format

The desired output format

Variants:
JSON (= default)
XML
CSV

&format=xml
hl

Desired language of the output

Variants:
de = German (= default)
fr = French
it = Italian
en = English

&hl=en

Return values of the API

The contents of the API responses result from:
- the data you have subscribed to (countries, public holidays, school holidays, calendar years)
- the officially known data of the legislators
- the availability based on our research (ACTUAL situation of our database)

Please note that the output in CSV format differs.

Array         Explanation Example
interface         Version of the API  
source: href       URL to the data source (website)  
  description       Name of the data source  
copyright href       URL to the copyright holder (website)  
  description       Designation of the copyright holder  
apiName         Identification of the API GeoTree/CH
apiStatus description       Designation of the API status. For variants, see the Error messages active
date         Date of the data export 17.08.2022
request: iso       ISO country code, 2 digits CH
  charset       Font coding of the output utf-8
  format       Output data format json
  hl       Language of issue, according to request en
results status description     Output status. For variants, see the Error messages ok
  location       Geographical unit according to request  
    description     Designation of the geographical unit Switzerland
    type     Designation of the type of geographical unit Country
    geoId     Geo-ID of the geographical unit. 3056
    iso     ISO country code, 2 digits CH
    iso-3166-2     Region code according to ISO 3166-2  
    bfs     FSO community number (Only available at municipality level) NULL
    children     Any subordinate geographical units  
      description   Designation of the geographical unit Argovia
      type   Designation of the type of geographical unit Canton
      geoId   Geo-ID of the geographical unit. 1
      iso   ISO country code, 2 digits CH
      iso-3166-2   Region code according to ISO 3166-2 CH-AG
      bfs   FSO community number (Only available at municipality level)  
      children   Any subordinate geographical units
(1-3 levels, depending on canton)
array

Error messages

Output location Error message Explanation
apiStatus
apiStatus: description invalid usage The use of this API is not activated for you.
Please contact our support.
apiStatus: description invalid key Invalid API key.
Please check your API key.
apiStatus: description invalid referer Invalid access. Links from web pages (front-ends) are not allowed.
Set up your query so that it comes from a protected back-end.
If necessary, contact our support.
apiStatus: description inactive The API has not yet been activated for you to use.
Please try again at a later date.
apiStatus: description expired The period of use according to the contract has expired.
Contact our administration for a contract extension.

Examples

JSON

URL:
https://feiertagskalender.ch/api/GeoTree/CH/?api_key=YOUR_API_KEY

Response from the API:

{
   "interface":"fcal API 2.01",
   "source":{
      "href":"https://feiertagskalender.ch",
      "description":"feiertagskalender.ch"
   
},
   "copyright":{
      "href":"https://psc.ch",
      "description":"psc Peter Schuetz Informatik-Dienstleistungen, CH Bern"
   
},
   "apiName":"GeoTree/CH",
   "apiStatus":{
      "description":"active"
   
},
   "date":"2020-04-03",
   "request":{
      "iso":"CH",
      "charset":"utf-8",
      "format":"json",
      "hl":"de"
   
},
   "results":{
      "status":{
         "description":"ok"      
},
      "location":{
         "description":"Schweiz",
         "type":"Land",
         "geoId":"3056",
         "iso":"CH",
         "iso-3166-2":"",
         "bfs":null,
         "children":[
            {
               "description":"Aargau",
               "type":"Kanton",
               "geoId":"1",
               "iso":"CH",
               "iso-3166-2":"CH-AG",
               "bfs":null,
               "children":[
                  {
                     "description":"Aarau",
                     "type":"Bezirk",
                     "geoId":"2",
                     "iso":"CH",
                     "iso-3166-2":"CH-AG",
                     "bfs":null,
                     "children":[
                        {
                           "description":"Aarau",
                           "type":"Gemeinde",
                           "geoId":"3",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4001",
                           "children":null
                        },
                        {
                           "description":"Biberstein",
                           "type":"Gemeinde",
                           "geoId":"4",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4002",
                           "children":null
                        },
                        {
                           "description":"Buchs (AG)",
                           "type":"Gemeinde",
                           "geoId":"5",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4003",
                           "children":null
                        },
                        {
                           "description":"Densb\u00fcren",
                           "type":"Gemeinde",
                           "geoId":"6",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4004",
                           "children":null
                        },
                        {
                           "description":"Erlinsbach (AG)",
                           "type":"Gemeinde",
                           "geoId":"7",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4005",
                           "children":null
                        },
                        {
                           "description":"Gr\u00e4nichen",
                           "type":"Gemeinde",
                           "geoId":"8",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4006",
                           "children":null
                        },
                        {
                           "description":"Hirschthal",
                           "type":"Gemeinde",
                           "geoId":"9",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4007",
                           "children":null
                        },
                        {
                           "description":"K\u00fcttigen",
                           "type":"Gemeinde",
                           "geoId":"10",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4008",
                           "children":null
                        },
                        {
                           "description":"Muhen",
                           "type":"Gemeinde",
                           "geoId":"11",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4009",
                           "children":null
                        },
                        {
                           "description":"Oberentfelden",
                           "type":"Gemeinde",
                           "geoId":"12",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4010",
                           "children":null
                        },
                        {
                           "description":"Suhr",
                           "type":"Gemeinde",
                           "geoId":"14",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4012",
                           "children":null
                        },
                        {
                           "description":"Unterentfelden",
                           "type":"Gemeinde",
                           "geoId":"15",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4013",
                           "children":null
                        }
                     ]
                  },
                  {
                     "description":"Baden",
                     "type":"Bezirk",
                     "geoId":"16",
                     "iso":"CH",
                     "iso-3166-2":"CH-AG",
                     "bfs":null,
                     "children":[
                        {
                           "description":"Baden",
                           "type":"Gemeinde",
                           "geoId":"17",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4021",
                           "children":null
                        },
                        {
                           "description":"Bellikon",
                           "type":"Gemeinde",
                           "geoId":"18",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4022",
                           "children":null
                        },
                        {
                           "description":"Bergdietikon",
                           "type":"Gemeinde",
                           "geoId":"19",
                           "iso":"CH",
                           "iso-3166-2":"CH-AG",
                           "bfs":"4023",
                           "children":null
                        }
                     ]
                  }
               ]
            }
         ]
      }
   }
}

XML

URL:
https://feiertagskalender.ch/api/GeoTree/CH/?api_key=YOUR_API_KEY&format=xml

Response from the API:

<fcal_api>
<interface>fcal API 2.01</interface>
<source>
    <href>https://feiertagskalender.ch</href>
    <description>feiertagskalender.ch</description>
</source>
<copyright>
    <href>https://psc.ch</href>
    <description>psc Peter Schuetz Informatik-Dienstleistungen, CH Bern</description>
</copyright>
<apiStatus>
    <description>active</description>
</apiStatus>
<apiName>GeoTree/CH</apiName>
<date>2020-04-03</date>
<request>
    <iso>CH</iso>
    <charset>utf-8</charset>
    <format>xml</format>
    <hl>de</hl>
</request>
<results>
    <status>
        <description>ok</description>
    </status>
    <location>
        <description>Schweiz</description>
        <type>Land</type>
        <geoId>3056</geoId>
        <iso>CH</iso>
        <iso-3166-2/>
        <bfs/>
        <children>
            <child>
                <description>Aargau</description>
                <type>Kanton</type>
                <geoId>1</geoId>
                <iso>CH</iso>
                <iso-3166-2>CH-AG</iso-3166-2>
                <bfs/>
                <children>
                    <child>
                        <description>Aarau</description>
                        <type>Bezirk</type>
                        <geoId>2</geoId>
                        <iso>CH</iso>
                        <iso-3166-2>CH-AG</iso-3166-2>
                        <bfs/>
                        <children>
                            <child>
                                <description>Aarau</description>
                                <type>Gemeinde</type>
                                <geoId>3</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4001</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Biberstein</description>
                                <type>Gemeinde</type>
                                <geoId>4</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4002</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Buchs (AG)</description>
                                <type>Gemeinde</type>
                                <geoId>5</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4003</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Densbüren</description>
                                <type>Gemeinde</type>
                                <geoId>6</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4004</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Erlinsbach (AG)</description>
                                <type>Gemeinde</type>
                                <geoId>7</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4005</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Gränichen</description>
                                <type>Gemeinde</type>
                                <geoId>8</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4006</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Hirschthal</description>
                                <type>Gemeinde</type>
                                <geoId>9</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4007</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Küttigen</description>
                                <type>Gemeinde</type>
                                <geoId>10</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4008</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Muhen</description>
                                <type>Gemeinde</type>
                                <geoId>11</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4009</bfs>
                                <children/>
                            </child>
                                <child>
                                <description>Oberentfelden</description>
                                <type>Gemeinde</type>
                                <geoId>12</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4010</bfs>
                                <children/>
                                </child>
                            <child>
                                <description>Suhr</description>
                                <type>Gemeinde</type>
                                <geoId>14</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4012</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Unterentfelden</description>
                                <type>Gemeinde</type>
                                <geoId>15</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4013</bfs>
                                <children/>
                            </child>
                        </children>
                    </child>
                    <child>
                        <description>Baden</description>
                        <type>Bezirk</type>
                        <geoId>16</geoId>
                        <iso>CH</iso>
                        <iso-3166-2>CH-AG</iso-3166-2>
                        <bfs/>
                        <children>
                            <child>
                                <description>Baden</description>
                                <type>Gemeinde</type>
                                <geoId>17</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4021</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Bellikon</description>
                                <type>Gemeinde</type>
                                <geoId>18</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4022</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Bergdietikon</description>
                                <type>Gemeinde</type>
                                <geoId>19</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4023</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Birmenstorf (AG)</description>
                                <type>Gemeinde</type>
                                <geoId>20</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4024</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Ehrendingen</description>
                                <type>Gemeinde</type>
                                <geoId>31</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4049</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Ennetbaden</description>
                                <type>Gemeinde</type>
                                <geoId>21</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4026</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Fislisbach</description>
                                <type>Gemeinde</type>
                                <geoId>22</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4027</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Freienwil</description>
                                <type>Gemeinde</type>
                                <geoId>23</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4028</bfs>
                                <children/>
                            </child>
                            <child>
                                <description>Gebenstorf</description>
                                <type>Gemeinde</type>
                                <geoId>24</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4029</bfs>
                            <children/>
                            </child>
                            <child>
                                <description>Killwangen</description>
                                <type>Gemeinde</type>
                                <geoId>25</geoId>
                                <iso>CH</iso>
                                <iso-3166-2>CH-AG</iso-3166-2>
                                <bfs>4030</bfs>
                                <children/>
                            </child>
                        </children>
                    </child>
                </children>
            </child>
        </children>
    </location>
</results>
</fcal_api>                  

CSV

Aufruf:
https://feiertagskalender.ch/api/GeoTree/CH/?api_key=YOUR_API_KEY&format=CSV

Response from the API:

location_L0;type_L0;iso;geoId_L0;iso-3166-2;location_L1;type_L1;geoId_L1;location_L2;type_L2;geoId_L2;location_L3;type_L3;geoId_L3;bfs
Schweiz;Land;CH;3056;;;;;;;;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;;;;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Aarau;Gemeinde;3;4001
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Biberstein;Gemeinde;4;4002
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Buchs (AG);Gemeinde;5;4003
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Densbüren;Gemeinde;6;4004
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Erlinsbach (AG);Gemeinde;7;4005
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Gränichen;Gemeinde;8;4006
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Hirschthal;Gemeinde;9;4007
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Küttigen;Gemeinde;10;4008
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Muhen;Gemeinde;11;4009
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Oberentfelden;Gemeinde;12;4010
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Suhr;Gemeinde;14;4012
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Aarau;Bezirk;2;Unterentfelden;Gemeinde;15;4013
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;;;;
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Baden;Gemeinde;17;4021
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Bellikon;Gemeinde;18;4022
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Bergdietikon;Gemeinde;19;4023
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Birmenstorf (AG);Gemeinde;20;4024
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Ehrendingen;Gemeinde;31;4049
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Ennetbaden;Gemeinde;21;4026
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Fislisbach;Gemeinde;22;4027
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Freienwil;Gemeinde;23;4028
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Gebenstorf;Gemeinde;24;4029
Schweiz;Land;CH;3056;Aargau;Kanton;CH-AG;1;Baden;Bezirk;16;Killwangen;Gemeinde;25;4030
                
Pages
Partner projects
©2003 - 2022 psc Peter Schütz Informatik Dienstleistungen, CH-Bern