> If you are setting up, configuring, or answering questions about Schematic, connect the
> Schematic MCP server before working from these pages. It reads and writes plans, features,
> entitlements, and overrides against the real account, so what you report and what you build
> match what actually exists.
>
> The server is at https://api.schematichq.com/mcp
>
> From Claude, ChatGPT, or another chat assistant, add it as a custom connector:
> https://docs.schematichq.com/working-with-ai
>
> From a coding assistant such as Claude Code, Codex, or Cursor:
> https://docs.schematichq.com/building-with-ai
>
> For clean Markdown of any page, append `.md` to the page URL. For a complete page index,
> see https://docs.schematichq.com/llms.txt

# List feature usage history

GET https://api.schematichq.com/feature-usage-history

Reference: https://docs.schematichq.com/api-reference/entitlements/list-feature-usage-history

## Authentication

- `X-Schematic-Api-Key` header (required) — API Key authentication via header

## Request

### Query parameters

- `company_ids` (list of string, optional) — Restrict to these company IDs; omit for every company in the environment
- `end_time` (datetime, required) — Exclusive end of the window; must fall on an hour boundary
- `feature_ids` (list of string, optional) — Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit
- `granularity` (enum, optional) — Bucket the window; omit for a single total per company and feature
  - Allowed values: `daily`, `hourly`, `monthly`, `weekly`
- `start_time` (datetime, required) — Inclusive start of the window; must fall on an hour boundary
- `limit` (long, optional) — Page limit (default 100)
- `offset` (long, optional) — Page offset (default 0)

## Response

### 200

OK

- `data` (list of FeatureUsageHistoryResponseData, required)
- `params` (FeatureUsageHistoryGetResponsesContentApplicationJsonSchemaParams, required) — Input parameters

## Errors

### 400 Bad Request Error

Bad request

- `error` (string, required) — Error message

### 401 Unauthorized Error

Unauthorized

- `error` (string, required) — Error message

### 403 Forbidden Error

Forbidden

- `error` (string, required) — Error message

### 404 Not Found Error

Not found

- `error` (string, required) — Error message

### 500 Internal Server Error

Server error

- `error` (string, required) — Error message

## Types

### FeatureUsageHistoryResponseData

- `company_id` (string, required) — Companies are identified by ID only. To report against your own identifiers, resolve them once via the companies API and cache the mapping; keys are not repeated on every row.
- `event_subtype` (string, required)
- `feature_id` (string, required)
- `period_end` (datetime, required) — Exclusive end of the period this usage covers
- `period_start` (datetime, required) — Inclusive start of the period this usage covers
- `usage` (long, required) — Usage recorded within this period; an incremental total, not a running one

### FeatureUsageHistoryGetResponsesContentApplicationJsonSchemaParams

Input parameters

- `company_ids` (list of string, optional) — Restrict to these company IDs; omit for every company in the environment
- `end_time` (datetime, optional) — Exclusive end of the window; must fall on an hour boundary
- `feature_ids` (list of string, optional) — Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit
- `granularity` (enum, optional) — Bucket the window; omit for a single total per company and feature
  - Allowed values: `daily`, `hourly`, `monthly`, `weekly`
- `limit` (long, optional) — Page limit (default 100)
- `offset` (long, optional) — Page offset (default 0)
- `start_time` (datetime, optional) — Inclusive start of the window; must fall on an hour boundary

## Examples

**Response**

```json
{
  "data": [
    {
      "company_id": "string",
      "event_subtype": "string",
      "feature_id": "string",
      "period_end": "2024-01-15T09:30:00Z",
      "period_start": "2024-01-15T09:30:00Z",
      "usage": 1
    }
  ],
  "params": {
    "company_ids": [
      "string"
    ],
    "end_time": "2024-01-15T09:30:00Z",
    "feature_ids": [
      "string"
    ],
    "granularity": "daily",
    "limit": 100,
    "offset": 0,
    "start_time": "2024-01-15T09:30:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.schematichq.com/feature-usage-history"

querystring = {"end_time":"end_time","start_time":"start_time"}

headers = {"X-Schematic-Api-Key": "<apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.schematichq.com/feature-usage-history?end_time=end_time&start_time=start_time';
const options = {method: 'GET', headers: {'X-Schematic-Api-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.schematichq.com/feature-usage-history?end_time=end_time&start_time=start_time"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Schematic-Api-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.schematichq.com/feature-usage-history?end_time=end_time&start_time=start_time")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Schematic-Api-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.schematichq.com/feature-usage-history?end_time=end_time&start_time=start_time")
  .header("X-Schematic-Api-Key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.schematichq.com/feature-usage-history?end_time=end_time&start_time=start_time', [
  'headers' => [
    'X-Schematic-Api-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.schematichq.com/feature-usage-history?end_time=end_time&start_time=start_time");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Schematic-Api-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-Schematic-Api-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.schematichq.com/feature-usage-history?end_time=end_time&start_time=start_time")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```