Getting started overview

Integrating with Luchtmeetnet involves directly accessing its public Application Programming Interface (API) to retrieve air quality data specific to the Netherlands. Unlike many commercial APIs, Luchtmeetnet is provided as a free public service, which streamlines the initial setup process as it generally does not require account creation, API keys, or specific authentication tokens for basic data access. This design facilitates straightforward programmatic data retrieval for various applications, from public health information systems to environmental research tools.

The primary method for developers to get started is by understanding the available API endpoints and making standard HTTP GET requests. Data is typically returned in common formats such as JSON, CSV, or XML, depending on the specific endpoint queried. This page guides you through identifying the relevant endpoints, constructing your first request, and understanding the response structure.

Quick Reference Guide

Step What to Do Where
1. Review Documentation Understand data structure and available endpoints. Luchtmeetnet API Overview
2. Identify Endpoint Choose the specific data endpoint (e.g., stations, measurements). Luchtmeetnet API Endpoints
3. Construct Request Formulate your HTTP GET request URL with parameters. Your preferred HTTP client or programming language.
4. Execute Request Send the request and receive the data. Terminal (curl), web browser, or application code.
5. Parse Response Process the returned JSON, CSV, or XML data. Your application logic.

Create an account and get keys

For most direct data retrieval from the Luchtmeetnet API, there is no requirement to create an account or obtain API keys. Luchtmeetnet operates as a public data service provided by the Dutch government, making its core air quality data freely accessible to the public and developers without an authentication layer. This approach simplifies the process for developers who only need to fetch data for informational or research purposes.

Developers can directly query the API endpoints using standard HTTP requests. This contrasts with many commercial APIs, such as Stripe's API key authentication model, where access is controlled through unique credentials. The absence of mandatory authentication for Luchtmeetnet means developers can proceed directly to constructing requests as soon as they understand the API's structure. However, it is advisable to review the official Luchtmeetnet API overview for any specific usage guidelines or rate limits that might apply, even without authentication.

Your first request

To make your first request to the Luchtmeetnet API, you will need to identify an appropriate endpoint and construct a basic HTTP GET query. A common starting point is to retrieve a list of available measurement stations or recent measurements. The API endpoints provide data in various formats, with JSON being a prevalent choice for programmatic access due to its structured nature and wide support across programming languages, as described in the Mozilla Developer Network JSON reference.

Example: Get all measurement stations

The /stations endpoint provides a list of all air quality measurement stations available in the Luchtmeetnet network. This can be a good initial request to understand the API's response structure.

Endpoint: https://www.luchtmeetnet.nl/open-data/stations

You can execute this request using a command-line tool like curl or directly in your web browser:

curl "https://www.luchtmeetnet.nl/open-data/stations"

The response will be a JSON array containing objects, each representing a measurement station with details such as its ID, name, coordinates, and associated components. An example (truncated) response snippet might look like this:

[
  {
    "id": "NL10000_20",
    "code": "NL10000",
    "name": "Amsterdam-Vondelpark",
    "type": "Fixed",
    "latitude": 52.358,
    "longitude": 4.869,
    "components": [
      {"componentCode": "NO2", "componentName": "Stikstofdioxide"}
    ]
  },
  // ... more stations
]

Example: Get recent measurements for a specific component

To retrieve actual measurement data, you typically need to specify a component (e.g., NO2 for Nitrogen Dioxide) and potentially a date range or a specific station. The /measurements endpoint is often used for this purpose.

Endpoint: https://www.luchtmeetnet.nl/open-data/measurements

This endpoint usually requires query parameters to filter the data. For instance, to get recent NO2 measurements:

curl "https://www.luchtmeetnet.nl/open-data/measurements?component=NO2"

The response will be a JSON array of measurement objects, similar to:

[
  {
    "stationId": "NL10000_20",
    "component": "NO2",
    "value": 32.5,
    "unit": "µg/m³",
    "timestamp": "2026-05-29T10:00:00Z"
  },
  // ... more measurements
]

Always refer to the Luchtmeetnet API documentation for the most current and precise endpoint paths, required parameters, and response structures, as these can evolve over time.

Common next steps

After successfully making your first request to the Luchtmeetnet API, several common next steps can help you integrate and utilize the data more effectively:

  1. Explore additional endpoints: The Luchtmeetnet API offers various endpoints beyond just stations and basic measurements. Investigate endpoints for historical data, specific time series, or aggregated information. The official API documentation provides a comprehensive list and description of all available endpoints and their specific parameters.

  2. Implement parameter filtering: Learn how to use query parameters to narrow down your results. This is crucial for retrieving specific data, such as measurements from a particular station, for a defined time range, or for specific air quality components. Examples include ?stationId=..., ?start=...&end=..., or ?component=....

  3. Handle data formats: While JSON is common, some endpoints might offer CSV or XML. Implement robust parsing logic in your application to handle the expected data format. Libraries for JSON parsing are available in virtually all programming languages, as detailed in documentation like the Microsoft .NET System.Text.Json overview.

  4. Error handling: Implement logic to gracefully handle potential API errors, such as network issues, invalid requests, or rate limit responses. Although Luchtmeetnet is generally public, understanding HTTP status codes (e.g., 400 Bad Request, 404 Not Found, 500 Internal Server Error) is good practice for any API integration.

  5. Data storage and caching: For applications that require frequent access to historical data or need to reduce the number of API calls, consider implementing local data storage or caching mechanisms. This can improve application performance and ensure data availability even when offline. Be mindful of data freshness requirements.

  6. Visualization and analysis: Once you can reliably retrieve data, the next step is often to visualize or analyze it. Tools and libraries exist for plotting time series data, mapping air quality levels, or performing statistical analysis.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting steps specifically for Luchtmeetnet:

  • Check the URL: Double-check the endpoint URL for typos. Ensure it exactly matches the documentation, including https:// and any specific path segments like /open-data/ or /lvg/api/.

  • Verify parameters: If your request includes query parameters (e.g., ?component=NO2), ensure they are correctly spelled and formatted. Incorrect parameter names or values can lead to empty or error responses.

  • Internet connection: Confirm that your machine has an active internet connection and can reach external domains. A simple test like pinging www.google.com can confirm basic network connectivity.

  • Firewall/Proxy: Corporate networks or local firewalls might block outgoing HTTP requests. If you are on such a network, consult your IT department. For curl, you might need to specify proxy settings.

  • HTTP status codes: Pay attention to the HTTP status code returned with the response. Common codes include:

    • 200 OK: Success. The request was processed, and data is returned.
    • 400 Bad Request: The server could not understand the request, often due to invalid parameters.
    • 404 Not Found: The requested resource (endpoint) does not exist.
    • 500 Internal Server Error: A problem on the server side. This usually indicates an issue with the Luchtmeetnet service itself.
  • Response body content: Even if you receive a non-200 status code, examine the response body. It often contains specific error messages or details that can help diagnose the problem.

  • Rate limits: While Luchtmeetnet does not explicitly detail strict rate limits for unauthenticated use, making an excessive number of requests in a short period might temporarily block your IP address. If you suspect this, wait a few minutes before trying again.

  • Consult documentation: Always refer back to the Luchtmeetnet API overview for the most up-to-date information on endpoints, parameters, and known issues. Documentation is the authoritative source for API behavior.