API documentation

Annual data

API: Data/CH/BFS

Get public holidays and school holidays for a whole year, based on a Swiss municipality number (BFS).

Function

This API determines on which days of the year an official public holiday or school holidays take place at a particular location. The required parameters are `api_key` and `bfs`. The `year` parameter is optional - if it is not specified, the current year is automatically used. In addition, the output can be configured using further parameters. The parameters are passed as query parameters in the URL. Alternatively, authorisation can also take place in the header.

Interactive guide and OpenAPI

OpenAPI 3.0 (Swagger) – Interactive API documentation

Opens the interactive API documentation with Swagger, where you can test and explore API endpoints.

Download OpenAPI JSON specification

URL for requests

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

POST / GET
https://feiertagskalender.ch/api/Data/CH/BFS/index.php

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
BFS
required
Swiss municipality number according to FSO (Federal Statistical Office) &BFS=371
year
or
jahr

Year of the requested dates

without specification: current calendar year (= default)

year= 2026
class
or
klasse

Scope of the data

Variants:
0 = school holidays only
3 = 0 + public holidays recognised by law
4 = 0 + 3 + public and non-statutory holidays (religious, cultural) (= default)
5 = 0 + 3 + 4 + event days (e.g. Valentine's Day, Mother's Day, Advent Sundays)

klasse=5
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
date_format

The desired date format for the response. Default: `Y-m-d` (e.g., 2025-12-31)
The format corresponds to the date formatting of the PHP instruction date()

Variants:
Y-m-d = YYYY-MM-DD (ISO-8601) (= default)
d.m.Y = DD.MM.YYYY
Ymd = YYYYMMDD
dmY = DDMMYYYY
d.m.y = DD.MM.YY
j.n.y = D.M.YY

date_format=d.m.Y
hl

Desired language of the output

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

hl=en

Examples (URL / PHP / Python / JavaScript)

Show examples

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 Data/CH/BFS
apiStatus description       Designation of the API status. For variants, see the Error messages active
date         Date of the data export 01.05.2025
request: bfs       FSO community number 371
  year       Year of the data in the output 2015
  class       Class of the query (concerns the scope of the data) 4
  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 description     Designation of the geographical unit Biel/Bienne
    type     Designation of the type of geographical unit Stadt
    geoId     Geo-ID of the geographical unit. 424
    iso     ISO country code, 2 digits CH
    iso-3166-2     Region code according to ISO 3166-2 CH-BE
    note     Special notes
    events     The calendar events  
      description   Designation of the public holiday, or school holidays New Year´s Day
      id   Unique ID of the event.
Public holidays have the same ID every year.
School holidays all have their own IDs.
1
      dateStart   Date Start of the event 01.01.2015
      dateEnd   Date end of the event 01.01.2015
      class   Class of the event:

0 = School holidays
1 = official holiday
2 = Public holiday on a par with Sundays
3 = half-holiday (normally starting from noon)
4 = legally not recognized holiday (shops, schools, administrations mostly closed), bank holiday; for the purposes of the European Convention on the Calculation of Time Limits, this day is treated as a public holiday (Art. 5).
5 = event day
# = partially valid
2
      percent   Size of affected residents / school classes in percent 100
      prov   Flag for provisionally set data

0 = definitely
1 = provisional
0
      note   special notes  

Examples (JSON / XML / CSV)

JSON

URL:
https://www.feiertagskalender.ch/api/Data/CH/BFS/index.php?api_key=YOUR_API_KEY&bfs=261&year=2022

Response from the API:

