Get credit usage for a tenant within a specified date range.
This endpoint retrieves credit usage information for a tenant within a specified date range. It supports optional filtering by workflow ID, workflow run ID, and custom key-value pairs.
start_date: Start date for the calculation period (required)end_date: End date for the calculation period (required)workflow_id: Optional workflow ID for filtering resultsworkflow_run_id: Optional workflow run ID for filtering resultscustom_key: Optional custom key for filtering resultscustom_value: Optional custom value for filtering results
success: Boolean indicating request successtenant_id: The tenant IDstart_date: Echo of the start dateend_date: Echo of the end datecredits_used: Total credits used in the specified period
This endpoint requires authentication via Bearer token. The tenant ID is automatically extracted from the authenticated user's token.
GET /v1/credits/usage?start_date=2024-01-01T00:00:00Z&end_date=2024-12-31T23:59:59Z&workflow_id=workflow-123{
"success": true,
"tenant_id": 123,
"start_date": "2024-01-01T00:00:00Z",
"end_date": "2024-12-31T23:59:59Z",
"credits_used": 1250.5
}Security
BearerAuth
- Lantern API serverhttps://api-gateway.agenthq.withlantern.com/v1/credits/usage
- Local API serverhttp://localhost:8000/v1/credits/usage
curl -i -X GET \
'https://api-gateway.agenthq.withlantern.com/v1/credits/usage?start_date=2019-08-24T14%3A15%3A22Z&end_date=2019-08-24T14%3A15%3A22Z&workflow_id=string&workflow_run_id=string&custom_key=string&custom_value=string' \
-H 'Authorization: Bearer <YOUR_ApiToken_HERE>'Success Response
Response
{ "success": true, "tenant_id": 123, "start_date": "2024-01-01T00:00:00Z", "end_date": "2024-12-31T23:59:59Z", "credits_used": 1250.5 }