Get your own usage
curl --request GET \
--url https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks/v1/users/{user_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks/v1/users/{user_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks/v1/users/{user_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"user_id": "<string>",
"name": "<string>",
"email": "<string>",
"totals": {
"messages": 123,
"requests": 123,
"tokens_input": 123,
"tokens_output": 123,
"cost": 123,
"carbon": 123
},
"by_agent": [
{
"agent_id": "<string>",
"agent_name": "<string>",
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"cost": 123,
"carbon": 123,
"last_activity": "2023-11-07T05:31:56Z"
}
],
"daily": [
{
"day": "2023-12-25",
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"cost": 123,
"carbon": 123
}
],
"meta": {
"period": "<string>",
"period_start": "2023-11-07T05:31:56Z",
"scope": "self",
"generated_at": "2023-11-07T05:31:56Z",
"cache_ttl": 123
}
}{
"error": "InvalidArgumentsError",
"message": "Invalid arguments",
"details": {
"errors": []
}
}{
"error": "UNAUTHORIZED",
"message": "A user session is required"
}{
"error": "FORBIDDEN",
"message": "Access denied: missing permission 'ai-insights-v2:analytics:read'"
}{
"error": "RATE_LIMITED",
"message": "Rate limit exceeded"
}Consumption
Get your own usage
Returns the caller’s own LLM usage over the period: totals, a
breakdown per agent, and a daily series. The response always describes
the authenticated user (meta.scope: self), whatever user_id is
passed; requires a user session.
Rate limit: 100 requests per minute.
GET
/
v1
/
users
/
{user_id}
Get your own usage
curl --request GET \
--url https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks/v1/users/{user_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks/v1/users/{user_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks/v1/users/{user_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"user_id": "<string>",
"name": "<string>",
"email": "<string>",
"totals": {
"messages": 123,
"requests": 123,
"tokens_input": 123,
"tokens_output": 123,
"cost": 123,
"carbon": 123
},
"by_agent": [
{
"agent_id": "<string>",
"agent_name": "<string>",
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"cost": 123,
"carbon": 123,
"last_activity": "2023-11-07T05:31:56Z"
}
],
"daily": [
{
"day": "2023-12-25",
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"cost": 123,
"carbon": 123
}
],
"meta": {
"period": "<string>",
"period_start": "2023-11-07T05:31:56Z",
"scope": "self",
"generated_at": "2023-11-07T05:31:56Z",
"cache_ttl": 123
}
}{
"error": "InvalidArgumentsError",
"message": "Invalid arguments",
"details": {
"errors": []
}
}{
"error": "UNAUTHORIZED",
"message": "A user session is required"
}{
"error": "FORBIDDEN",
"message": "Access denied: missing permission 'ai-insights-v2:analytics:read'"
}{
"error": "RATE_LIMITED",
"message": "Rate limit exceeded"
}Authorizations
BearerAuthOrgApiKeyAuth
Path Parameters
Query Parameters
Response
The caller's usage.
Was this page helpful?