# Open Knowledge Belgium - Elections API


# API


# Entities

## Get entities

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/entities/:year/:type[/:id]`

This endpoint allows you to get information about entities.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |
| id   | integer | ID of the entity.                  |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get entities by level

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/entities/:year/:type/level/:level`

This endpoint allows you to get information about entities filtered by level.\
If you need a list of available elections types, see Types.\
If you need a list of available elections levels, see Levels (not all levels are available for each type).

#### Path Parameters

| Name  | Type    | Description                        |
| ----- | ------- | ---------------------------------- |
| year  | integer | Year of the elections.             |
| type  | string  | Type of the elections (see Types). |
| level | string  | Level (see Levels).                |

#### Query Parameters

| Name  | Type    | Description                                                    |
| ----- | ------- | -------------------------------------------------------------- |
| test  | boolean | Use **test** data instead of real data.                        |
| final | boolean | Use **final** test data instead of **intermediate** test data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

{% content-ref url="/pages/-LfuC-PQegFvYGOlBRlz" %}
[Levels](/more-information/levels)
{% endcontent-ref %}


# Groups

## Get groups

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/groups/:year/:type[/:id]`

This endpoint allows you to get information about groups.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |
| id   | integer | ID of the group.                   |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}


# Lists

## Get lists

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/lists/:year/:type[/:id]`

This endpoint allows you to get information about lists.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |
| id   | integer | ID of the list.                    |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get lists by group

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/lists/:year/:type/group/:group`

This endpoint allows you to get information about lists filtered by group.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name  | Type    | Description                        |
| ----- | ------- | ---------------------------------- |
| year  | integer | Year of the elections.             |
| type  | string  | Type of the elections (see Types). |
| group | integer | ID of the group.                   |

#### Query Parameters

| Name  | Type    | Description                                                    |
| ----- | ------- | -------------------------------------------------------------- |
| test  | boolean | Use **test** data instead of real data.                        |
| final | boolean | Use **final** test data instead of **intermediate** test data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get lists by entity

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/lists/:year/:type/entity/:entity`

This endpoint allows you to get information about lists filtered by entity.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name   | Type    | Description                        |
| ------ | ------- | ---------------------------------- |
| year   | integer | Year of the elections.             |
| type   | string  | Type of the elections (see Types). |
| entity | integer | ID of the entity.                  |

#### Query Parameters

| Name  | Type    | Description                                                    |
| ----- | ------- | -------------------------------------------------------------- |
| test  | boolean | Use **test** data instead of real data.                        |
| final | boolean | Use **final** test data instead of **intermediate** test data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}


# Candidates

## Get candidates

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/candidates/:year/:type[/:id]`

This endpoint allows you to get information about candidates.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |
| id   | integer | ID of the candidate.               |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get candidates by list

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/candidates/:year/:type/list/:list`

This endpoint allows you to get information about candidates filtered by list.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |
| list | integer | ID of the list.                    |

#### Query Parameters

| Name  | Type    | Description                                                    |
| ----- | ------- | -------------------------------------------------------------- |
| test  | boolean | Use **test** data instead of real data.                        |
| final | boolean | Use **final** test data instead of **intermediate** test data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get candidates by group

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/candidates/:year/:type/group/:group`

This endpoint allows you to get information about candidates filtered by group.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name  | Type    | Description                        |
| ----- | ------- | ---------------------------------- |
| year  | integer | Year of the elections.             |
| type  | string  | Type of the elections (see Types). |
| group | integer | ID of the group.                   |

#### Query Parameters

| Name  | Type    | Description                                                    |
| ----- | ------- | -------------------------------------------------------------- |
| test  | boolean | Use **test** data instead of real data.                        |
| final | boolean | Use **final** test data instead of **intermediate** test data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get candidates by entity

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/candidates/:year/:type/entity/:entity`

This endpoint allows you to get information about candidates filtered by entity.\
If you need a list of available elections types, see Types.

#### Path Parameters

| Name   | Type    | Description                        |
| ------ | ------- | ---------------------------------- |
| year   | integer | Year of the elections.             |
| type   | string  | Type of the elections (see Types). |
| entity | integer | ID of the entity.                  |

#### Query Parameters

| Name  | Type    | Description                                                    |
| ----- | ------- | -------------------------------------------------------------- |
| test  | boolean | Use **test** data instead of real data.                        |
| final | boolean | Use **final** test data instead of **intermediate** test data. |

{% tabs %}
{% tab title="200 " %}

```javascript
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}


# Format I

Initial data

## Get entities

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/format-i/entities/:year/:type`

This endpoint allows you to get all the entities for specific elections.\
If you need the list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "1101": {
    "id": 1101,
    "level": "K",
    "name_fr": "Votes Émis Dans le Canton de Rhode-Saint-Genèse",
    "name_nl": "Stemmen Uitgebracht In het Kanton Sint-Genesius-Rode",
    "name_de": "Stimmabgabe Im Kanton Sint-Genesius-Rode",
    "name_en": "Voted In The District of Rhode-Saint-Genèse/sint-Genesius-Rode",
    "nis": "1101",
    "parent": "21004",
    "electronic": true,
    "stations": 44,
    "max_official": 0,
    "max_substitues": 0,
    "registrations": {
      "BB": 44429,
      "E1_E2": 127,
      "E3_E4": 0,
      "E5": 0
    }
  },
  ...
}
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get groups

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/format-i/groups/:year/:type`

This endpoint allows you to get all the groups for specific elections.\
If you need the list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "307": {
    "id": 307,
    "name": "Piratenpartij",
    "color": "CCCCCC",
    "previous": {
      "name": "Piratenpartij",
      "id": 2000095
    }
  },
  ...
}
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get lists

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/format-i/list/:year/:type`

