> ## Documentation Index
> Fetch the complete documentation index at: https://docs.silicondata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Token Index API

> API docs for accessing Token Index from Silicon Data.

> **Note:** Access to the Token Index API is gated per subscription. Your subscription may restrict the available `token`, `index_version`, and queryable date range.

## <span style={{ color: 'white', fontWeight: 'bold', backgroundColor: '#007BFF', border: '2px solid #007BFF', borderRadius: '5px', padding: '5px', display: 'inline-block' }}>POST</span> /api/token-index/index

Get daily LLM token index data for a requested token, index version, and date range. If no date range is provided, data for the server current date is used by default. Missing dates are returned as `"-1"`.

### Authorization

This endpoint requires a valid user token or application token.

**🔒OAuth2**: OAuth2PasswordBearer\
**Flow type**: password\
**Token URL**: token

### Request Body

The request body must be in `application/json` format.

| Field           | Type           | Required | Description                                                                               | Constraints                                                                        |
| --------------- | -------------- | -------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `token`         | string         | YES      | LLM token index type (case-insensitive). Currently supported: `expenditure`.              | 1 to 60 characters                                                                 |
| `index_version` | string         | NO       | Token index version. Defaults to `v1` (case-insensitive).                                 | 1 to 60 characters                                                                 |
| `starting_date` | string or null | NO       | The start date for the query in `YYYY-MM-DD` format. Defaults to the server current date. | On or after `2025-12-01`, unless deployment config overrides it; not in the future |
| `ending_date`   | string or null | NO       | The end date for the query in `YYYY-MM-DD` format. Defaults to the server current date.   | Not in the future                                                                  |

`starting_date` must be less than or equal to `ending_date`.

### Request Example

```json theme={null}
{
  "token": "expenditure",
  "index_version": "v1",
  "starting_date": "2026-04-20",
  "ending_date": "2026-04-26"
}
```

### Responses

* **200**: Successful Response

  Index values are returned as strings formatted to four decimal places. `index_name` is taken from the underlying data and may be `null` if no data exists for the range.

```json theme={null}
{
  "meta": {
    "code": 0,
    "url": "/api/token-index/index",
    "message": "OK",
    "timestamp": 1777545600
  },
  "data": {
    "token": "expenditure",
    "index_name": "Token Expenditure Index",
    "index_version": "v1",
    "starting_date": "2026-04-20",
    "ending_date": "2026-04-26",
    "indexes": {
      "2026-04-20": "100.0000",
      "2026-04-21": "101.2345",
      "2026-04-22": "-1",
      "2026-04-23": "103.5678",
      "2026-04-24": "104.0000",
      "2026-04-25": "-1",
      "2026-04-26": "105.4321"
    }
  }
}
```

* **422**: Validation Error

```json theme={null}
{
  "meta": {
    "code": 422,
    "url": "/api/token-index/index",
    "message": "Parameter value error: ...",
    "timestamp": 1777545600
  },
  "data": {}
}
```

* **10008**: Date range error

```json theme={null}
{
  "meta": {
    "code": 10008,
    "url": "/api/token-index/index",
    "message": "starting date should be less than or equal to ending date",
    "timestamp": 1777545600,
    "args": [],
    "kwargs": {}
  },
  "data": {}
}
```

* **34004**: Product permission is missing

```json theme={null}
{
  "meta": {
    "code": 34004,
    "url": "/api/token-index/index",
    "message": "You don't have permission to access the current product...",
    "timestamp": 1777545600
  },
  "data": {}
}
```
