Usage
Usage tracking and quotas
Get current usage
GET
/organizations/{org_id}/usageGet current billing cycle usage and quotas
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
org_id | string | path | Yes | Organization ID |
Code Examples
curl -X GET "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/usage" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/usage", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"organization_id": "550e8400-e29b-41d4-a716-446655440000",
"billing_cycle_start": "2025-10-02T15:30:00Z",
"billing_cycle_end": "2025-10-02T15:30:00Z",
"metrics": [
{
"metric_type": "search_query",
"current": 5000,
"limit": 10000,
"remaining": 5000,
"percentage": 50
}
],
"is_frozen": true,
"frozen_reason": "Quota exceeded without billing configured"
}{
"type": "https://platform.antfly.io/errors/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Email address is required",
"instance": "https://platform.antfly.io/api/v1/users/550e8400-e29b-41d4-a716-446655440000",
"errors": [
{
"field": "string",
"message": "string"
}
]
}{
"type": "https://platform.antfly.io/errors/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Email address is required",
"instance": "https://platform.antfly.io/api/v1/users/550e8400-e29b-41d4-a716-446655440000",
"errors": [
{
"field": "string",
"message": "string"
}
]
}{
"type": "https://platform.antfly.io/errors/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Email address is required",
"instance": "https://platform.antfly.io/api/v1/users/550e8400-e29b-41d4-a716-446655440000",
"errors": [
{
"field": "string",
"message": "string"
}
]
}Get usage history
GET
/organizations/{org_id}/usage/historyGet historical usage data by billing cycle
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
org_id | string | path | Yes | Organization ID |
start_date | string | query | No | Start date (YYYY-MM-DD) |
end_date | string | query | No | End date (YYYY-MM-DD) |
offset | integer | query | No | Number of items to skip |
limit | integer | query | No | Maximum number of items to return |
Code Examples
curl -X GET "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/usage/history?start_date=2025-10-02&end_date=2025-10-02&offset=0&limit=20" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/usage/history?start_date=2025-10-02&end_date=2025-10-02&offset=0&limit=20", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"data": [
{
"billing_cycle": "2025-10-02",
"metrics": [
{
"metric_type": "search_query",
"total": 0
}
]
}
],
"meta": {
"offset": 0,
"limit": 1,
"total": 0
}
}{
"type": "https://platform.antfly.io/errors/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Email address is required",
"instance": "https://platform.antfly.io/api/v1/users/550e8400-e29b-41d4-a716-446655440000",
"errors": [
{
"field": "string",
"message": "string"
}
]
}{
"type": "https://platform.antfly.io/errors/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Email address is required",
"instance": "https://platform.antfly.io/api/v1/users/550e8400-e29b-41d4-a716-446655440000",
"errors": [
{
"field": "string",
"message": "string"
}
]
}{
"type": "https://platform.antfly.io/errors/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Email address is required",
"instance": "https://platform.antfly.io/api/v1/users/550e8400-e29b-41d4-a716-446655440000",
"errors": [
{
"field": "string",
"message": "string"
}
]
}{
"type": "https://platform.antfly.io/errors/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Email address is required",
"instance": "https://platform.antfly.io/api/v1/users/550e8400-e29b-41d4-a716-446655440000",
"errors": [
{
"field": "string",
"message": "string"
}
]
}