Skip to content

Get Account Logs

GET /api/open/v1/logs
ParameterInTypeRequiredDefaultDescription
start_timestampqueryintegerNoSee belowStart time (inclusive), unix seconds
end_timestampqueryintegerNoSee belowEnd time (inclusive), unix seconds
model_namequerystringNo—Exact model name; repeat the parameter for multiple values (?model_name=a&model_name=b) or separate values with commas
key_namequerystringNo—Exact Key name; repeat the parameter for multiple values. Commas are not supported because names may contain commas
key_idqueryintegerNo—Key ID, a positive integer; repeat the parameter or separate values with commas. IDs that belong to other users return no rows
typequeryintegerNo2Log type: 2 for consumption (billed) requests, 7 for final failed requests (not billed). Repeat the parameter or separate values with commas (?type=2,7); other values return 400
pqueryintegerNo1Page number, from 1 to 1000000
page_sizequeryintegerNo10Items per page, from 1 to 1000

Time range rules:

  • Both omitted: the last 30 days.
  • Only start_timestamp: 30 days forward, capped at the current time.
  • Only end_timestamp: 30 days backward.
  • The range can be at most 366 days.

Each multi-value parameter accepts at most 50 values; more returns 400 invalid_request. Explicitly supplied invalid p / page_size return 400; see Pagination. Timestamps must be non-negative integers, otherwise 400.

Terminal window
curl "https://www.routeapi.ai/api/open/v1/logs?start_timestamp=1726408000&end_timestamp=1729000000&key_name=bot&model_name=gpt-4o&p=1&page_size=20" \
-H "Authorization: Bearer $ROUTEAPI_MANAGEMENT_KEY"
{
"success": true,
"message": "",
"data": {
"items": [
{
"id": 12345,
"created_at": 1729000000,
"type": 2,
"key_id": 12,
"key_name": "bot",
"key": "sk-abcd**********wxyz",
"model_name": "gpt-4o",
"prompt_tokens": 1200,
"completion_tokens": 300,
"total_tokens": 1500,
"amount": 0.05,
"use_time": 3,
"is_stream": true,
"first_response_ms": 420,
"cache_read_tokens": 800,
"cache_creation_tokens": 0,
"reasoning_effort": "medium",
"request_path": "/v1/chat/completions",
"web_search_calls": 0,
"audio_input_tokens": 0,
"audio_output_tokens": 0,
"billing_source": "wallet",
"request_id": "20261020120000123456789"
}
],
"total": 1,
"page": 1,
"page_size": 20,
"start_timestamp": 1726408000,
"end_timestamp": 1729000000
}
}
FieldTypeDescription
items[].idintegerLog ID
items[].created_atintegerLog time, unix seconds
items[].typeinteger2 consumption, 7 final request failure
items[].key_idintegerID of the Key that made the request
items[].key_namestringName of the Key at the time of the request
items[].keystringMasked Key value in the same format as List API Keys, for example sk-abcd**********wxyz; empty string if the Key has been permanently deleted
items[].model_namestringModel name
items[].prompt_tokensintegerInput tokens
items[].completion_tokensintegerOutput tokens
items[].total_tokensintegerInput plus output tokens
items[].amountnumberAmount consumed in the site currency, two decimals; may be 0.00 for very small amounts
items[].use_timeintegerRequest duration, seconds
items[].is_streambooleanWhether the request was streamed
items[].first_response_msintegerTime to first response, milliseconds; 0 if unknown (for example non-streamed requests)
items[].cache_read_tokensintegerPrompt cache hit tokens
items[].cache_creation_tokensintegerPrompt cache write tokens
items[].reasoning_effortstringReasoning effort such as low, medium, or high; empty string if not set
items[].request_pathstringRequest path, for example /v1/chat/completions
items[].web_search_callsintegerNumber of web search calls made during the request
items[].audio_input_tokensintegerAudio input tokens
items[].audio_output_tokensintegerAudio output tokens
items[].billing_sourcestringwallet for wallet balance, subscription for a subscription plan, empty string if unknown
items[].request_idstringRequest ID, useful for troubleshooting
totalintegerNumber of matching logs, counted up to 10000
pageintegerCurrent page number
page_sizeintegerEffective items per page
start_timestampintegerEffective start time
end_timestampintegerEffective end time
HTTPcodeScenario
400invalid_requestA timestamp is not numeric or is negative, the range exceeds 366 days, start_timestamp is greater than end_timestamp, the pagination parameters are invalid, a multi-value parameter has more than 50 values, key_id is not a positive integer, or type is not 2 or 7
429—Per-user query rate limit exceeded (default 30/minute); the body may be empty

For other common error codes, see Platform API errors.

  • By default only consumption (billing) logs are returned. Add type=2,7 to include final failed requests (not billed) as well.
  • Results are sorted by created_at descending (newest first); records with the same timestamp are ordered by log ID descending, so paging is stable.
  • key_name is the Key’s name at the time of the request; renaming a Key does not rewrite past records.
  • key is the masked value; it is an empty string when the Key has since been permanently deleted.
  • use_time, first_response_ms, cache, search, audio, and reasoning fields are 0 or an empty string when the corresponding data was not recorded; fields are always present.
  • Token counts are raw counts, not millions.
  • Amounts use the site display currency; see Get balance.
  • This endpoint shares the per-user query rate limit (default 30/minute) with Export logs, Usage, Usage by model, and Usage by Key. See Rate limits.
  • To export all matching rows at once (CSV or JSONL), use Export logs instead of paging and concatenating this endpoint.