Your first request
You need an API token before starting. Read authentication first, then keep that token in server-side configuration.
Retrieve a small set of articles
After receiving your API token, you can begin interacting with the Onderwijsloket API. Start by requesting a selection of articles:
curl 'https://content.onderwijsloket.com/items/articles?fields=id&fields=title&fields=slug&limit=3&meta=total_count' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
A response might look like this:
{
"meta": {
"total_count": 83
},
"data": [
{
"id": "00f81660-a2e4-48af-b8d7-98ce338de447",
"title": "Hoe werkt de leerplicht in Nederland?",
"slug": "hoe-werkt-de-leerplicht-in-nederland"
},
{
"id": "01f90101-9f1c-4241-a7e8-0a1d60d7fa5d",
"title": "Wat is het vavo?",
"slug": "wat-is-het-vavo"
},
{
"id": "0dbab3e8-1d2b-489f-a539-1f4cdbec0f05",
"title": "Hoe kan ik zij-instromen als leraar in het voortgezet onderwijs?",
"slug": "hoe-kan-ik-zij-instromen-als-leraar-in-het-voortgezet-onderwijs"
}
]
}
Request related fields
Next, you may want more detailed information about an article. Using the article ID as a path parameter retrieves the full record and any related fields:
curl 'https://content.onderwijsloket.com/items/articles/01f90101-9f1c-4241-a7e8-0a1d60d7fa5d?fields=id&fields=title&fields=path&fields=summary&fields=faqs.faqs_id.question' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
A key part of this request is the fields=faqs.faqs_id.question parameter. This uses dot notation to request relational data:
The response looks like this:
{
"data": {
"id": "01f90101-9f1c-4241-a7e8-0a1d60d7fa5d",
"title": "Wat is het vavo?",
"path": "/kennisbank/artikelen/wat-is-het-vavo",
"summary": "Heb je interesse in (werken in) het volwassenenonderwijs? In het voortgezet algemeen volwassenenonderwijs (vavo) kunnen volwassenen een vmbo-tl-, havo- of vwo-diploma of deelcertificaten voor bepaalde schoolvakken halen. In dit artikel lees je voor wie het vavo bedoeld is, waar je het vavo kunt volgen, wat de kosten van deze opleiding zijn en welke kwalificatie je nodig hebt om hier les te mogen geven.",
"faqs": [
{
"faqs_id": {
"question": "Wat is het vavo?"
}
}
]
}
}
Shape the response with query parameters
Directus provides extensive query options to shape your responses, including selecting specific fields, filtering and sorting results, paginating large collections, and expanding relational data.
Below is an example of filtering articles based on a related topic with the slug pdg-traject. In this example, topics is the relational field linking an article to its associated topics.
curl 'https://content.onderwijsloket.com/items/articles?limit=3&fields=id%2Ctitle%2Cslug%2Ctopics.topics_id.name&filter={%22topics%22%3A{%22topics_id%22%3A{%22slug%22%3A{%22_eq%22%3A%20%22pdg-traject%22}}}}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
This query returns only articles whose related topic has a slug equal to pdg-traject, along with selected fields for clarity.
The filter parameter uses an object with the following structure:
{
"topics": {
"topics_id": {
"slug": {
"_eq": "pdg-traject"
}
}
}
}
Many more query parameters, filter options, and features are available to help tailor your requests. Refer to the Directus documentation for deeper guidance on:
Use the Directus SDK
When working with our API, we recommend using the Directus SDK. It offers:
- Type-safe API interactions
- Built-in utilities for authentication and querying
- Simplified handling of relational data
This significantly reduces boilerplate and improves reliability.
Check the API reference
All available endpoints, parameters, data structures, and example responses are documented in our interactive API reference. Use it as the primary source of truth when building against the Onderwijsloket API.
API ReferenceLearn the data model
To work effectively with the API, it helps to understand the structure and relationships within our collections. Reviewing the data model will provide context for how items relate and how to navigate more complex queries.
Keep in touch with the latest
Sign up for our monthly deep dives - straight to your inbox.