# Entitlements API | API reference
Source: https://greenpixie.com/docs/reference/api/entitlements

Check which plan an API key is on and how much grid history it can request.

## Overview [#overview]

The Entitlements API tells you which plan your Greenpixie API key is on and how much grid history you can request.

## Request [#request]

```bash
curl "https://api.greenpixie.com/v1/entitlements" \
  -H "Authorization: Bearer $GPX_KEY"
```

The endpoint takes no parameters. It accepts the same API key as the Rate Card API.

## Response [#response]

```json
{
  "plan": "paid",
  "grid_history": {
    "tier": "historic",
    "earliest_period": "2020-01",
    "latest_period": "2026-10"
  }
}
```

| Field          | Description                               |
| -------------- | ----------------------------------------- |
| `plan`         | The plan the key is on: `free` or `paid`. |
| `grid_history` | The grid periods the key can request.     |

### Grid history [#grid-history]

`grid_history` tells you which months you can pass as `grid_period` on the Rate Card API.

| Field             | Description                                                                                                             |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `tier`            | `historic` for any period with grid data, or `last_complete_month` for that single month.                               |
| `earliest_period` | The earliest month the key can request, as `YYYY-MM`.                                                                   |
| `latest_period`   | The latest complete month the key can request, as `YYYY-MM`. Also the month used when a request sends no `grid_period`. |

On the `last_complete_month` tier, `earliest_period` and `latest_period` are the same month.

## Errors [#errors]

| Status | Code                    | Meaning                                                       |
| ------ | ----------------------- | ------------------------------------------------------------- |
| 401    | `key_not_recognised`    | The API key is missing, not recognised, revoked or expired.   |
| 403    | `insufficient_scope`    | The API key cannot read rate cards.                           |
| 403    | `terms_not_accepted`    | The key's organisation has not accepted the terms in the app. |
| 503    | `grid_data_unavailable` | Grid history cannot be reported right now. Retry later.       |

See the [API reference](https://api.greenpixie.com/v1/docs/ratecard) for the full schema.