Usage API

Track and monitor API usage and quotas.

Endpoints#

MethodEndpointDescription
GET/usageGet current period usage
GET/usage/historyGet historical usage
GET/usage/breakdownGet usage by category

Usage Object#

1{ 2 "period": { 3 "start": "2024-01-01T00:00:00Z", 4 "end": "2024-01-31T23:59:59Z" 5 }, 6 "summary": { 7 "apiCalls": { 8 "used": 5420, 9 "limit": 10000, 10 "percentage": 54.2 11 }, 12 "agentInvocations": { 13 "used": 342, 14 "limit": 1000, 15 "percentage": 34.2 16 }, 17 "skillApplications": { 18 "used": 89, 19 "limit": 500, 20 "percentage": 17.8 21 }, 22 "contextGenerations": { 23 "used": 156, 24 "limit": 500, 25 "percentage": 31.2 26 } 27 }, 28 "quotaResetAt": "2024-02-01T00:00:00Z" 29}

Get Current Usage#

GET /usage

Example Request#

curl https://api.bootspring.dev/v1/usage \ -H "Authorization: Bearer bs_xxx"

Response#

1{ 2 "data": { 3 "period": { 4 "start": "2024-01-01T00:00:00Z", 5 "end": "2024-01-31T23:59:59Z" 6 }, 7 "summary": { 8 "apiCalls": { 9 "used": 5420, 10 "limit": 10000, 11 "percentage": 54.2 12 }, 13 "agentInvocations": { 14 "used": 342, 15 "limit": 1000, 16 "percentage": 34.2 17 }, 18 "skillApplications": { 19 "used": 89, 20 "limit": 500, 21 "percentage": 17.8 22 }, 23 "contextGenerations": { 24 "used": 156, 25 "limit": 500, 26 "percentage": 31.2 27 } 28 }, 29 "quotaResetAt": "2024-02-01T00:00:00Z" 30 } 31}

Get Usage History#

GET /usage/history

Query Parameters#

ParameterTypeDescription
periodstringdaily, weekly, monthly (default: daily)
startstringStart date (ISO 8601)
endstringEnd date (ISO 8601)
metricstringSpecific metric to retrieve

Example Request#

curl "https://api.bootspring.dev/v1/usage/history?period=daily&start=2024-01-01&end=2024-01-15" \ -H "Authorization: Bearer bs_xxx"

Response#

1{ 2 "data": { 3 "period": "daily", 4 "metrics": [ 5 { 6 "date": "2024-01-15", 7 "apiCalls": 450, 8 "agentInvocations": 28, 9 "skillApplications": 5, 10 "contextGenerations": 12 11 }, 12 { 13 "date": "2024-01-14", 14 "apiCalls": 380, 15 "agentInvocations": 22, 16 "skillApplications": 8, 17 "contextGenerations": 10 18 } 19 ] 20 } 21}

Get Usage Breakdown#

GET /usage/breakdown

Query Parameters#

ParameterTypeDescription
groupBystringproject, agent, skill, endpoint
startstringStart date (ISO 8601)
endstringEnd date (ISO 8601)

Example Request#

curl "https://api.bootspring.dev/v1/usage/breakdown?groupBy=agent" \ -H "Authorization: Bearer bs_xxx"

Response#

1{ 2 "data": { 3 "groupBy": "agent", 4 "period": { 5 "start": "2024-01-01T00:00:00Z", 6 "end": "2024-01-31T23:59:59Z" 7 }, 8 "breakdown": [ 9 { 10 "name": "frontend-expert", 11 "invocations": 156, 12 "percentage": 45.6 13 }, 14 { 15 "name": "backend-expert", 16 "invocations": 98, 17 "percentage": 28.7 18 }, 19 { 20 "name": "database-expert", 21 "invocations": 52, 22 "percentage": 15.2 23 }, 24 { 25 "name": "testing-expert", 26 "invocations": 36, 27 "percentage": 10.5 28 } 29 ] 30 } 31}

Breakdown by Project#

curl "https://api.bootspring.dev/v1/usage/breakdown?groupBy=project" \ -H "Authorization: Bearer bs_xxx"
1{ 2 "data": { 3 "groupBy": "project", 4 "breakdown": [ 5 { 6 "id": "proj_abc123", 7 "name": "My SaaS App", 8 "apiCalls": 3200, 9 "agentInvocations": 180, 10 "percentage": 52.6 11 }, 12 { 13 "id": "proj_def456", 14 "name": "Marketing Site", 15 "apiCalls": 1800, 16 "agentInvocations": 120, 17 "percentage": 35.1 18 } 19 ] 20 } 21}

Usage Limits by Plan#

MetricFreeProTeamEnterprise
API Calls/month1,00010,00050,000Custom
Agent Invocations/month501,0005,000Custom
Skill Applications/month205002,500Custom
Context Generations/month205002,500Custom
Projects11050Unlimited

Usage Alerts#

Configure alerts when approaching limits:

POST /usage/alerts

Request Body#

{ "metric": "apiCalls", "threshold": 80, "channels": ["email", "slack"] }

Response#

1{ 2 "data": { 3 "id": "alert_xyz", 4 "metric": "apiCalls", 5 "threshold": 80, 6 "channels": ["email", "slack"], 7 "enabled": true 8 } 9}

Export Usage Data#

GET /usage/export

Query Parameters#

ParameterTypeDescription
formatstringcsv or json (default: json)
startstringStart date
endstringEnd date

Example Request#

curl "https://api.bootspring.dev/v1/usage/export?format=csv&start=2024-01-01&end=2024-01-31" \ -H "Authorization: Bearer bs_xxx" \ -o usage-january.csv

Quota Reset#

Quotas reset on the 1st of each month at 00:00 UTC.

Check when quota resets:

{ "quotaResetAt": "2024-02-01T00:00:00Z" }

Overage Handling#

When you exceed your plan's limits:

PlanBehavior
FreeRequests blocked until reset
ProCharged per-request overage fee
TeamCharged per-request overage fee
EnterpriseCustom agreement

Overage Response#

1{ 2 "error": { 3 "code": "quota_exceeded", 4 "message": "Monthly API call limit exceeded", 5 "details": { 6 "metric": "apiCalls", 7 "used": 10001, 8 "limit": 10000, 9 "resetAt": "2024-02-01T00:00:00Z" 10 } 11 } 12}