> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spirii.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AFIR compliance

> Publish your public chargers' static and dynamic data to a National Access Point in DATEX II format.

The EU's Alternative Fuels Infrastructure Regulation (AFIR), Article 20, requires operators and owners of publicly available recharging stations to make specified static and dynamic data about their infrastructure available — free, unrestricted, and via an API. Spirii provides dedicated endpoints that return this data in DATEX II v3, ready to feed to your member state's National Access Point (NAP).

## Before you start

This playbook is for operators and owners of public charging in an AFIR member state. Each member state has its own NAP, so check its integration requirements first — in particular whether it consumes **DATEX II** (covered below) or **OCPI** (see the note at the end). You'll also want the CPO ID or customer IDs whose data you're publishing; contact your Spirii representative if you're unsure which to use.

## The DATEX II endpoints

Two endpoints return AFIR data in DATEX II v3, the exchange format most National Access Points use:

* **Static data** — `GET /v2/afir/energy-infrastructure-tables` returns infrastructure metadata: sites and stations (locations and charge boxes), refill points and connectors, operating hours, and tariff information.
* **Dynamic data** — `GET /v2/afir/energy-infrastructure-statuses` returns real-time availability and status, with tariff information.

Both are **public** — no API key — and built for a data feed: responses are gzip-encoded, and they support conditional caching, so a request with an `If-Modified-Since` header returns `304 Not Modified` when nothing has changed.

```bash theme={null}
# Static infrastructure data for your operator
curl "https://api.spirii.com/v2/afir/energy-infrastructure-tables?cpoId=42"

# Real-time status for your operator
curl "https://api.spirii.com/v2/afir/energy-infrastructure-statuses?cpoId=42"
```

Poll the statuses endpoint more often than the tables endpoint — availability changes constantly, while the infrastructure itself rarely does — and use `If-Modified-Since` on both to avoid re-fetching unchanged data.

### Filter to the data you publish

Three filters scope the response, and can be combined — when you pass more than one, only assets matching all of them are returned.

| Filter        | Purpose                                                         | Example                      |
| ------------- | --------------------------------------------------------------- | ---------------------------- |
| `cpoId`       | Narrow to a single Charge Point Operator's assets (recommended) | `?cpoId=42`                  |
| `customerIds` | Narrow to one or more customers, comma-separated                | `?customerIds=1233,3332,553` |
| `countryIsos` | Restrict to countries, as ISO 3166-1 alpha-2 codes              | `?countryIsos=DK,FR,DE`      |

```bash theme={null}
curl "https://api.spirii.com/v2/afir/energy-infrastructure-tables?customerIds=1233&cpoId=42&countryIsos=DK,FR"
```

<Warning>
  With no filter, each endpoint returns only 100 records. Always filter by your `cpoId` or `customerIds` so you publish your complete infrastructure rather than a truncated sample.
</Warning>

## If your NAP uses OCPI

<Note>
  Where a National Access Point consumes OCPI rather than DATEX II, the same AFIR-required data is available through the OCPI-formatted [Locations](https://docs.spirii.com/api-reference/locations-v2/fetches-a-list-of-locations) endpoint, with the [Tariffs](https://docs.spirii.com/api-reference/tariffs-v2/fetches-a-single-existing-tariff) endpoint supplying the ad-hoc price breakdown (Article 20, paragraph 2(f)(3)). Unlike the DATEX II endpoints, this route uses your [API key](/developers/authentication).
</Note>

## Related

<CardGroup cols={2}>
  <Card title="AFIR static data" icon="table" href="https://docs.spirii.com/api-reference/afir/get-datex-ii-v3-afir-energy-infrastructure-tables">
    The DATEX II v3 infrastructure tables endpoint.
  </Card>

  <Card title="AFIR dynamic data" icon="signal" href="https://docs.spirii.com/api-reference/afir/get-datex-ii-v3-afir-energy-infrastructure-statuses">
    The DATEX II v3 real-time status endpoint.
  </Card>

  <Card title="Locations" icon="map-pin" href="/components/charging/locations">
    The site data behind both the DATEX II and OCPI routes.
  </Card>
</CardGroup>
