# Get usage

> Documentation index: https://exomations.com/llms.txt

`GET /api/v1/usage`

This month's runs, the monthly limit and held runs for the workspace.

This month's run figures for the key's workspace, from the same counters the app uses. It also answers while the workspace is awaiting its card verification.

## Authorization

The REST API is being rolled out and is not yet available to every workspace. Send an API key with the `read` permission in the `X-Api-Key` header. REST API access must be switched on for the workspace; see the REST API overview.

## Parameters

This endpoint takes no parameters.

## Response

The answer is one object with these fields:

| Name | Type | Description |
|---|---|---|
| `period` | string | The allowance month as `YYYY-MM`: the calendar month in Riyadh time (UTC+3), the same month the monthly allowance, held runs and the monthly reset use. A month starts at midnight Riyadh time, which is 21:00 UTC on the last day of the previous month. |
| `executionCount` | integer | Runs counted this month. |
| `successCount` | integer | Runs this month that succeeded. |
| `failureCount` | integer | Runs this month that failed. |
| `limit` | integer | The monthly run allowance, purchased run blocks included. `-1` means unlimited. |
| `remaining` | integer \| null | Runs left this month (never below 0), or `null` when the allowance is unlimited. |
| `heldCount` | integer | Runs held now because the workspace is past 120% of its monthly allowance. |

### 200

```json
{
  "period": "2026-11",
  "executionCount": 1240,
  "successCount": 1198,
  "failureCount": 42,
  "limit": 5000,
  "remaining": 3760,
  "heldCount": 0
}
```

## Errors

Every error is JSON with three fields: `error` (a short title), `code` (a fixed name your code can rely on) and `message` (a sentence for people). An unknown path under `/api/v1` answers `404` with `NOT_FOUND`.

| Status | Code | When | Message |
|---|---|---|---|
| 401 | `UNAUTHENTICATED` | The key is missing, not an Exomations API key, unknown, inactive, expired or deleted, or it was sent in the URL or an `Authorization` header. | `A valid API key is required in the X-Api-Key header.` |
| 403 | `FORBIDDEN` | The key does not carry `read`. | `This API key does not have the Read permission.` |
| 403 | `FORBIDDEN` | The workspace is suspended. | `This workspace is suspended.` |
| 403 | `API_NOT_ENABLED` | REST API access is off for the workspace. | `REST API access is turned off for this workspace. An admin or the owner can turn it on on the API Keys page.` |
| 405 | `METHOD_NOT_ALLOWED` | A method other than `GET` or `HEAD`. The `Allow` header lists the methods. | `This endpoint does not support this method. See the Allow header.` |
| 429 | `RATE_LIMITED` | Too many calls in a minute (calls without a valid key are limited too). | `Rate limit reached. Retry after the number of seconds in the Retry-After header.` |
| 500 | `INTERNAL` | Something failed on our side. Retry; if it happens again, contact support. | `Something went wrong on our side. Please try again.` |

## Examples

### cURL

```bash
curl https://exomations.com/api/v1/usage \
  -H "X-Api-Key: exo_your_key"
```

### JavaScript

```javascript
const res = await fetch("https://exomations.com/api/v1/usage", {
  headers: { "X-Api-Key": process.env.EXOMATIONS_KEY }, // exo_...
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.code}: ${body.message}`);
console.log(body.executionCount, body.remaining);
```

### Python

```python
import os, requests

res = requests.get(
    "https://exomations.com/api/v1/usage",
    headers={"X-Api-Key": os.environ["EXOMATIONS_KEY"]},  # exo_...
    timeout=15,
)
body = res.json()
if res.status_code != 200:
    raise RuntimeError(f"{body['code']}: {body['message']}")
print(body["executionCount"], body["remaining"])
```