{
    "interface": "fcal API 2.02",
    "source": {
        "href": "https://feiertagskalender.ch",
        "description": "feiertagskalender.ch"
    },
    "copyright": {
        "href": "https://psc.ch",
        "description": "psc Peter Schuetz Informatik-Dienstleistungen, CH Arch"
    },
    "apiName": "Data/CH/BFS",
    "apiStatus": {
        "description": "active"
    },
    "date": "2025-02-27",
    "request": {
        "bfs": "261",
        "year": 2022,
        "class": "4",
        "charset": "utf-8",
        "format": "json",
        "date_format": "Y-m-d",
        "hl": "de"
    },
    "results": {
        "status": {
            "description": "ok"
        },
        "location": {
            "description": "Zürich",
            "type": "Stadt",
            "geoId": "3055",
            "iso": "CH",
            "iso-3166-2": "CH-ZH",
            "note": "",
            "events": [
                {
                    "description": "Neujahr",
                    "id": "1",
                    "dateStart": "2022-01-01",
                    "dateEnd": "2022-01-01",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Berchtoldstag",
                    "id": "3",
                    "dateStart": "2022-01-02",
                    "dateEnd": "2022-01-02",
                    "class": "4",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Karfreitag",
                    "id": "17",
                    "dateStart": "2022-04-15",
                    "dateEnd": "2022-04-15",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Ostern",
                    "id": "18",
                    "dateStart": "2022-04-17",
                    "dateEnd": "2022-04-17",
                    "class": "4",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Ostermontag",
                    "id": "19",
                    "dateStart": "2022-04-18",
                    "dateEnd": "2022-04-18",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Sechseläuten",
                    "id": "20",
                    "dateStart": "2022-04-25",
                    "dateEnd": "2022-04-25",
                    "class": "4",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Tag der Arbeit",
                    "id": "22",
                    "dateStart": "2022-05-01",
                    "dateEnd": "2022-05-01",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Auffahrt",
                    "id": "31",
                    "dateStart": "2022-05-26",
                    "dateEnd": "2022-05-26",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Pfingsten",
                    "id": "30",
                    "dateStart": "2022-06-05",
                    "dateEnd": "2022-06-05",
                    "class": "4",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Pfingstmontag",
                    "id": "35",
                    "dateStart": "2022-06-06",
                    "dateEnd": "2022-06-06",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Nationalfeiertag Schweiz",
                    "id": "12",
                    "dateStart": "2022-08-01",
                    "dateEnd": "2022-08-01",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Knabenschiessen",
                    "id": "60",
                    "dateStart": "2022-09-12",
                    "dateEnd": "2022-09-12",
                    "class": "4",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Weihnachten",
                    "id": "23",
                    "dateStart": "2022-12-25",
                    "dateEnd": "2022-12-25",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Stephanstag",
                    "id": "37",
                    "dateStart": "2022-12-26",
                    "dateEnd": "2022-12-26",
                    "class": "2",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Weihnachtsferien",
                    "id": "629306",
                    "dateStart": "2021-12-20",
                    "dateEnd": "2022-01-01",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Sportferien",
                    "id": "629307",
                    "dateStart": "2022-02-14",
                    "dateEnd": "2022-02-25",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Osterferien",
                    "id": "629308",
                    "dateStart": "2022-04-14",
                    "dateEnd": "2022-04-18",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Frühlingsferien",
                    "id": "629309",
                    "dateStart": "2022-04-18",
                    "dateEnd": "2022-04-29",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Auffahrtsferien",
                    "id": "629310",
                    "dateStart": "2022-05-26",
                    "dateEnd": "2022-05-29",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Pfingstmontag",
                    "id": "629311",
                    "dateStart": "2022-06-06",
                    "dateEnd": "2022-06-06",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Sommerferien",
                    "id": "629312",
                    "dateStart": "2022-07-18",
                    "dateEnd": "2022-08-19",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Knabenschiessen",
                    "id": "629313",
                    "dateStart": "2022-09-12",
                    "dateEnd": "2022-09-12",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Herbstferien",
                    "id": "629314",
                    "dateStart": "2022-10-10",
                    "dateEnd": "2022-10-21",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                },
                {
                    "description": "Weihnachtsferien",
                    "id": "629315",
                    "dateStart": "2022-12-26",
                    "dateEnd": "2023-01-06",
                    "class": "0",
                    "percent": "100",
                    "prov": "0",
                    "note": null
                }
            ]
        }
    }
}

XML

URL:
https://www.feiertagskalender.ch/api/Data/CH/BFS/index.php?api_key=YOUR_API_KEY&bfs=261&year=2022&format=xml

