Read usage history
AI, email and scraping usage. One USD is 1,000,000 integer microcredits. Only customer charges and neutral labels are returned. Maximum date range is 366 days. Follow every cursor for complete history.
GET
/billing/usageAuthorization
AuthorizationBearer token · headerrequired`MEDIAN_KEY` from Settings under API, or an MCP OAuth access token. A key acts as the organization; a token acts as the person who approved it.
Query parameters
fromnumberInclusive Unix timestamp in milliseconds; defaults to 30 days before the end.
tonumberInclusive Unix timestamp in milliseconds; defaults to now.
limitintegerRecords per page.
min 1 · max 100 · default: 100
cursorstringContinuation cursor. An empty filtered page may still have a continuation.
Responses
200Local organization records.
pageobject[]requiredisDonebooleanrequiredcontinueCursorstringrequired401Invalid or missing credentials.
403The authenticated role cannot read these records.
429Shared organization API allowance or temporary fair-use protection reached. Retry-After states the delay.
Request
curl -X GET "https://api.median.sh/v1/billing/usage" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://api.median.sh/v1/billing/usage", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_TOKEN"
}
});Response
{
"page": [
{}
],
"isDone": true,
"continueCursor": "string"
}Invalid or missing credentials.
The authenticated role cannot read these records.
Shared organization API allowance or temporary fair-use protection reached. Retry-After states the delay.