Export API key usage data
Usage Export API
Export API Key Usage
API endpoint to export usage and cost by API key
POST
Export API key usage data
This endpoint exports API usage grouped by API key for the selected period.
For details on prerequisites and rate limits, please refer to the main Usage Export API documentation.
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.
Data Included
By default, the API key export returns one row per API key.| Column | Description |
|---|---|
period_start | Start date of the report |
period_end | End date of the report |
org_id | ID of the workspace |
api_key_id | ID of the API key |
api_key_name | Name of the API key |
requests | Number of API requests |
total_cost_usd | API usage cost in USD |
Additional Columns for BYOK Workspaces
| Column | Description |
|---|---|
sum_prompt_tokens | Total input tokens |
sum_completion_tokens | Total output tokens |
cached_prompt_tokens | Cache-read input tokens |
cache_creation_tokens | Cache-write input tokens |
no_cache_tokens | Input tokens that were not served from cache |
Grouped Export
Usegroup_by=model to return one row per API key and model.Authorizations
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
application/json