Response from the API:

<fcal_api>
<interface>fcal API 2.02</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>Data/CH/BFS</apiName>
<date>2025-02-27</date>
<request>
<bfs>261</bfs>
<year>2022</year>
<class>4</class>
<charset>utf-8</charset>
<format>xml</format>
<date_format>Y-m-d</date_format>
<hl>de</hl>
</request>
<results>
<status>
<description>ok</description>
</status>
<location>
<description>Zürich</description>
<type>Stadt</type>
<geoId>3055</geoId>
<iso>CH</iso>
<iso-3166-2>CH-ZH</iso-3166-2>
<note></note>
<events>
<event>
<description>Neujahr</description>
<id>1</id>
<dateStart>2022-01-01</dateStart>
<dateEnd>2022-01-01</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Berchtoldstag</description>
<id>3</id>
<dateStart>2022-01-02</dateStart>
<dateEnd>2022-01-02</dateEnd>
<class>4</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Karfreitag</description>
<id>17</id>
<dateStart>2022-04-15</dateStart>
<dateEnd>2022-04-15</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Ostern</description>
<id>18</id>
<dateStart>2022-04-17</dateStart>
<dateEnd>2022-04-17</dateEnd>
<class>4</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Ostermontag</description>
<id>19</id>
<dateStart>2022-04-18</dateStart>
<dateEnd>2022-04-18</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Sechseläuten</description>
<id>20</id>
<dateStart>2022-04-25</dateStart>
<dateEnd>2022-04-25</dateEnd>
<class>4</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Tag der Arbeit</description>
<id>22</id>
<dateStart>2022-05-01</dateStart>
<dateEnd>2022-05-01</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Auffahrt</description>
<id>31</id>
<dateStart>2022-05-26</dateStart>
<dateEnd>2022-05-26</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Pfingsten</description>
<id>30</id>
<dateStart>2022-06-05</dateStart>
<dateEnd>2022-06-05</dateEnd>
<class>4</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Pfingstmontag</description>
<id>35</id>
<dateStart>2022-06-06</dateStart>
<dateEnd>2022-06-06</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Nationalfeiertag Schweiz</description>
<id>12</id>
<dateStart>2022-08-01</dateStart>
<dateEnd>2022-08-01</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Knabenschiessen</description>
<id>60</id>
<dateStart>2022-09-12</dateStart>
<dateEnd>2022-09-12</dateEnd>
<class>4</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Weihnachten</description>
<id>23</id>
<dateStart>2022-12-25</dateStart>
<dateEnd>2022-12-25</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Stephanstag</description>
<id>37</id>
<dateStart>2022-12-26</dateStart>
<dateEnd>2022-12-26</dateEnd>
<class>2</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Weihnachtsferien</description>
<id>629306</id>
<dateStart>2021-12-20</dateStart>
<dateEnd>2022-01-01</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Sportferien</description>
<id>629307</id>
<dateStart>2022-02-14</dateStart>
<dateEnd>2022-02-25</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Osterferien</description>
<id>629308</id>
<dateStart>2022-04-14</dateStart>
<dateEnd>2022-04-18</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Frühlingsferien</description>
<id>629309</id>
<dateStart>2022-04-18</dateStart>
<dateEnd>2022-04-29</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Auffahrtsferien</description>
<id>629310</id>
<dateStart>2022-05-26</dateStart>
<dateEnd>2022-05-29</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Pfingstmontag</description>
<id>629311</id>
<dateStart>2022-06-06</dateStart>
<dateEnd>2022-06-06</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Sommerferien</description>
<id>629312</id>
<dateStart>2022-07-18</dateStart>
<dateEnd>2022-08-19</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Knabenschiessen</description>
<id>629313</id>
<dateStart>2022-09-12</dateStart>
<dateEnd>2022-09-12</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Herbstferien</description>
<id>629314</id>
<dateStart>2022-10-10</dateStart>
<dateEnd>2022-10-21</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
<event>
<description>Weihnachtsferien</description>
<id>629315</id>
<dateStart>2022-12-26</dateStart>
<dateEnd>2023-01-06</dateEnd>
<class>0</class>
<percent>100</percent>
<prov>0</prov>
<note></note>
</event>
</events>
</location>
</results>
</fcal_api>

