> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.eyelevel.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.eyelevel.ai/_mcp/server.

# get usage

GET https://api.groundx.ai/api/v1/customer/usage

Get usage for the authenticated account over a time period. GroundX selects its subscription and usage meter; do not supply their IDs or a customer ID. startTime is inclusive and endTime is exclusive. Both must be RFC3339 timestamps on minute boundaries and are converted to UTC. endTime cannot be in the future. The window cannot exceed 366 days. usageAsOf identifies the latest usage summary available to GroundX.

Reference: https://docs.eyelevel.ai/reference/api-reference/customer/get-usage

## Authentication

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

## Request

### Query parameters

- `metric` (enum, required) — Supported usage metric to query.
  - Allowed values: `searches`, `fileTokens`
- `startTime` (string, required) — Inclusive RFC3339 window start. Must be aligned to a minute boundary.
- `endTime` (string, required) — Exclusive RFC3339 window end. Must be aligned to a minute boundary and cannot be in the future.

## Response

### 200

Usage query success

- `customer` (CustomerUsageResponseCustomer, required)

## Errors

### 400 Bad Request Error

Invalid metric or time period

- `any`

### 404 Not Found Error

Current subscription or usage meter not found for the authenticated customer

- `any`

## Types

### CustomerUsageResponseCustomer

- `usage` (CustomerUsageDetail, required) — Aggregate customer usage for a requested time period.

### CustomerUsageDetail

Aggregate customer usage for a requested time period.

- `metric` (enum, required) — Supported usage metric queried.
  - Allowed values: `searches`, `fileTokens`
- `value` (integer, required) — Aggregate usage value for the requested time period.
- `startTime` (string, required) — Inclusive UTC window start used for the usage query.
- `endTime` (string, required) — Exclusive UTC window end used for the usage query.
- `usageAsOf` (string, required) — Time when GroundX read the latest available usage summary.
- `meterId` (string, optional) — Unique system generated ID for the usage meter resolved from the authenticated account.

## Examples

**Response**

```json
{
  "customer": {
    "usage": {
      "metric": "searches",
      "value": 4603,
      "startTime": "2026-07-15T00:00:00Z",
      "endTime": "2026-07-29T00:00:00Z",
      "usageAsOf": "2026-07-29T19:20:00Z",
      "meterId": "mtr_123"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.groundx.ai/api/v1/customer/usage"

querystring = {"metric":"searches","startTime":"2026-07-15T00:00:00Z","endTime":"2026-07-29T00:00:00Z"}

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

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

print(response.json())
```

```javascript
const url = 'https://api.groundx.ai/api/v1/customer/usage?metric=searches&startTime=2026-07-15T00%3A00%3A00Z&endTime=2026-07-29T00%3A00%3A00Z';
const options = {method: 'GET', headers: {'X-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.groundx.ai/api/v1/customer/usage?metric=searches&startTime=2026-07-15T00%3A00%3A00Z&endTime=2026-07-29T00%3A00%3A00Z"

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

	req.Header.Add("X-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.groundx.ai/api/v1/customer/usage?metric=searches&startTime=2026-07-15T00%3A00%3A00Z&endTime=2026-07-29T00%3A00%3A00Z")

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

request = Net::HTTP::Get.new(url)
request["X-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.groundx.ai/api/v1/customer/usage?metric=searches&startTime=2026-07-15T00%3A00%3A00Z&endTime=2026-07-29T00%3A00%3A00Z")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.groundx.ai/api/v1/customer/usage?metric=searches&startTime=2026-07-15T00%3A00%3A00Z&endTime=2026-07-29T00%3A00%3A00Z', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.groundx.ai/api/v1/customer/usage?metric=searches&startTime=2026-07-15T00%3A00%3A00Z&endTime=2026-07-29T00%3A00%3A00Z");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.groundx.ai/api/v1/customer/usage?metric=searches&startTime=2026-07-15T00%3A00%3A00Z&endTime=2026-07-29T00%3A00%3A00Z")! 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()
```