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

# Get project analytics

GET https://alephant.io/api/v1/projects/{id}/analytics

Return summary usage and top spenders across assigned members and agents for an Enterprise workspace. All workspace members may read; PATs require the read scope.

Reference: https://developers.alephant.io/api-reference/saa-s-api/projects/get-project-analytics

## Servers

- `https://alephant.io` (Production, default)
- `https://dev.alephant.io` (Development)

## Request

### Path parameters

- `id` (string, required) — Project UUID

### Query parameters

- `period` (enum, optional, default: 7d) — Analytics period
  - Allowed values: `1d`, `7d`, `30d`

### Headers

- `Authorization` (string, required) — Bearer \{access\_token}
- `X-Workspace-Id` (string, required) — Workspace UUID

## Response

### 200

data: project analytics

- `data` (object, optional)
  - `period` (object, optional)
    - `end` (datetime, optional)
    - `key` (enum, optional)
      - Allowed values: `1d`, `7d`, `30d`
    - `start` (datetime, optional)
    - `timezone` (string, optional)
  - `projectId` (string, optional)
  - `summary` (object, optional)
    - `activeAgents` (long, optional)
    - `activeMembers` (long, optional)
    - `cost` (double, optional)
    - `requests` (long, optional)
    - `tokens` (long, optional)
  - `topSpenders` (list of object, optional)
    - `cost` (double, optional)
    - `deleted` (boolean, optional)
    - `entityId` (string, optional)
    - `entityType` (enum, optional)
      - Allowed values: `member`, `agent`
    - `name` (string, optional)
    - `requests` (long, optional)
    - `tokens` (long, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "period": {
      "end": "2024-01-15T09:30:00Z",
      "key": "1d",
      "start": "2024-01-15T00:00:00Z",
      "timezone": "America/New_York"
    },
    "projectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "summary": {
      "activeAgents": 5,
      "activeMembers": 12,
      "cost": 254.75,
      "requests": 13450,
      "tokens": 987654
    },
    "topSpenders": [
      {
        "cost": 120.5,
        "deleted": false,
        "entityId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
        "entityType": "member",
        "name": "Alice Johnson",
        "requests": 6500,
        "tokens": 450000
      },
      {
        "cost": 85.25,
        "deleted": false,
        "entityId": "1d4f3e2a-9b7c-4f3a-8a2d-3e4f5b6c7d8e",
        "entityType": "agent",
        "name": "ChatBot Alpha",
        "requests": 4000,
        "tokens": 300000
      }
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://alephant.io/api/v1/projects/id/analytics"

payload = {}
headers = {
    "Authorization": "Authorization",
    "X-Workspace-Id": "X-Workspace-Id",
    "Content-Type": "application/json"
}

response = requests.get(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://alephant.io/api/v1/projects/id/analytics';
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Authorization',
    'X-Workspace-Id': 'X-Workspace-Id',
    'Content-Type': 'application/json'
  },
  body: '{}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://alephant.io/api/v1/projects/id/analytics"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Authorization")
	req.Header.Add("X-Workspace-Id", "X-Workspace-Id")
	req.Header.Add("Content-Type", "application/json")

	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://alephant.io/api/v1/projects/id/analytics")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Authorization'
request["X-Workspace-Id"] = 'X-Workspace-Id'
request["Content-Type"] = 'application/json'
request.body = "{}"

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://alephant.io/api/v1/projects/id/analytics")
  .header("Authorization", "Authorization")
  .header("X-Workspace-Id", "X-Workspace-Id")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://alephant.io/api/v1/projects/id/analytics', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Authorization',
    'Content-Type' => 'application/json',
    'X-Workspace-Id' => 'X-Workspace-Id',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://alephant.io/api/v1/projects/id/analytics");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Authorization");
request.AddHeader("X-Workspace-Id", "X-Workspace-Id");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Authorization",
  "X-Workspace-Id": "X-Workspace-Id",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://alephant.io/api/v1/projects/id/analytics")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```