This endpoint allows you to get all the lists for specific elections.\
If you need the list of available elections types, see Types.

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "1377": {
    "id": 1377,
    "name": "ECOLO",
    "lang": "FF",
    "nr": 2,
    "group": {
      "id": 326,
      "name": "ECOLO",
      "color": "C1E331",
      "previous": {
        "name": "Ecolo",
        "id": 2000046
      }
    },
    "entity": {
      "id": 2227,
      "level": "C",
      "name_fr": "Circonscription de Namur",
      "name_nl": "Kieskring Namen",
      "name_de": "Wahlkreis Namur",
      "name_en": "Constituency of Namur",
      "nis": "2227",
      "parent": null,
      "electronic": false,
      "stations": 20,
      "max_official": 6,
      "max_substitues": 6,
      "registrations": {
        "BB": 371574,
        "E1_E2": 1528,
        "E3_E4": 878,
        "E5": 5319
      }
    },
    "previous": {
      "name": "Ecolo",
      "id": 2000046
    }
  },
  ...
}
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}

## Get candidates

<mark style="color:blue;">`GET`</mark> `https://api.elections.openknowledge.be/format-i/candidates/:year/:type`

#### Path Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| year | integer | Year of the elections.             |
| type | string  | Type of the elections (see Types). |

#### Query Parameters

| Name | Type    | Description                             |
| ---- | ------- | --------------------------------------- |
| test | boolean | Use **test** data instead of real data. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "29704": {
    "id": 29704,
    "level": "C",
    "nr": 1,
    "name": "DETOMBE Willy",
    "type": "S",
    "gender": "U",
    "birthdate": "00/00/0000",
    "list": {
      "id": 1473,
      "name": "DéFI",
      "lang": "FF",
      "nr": 11,
      "group": {
        "id": 304,
        "name": "DéFI",
        "color": "D70077",
        "previous": {
          "name": "FDF",
          "id": 2000074
        }
      },
      "entity": {
        "id": 2224,
        "level": "C",
        "name_fr": "Circonscription de Hainaut",
        "name_nl": "Kieskring Henegouwen",
        "name_de": "Wahlkreis Hennegau",
        "name_en": "Constituency of Hainaut",
        "nis": "2224",
        "parent": null,
        "electronic": false,
        "stations": 0,
        "max_official": 18,
        "max_substitues": 10,
        "registrations": {
          "BB": 923330,
          "E1_E2": 4332,
          "E3_E4": 1751,
          "E5": 13376
        }
      },
      "previous": {
        "name": "FDF",
        "id": 2000074
      }
    }
  },
  ...
}
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-LfuBBN2cKgblfWKj6eT" %}
[Types](/more-information/types)
{% endcontent-ref %}


# Format R

Results data


# Types

## List of available elections types

* `CK` : Chambre / Kamer
* `VL` : Parlement flamand / Vlaams Parlement
* `WL` : Parlement régional wallon / Waals Parlement
* `BR` : Parlement de la Région de Bruxelles-Capitale / Brussels Hoofdstedelijk Parlement
* `DE` : Parlement de la Communauté germanophone / Parlement van de Duitstalige Gemeenschap
* `EU` : Parlement européen / Europese Parlement
* `PR` : Conseil provincial / Provincieraden
* `CG` : Conseil communal / Gemeenteraden
* `CS` : Conseil CPAS / OCMWraden
* `DI` : Conseil de district (Anvers) / Districtraden (in Antwerpen)


# Levels

## List of available elections levels

* `M` : Bureau principal de commune / Gemeentehoofdbureau
* `K` : Bureau principal de canton / Kantonhoofdbureau
* `D` : Bureau principal de district / Stadsdistricthoofdbureau
* `A` : Bureau principal d’arrondissement / Arrondissementshoofdbureau
* `C` : Bureau principal de circonscription / Kieskringhoofdbureau
* `G` : Bureau principal de la circonscription germanophone / Hoofdbureau van de Duitstalige kieskring
* `O` : Bureau central de province / Centraal provinciaal bureau
* `P` : Bureau principal provincial / Provinciehoofdbureau
* `L` : Bureau principal de collège / Collegehoofdbureau
* `R` : Royaume / Koninkrijk


# Categories of voters

* `BB` : Belgians, entitled to vote and living in the Kingdom of Belgium.
* `E1 + E2` : Belgians, entitled to vote and living outside Belgium, who will vote in person or by proxy in a municipality of the Kingdom of Belgium.
* `E3 + E4` : Belgians, entitled to vote and living outside Belgium, who will vote in person or by proxy in the Belgian diplomatic or consular - professional post where the person has chosen to subscribe himself.
* `E5` : Belgians, entitled to vote and living outside Belgium, who will vote by letter.

{% hint style="info" %}
Source: <http://polling2014.belgium.be/en/cha/results/results_tab_CKR00000.html>
{% endhint %}


