# Getting started

> Create an API key, get an access token and make your first request to the Fledge API.

The Fledge API is an [OData v4](https://www.odata.org/documentation/) API over the same data the Fledge app uses. It reads and writes JSON over HTTPS.

|  |  |
| --- | --- |
| Base URL | `https://odata-api.fledge.nl/v2-8` (the current stable version, see [Versions](#versions)) |
| Format | JSON, OData v4 |
| Authentication | Access token from your API key, as `Authorization: Bearer <token>` |
| Reference | [Every entity set, with its fields](https://docs.fledge.nl/en/api/reference) |

> **Tip:** Building with an AI coding assistant, such as Claude Code or Cursor? Connect the Fledge MCP server to it first: it then knows how Fledge data works and follows the rules of the API. See [Build with an AI assistant](https://docs.fledge.nl/en/api/ai-assistant).

## Versions

Version 2 of the API is still in active development, so there is no long-term support version yet. You choose between two URLs:

| URL | What it is | Use it for |
| --- | --- | --- |
| `https://odata-api.fledge.nl/v2-8` | **Stable.** The entity sets and field names of this version don't change. A new stable version replaces it every few weeks. | Integrations in production |
| `https://odata-api.fledge.nl/v2-latest` | **Latest.** Always the newest version. At a new release, an entity set or field can be renamed or removed, without notice. | Trying things out and development |

- **Stable** gives you a fixed contract, but you move along: every few weeks, test your integration against the new stable version and switch to its URL.
- **Latest** saves you that switch, but your integration can break on the day of a release, and you fix it afterwards.

The [reference](https://docs.fledge.nl/en/api/reference) on this site describes the current stable version. When a new one comes out, it shows the new field names.

## 1. Create an API key

1. In Fledge, open **Instellingen** and choose **API** under **Integraties & koppelingen**. You need the **BEHEER** license.
2. Click **API-token**, give the key a name and tick its scopes: **Fledge Portaal** (`FLEDGE_PORTAL`) for most entity sets, **Fledge Terminal** (`FLEDGE_TERMINAL`) where the reference names it.
3. Copy the key. Fledge shows it only once.

The key acts as the user who made it: it reads and writes what that user may, in the administrations that user has.

> **Important:** Keep the key secret, like a password. Store it in your software's secret store, never in code or a repository. Remove a key you no longer use.

## 2. Get an access token

Exchange the key for a short-lived access token:

```bash
curl -X POST https://oauth2.fledge.nl/oauth2/token \
  -d grant_type=urn:ietf:params:oauth:grant-type:api_key \
  -d api_key=$FLEDGE_API_KEY
```

The answer has `access_token`. See [Authentication](https://docs.fledge.nl/en/api/authentication) for its lifetime and examples in other languages.

## 3. Make a request

Find the administrations you can use:

```bash
curl -G https://odata-api.fledge.nl/v2-8/Administrations \
  --data-urlencode '$select=administration_id,name' \
  -H "Authorization: Bearer $TOKEN"
```

Then read data of one administration, with only the fields you need:

```bash
curl -G https://odata-api.fledge.nl/v2-8/SalesOrderHeaders \
  --data-urlencode '$filter=administration_id eq 1' \
  --data-urlencode '$select=sales_order_header_id,order_date,your_reference' \
  --data-urlencode '$top=20' \
  -H "Authorization: Bearer $TOKEN"
```

```json
{
  "value": [
    { "@odata.etag": "…", "sales_order_header_id": "…", "order_date": "2026-11-28", "your_reference": "…" }
  ]
}
```

## Next

- [Reading data](https://docs.fledge.nl/en/api/reading-data): filters, relations, paging and totals.
- [Writing data](https://docs.fledge.nl/en/api/writing-data): create, change and delete rows, and actions.
- [Errors and limits](https://docs.fledge.nl/en/api/errors-and-limits) and [Good practice](https://docs.fledge.nl/en/api/good-practice) before you go live.

---

Source: https://docs.fledge.nl/en/api/getting-started