CSV

URL:
https://www.feiertagskalender.ch/api/Data/CH/BFS/index.php?api_key=YOUR_API_KEY&bfs=261&year=2022&format=csv

Response from the API:

"location";"bfs";"description";"id";"dateStart";"dateEnd";"class";"percent";"prov";"note"
"Zürich";"261";"Neujahr";"1";"2022-01-01";"2022-01-01";"2";"100";"0";""
"Zürich";"261";"Berchtoldstag";"3";"2022-01-02";"2022-01-02";"4";"100";"0";""
"Zürich";"261";"Karfreitag";"17";"2022-04-15";"2022-04-15";"2";"100";"0";""
"Zürich";"261";"Ostern";"18";"2022-04-17";"2022-04-17";"4";"100";"0";""
"Zürich";"261";"Ostermontag";"19";"2022-04-18";"2022-04-18";"2";"100";"0";""
"Zürich";"261";"Sechseläuten";"20";"2022-04-25";"2022-04-25";"4";"100";"0";""
"Zürich";"261";"Tag der Arbeit";"22";"2022-05-01";"2022-05-01";"2";"100";"0";""
"Zürich";"261";"Auffahrt";"31";"2022-05-26";"2022-05-26";"2";"100";"0";""
"Zürich";"261";"Pfingsten";"30";"2022-06-05";"2022-06-05";"4";"100";"0";""
"Zürich";"261";"Pfingstmontag";"35";"2022-06-06";"2022-06-06";"2";"100";"0";""
"Zürich";"261";"Nationalfeiertag Schweiz";"12";"2022-08-01";"2022-08-01";"2";"100";"0";""
"Zürich";"261";"Knabenschiessen";"60";"2022-09-12";"2022-09-12";"4";"100";"0";""
"Zürich";"261";"Weihnachten";"23";"2022-12-25";"2022-12-25";"2";"100";"0";""
"Zürich";"261";"Stephanstag";"37";"2022-12-26";"2022-12-26";"2";"100";"0";""
"Zürich";"261";"Weihnachtsferien";"629306";"2021-12-20";"2022-01-01";"0";"100";"0";""
"Zürich";"261";"Sportferien";"629307";"2022-02-14";"2022-02-25";"0";"100";"0";""
"Zürich";"261";"Osterferien";"629308";"2022-04-14";"2022-04-18";"0";"100";"0";""
"Zürich";"261";"Frühlingsferien";"629309";"2022-04-18";"2022-04-29";"0";"100";"0";""
"Zürich";"261";"Auffahrtsferien";"629310";"2022-05-26";"2022-05-29";"0";"100";"0";""
"Zürich";"261";"Pfingstmontag";"629311";"2022-06-06";"2022-06-06";"0";"100";"0";""
"Zürich";"261";"Sommerferien";"629312";"2022-07-18";"2022-08-19";"0";"100";"0";""
"Zürich";"261";"Knabenschiessen";"629313";"2022-09-12";"2022-09-12";"0";"100";"0";""
"Zürich";"261";"Herbstferien";"629314";"2022-10-10";"2022-10-21";"0";"100";"0";""
"Zürich";"261";"Weihnachtsferien";"629315";"2022-12-26";"2023-01-06";"0";"100";"0";""

Error messages

Output location Error message Explanation
results: status:
results: status: description not subscribed You have not subscribed to the desired data.
results: status: description unknown location The requested FSO municipality number is not known.
Please check the parameter bfs
apiStatus
apiStatus: description invalid usage The use of this API is not enabled for this user.
apiStatus: description invalid key Invalid API key.
apiStatus: description invalid referer Invalid access. Links from web pages (front-ends) are not allowed.
apiStatus: description inactive The API has not yet been activated for use.
apiStatus: description expired The period of use according to the contract has expired.
© 2003 - 2025 psc Peter Schütz Informatik Dienstleistungen, CH-Arch