https://api.ephone.ai and every request carries Authorization: Bearer sk-admin-....
Apart from the two export endpoints, responses use the {"success": bool, "message": string, "data": ...} envelope.
Account
Get account profile
GET /api/user/self · scope account:read
Returns the full account profile. balance is the current balance.
Call logs
Timestamps can be seconds or milliseconds. The endpoints in this group detect the unit of
start_timestamp and end_timestamp automatically: values below 100000000000 are Unix seconds,
anything larger is milliseconds. Both ends are inclusive and filter on the request’s creation time.
Timestamps in responses are always milliseconds.List log details
GET /api/log/self · scope logs:read
Returns a page of call log details, newest first. Same data as the export endpoint below, in JSON.
Count log entries
GET /api/log/self/count · scope logs:read
Counts the log entries that match your filters — in other words, the number of requests over a period.
It takes the same filters as the log list and may count for up to ten seconds, so it finishes in cases
where the three-second count inside the list gives up.
total of -1 means the count did not finish within ten seconds. Split the range into pieces that do
not overlap (both ends are inclusive, so adjacent pieces must not share an instant), count each and add
them up. For a table of counts per key or per hour, the requests column of “Export usage analytics”
below is easier.
Call statistics
GET /api/log/self/stat · scope logs:read
Returns the amount spent over a time range, plus throughput over the last 60 seconds.
Export log details
GET /api/log/self/stream-export · scope logs:read
Streams log details.
created_at, model_name, token_name, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens and quota. Column order is fixed and does not follow the order in columns, so read columns by header. If you use caching, reasoning or multimodal models, export the detailed columns explicitly — the aggregate counts alone will not reconcile against what you were charged.
Usage analytics
Export usage analytics
GET /api/data/self/pivot/stream-export · scope usage:read
Aggregates usage by dimension and streams it as CSV, same as above. Each row is one group, with columns including requests (request count), errors (failed requests), spend (amount), token counts by type and avg_latency_ms, up to 5000 rows.
With
group_by=token the key column is the key ID; with group_by=time rows are hourly and key is the hour’s start in Unix seconds.
This endpoint takes milliseconds only. The log endpoints accept either unit, but this one does not: seconds are read as a date in 1970 and the file comes back with only a header.Data is aggregated by the hour, so both bounds work on whole hours: the hour containing the start is included, and if the end falls exactly on the hour, that hour is excluded.
When exporting in pieces, start each piece where the previous one ended — they will meet without overlapping. A single query spans at most about six months (186 days).Aggregation runs on a schedule, so the most recent requests may not be included yet; use the log endpoints for up-to-the-minute numbers.
API key management
List keys
GET /api/token/ · scope keys:read
Returns a page of API keys. Key values are masked; plaintext is not retrievable through any endpoint.
expired_time of -1 means the key never expires. used_quota is the total amount the key has spent.
Get one key
GET /api/token/{id} · scope keys:read
Returns the full configuration of one key, with the value masked. Fetch it before updating a key — see “Update a key” below.
Create a key
POST /api/token/ · scope keys:write
Creates a new API key. The plaintext appears only in this response.
Update a key
PUT /api/token/ · scope keys:write
Updates an existing key. The body must include id.
key and key_mask are masked; send them back unchanged — the key itself is not affected.
Regenerate a key
POST /api/token/{id}/rotate · scope keys:write
Replaces a key’s value. The old value stops working immediately. Name, quota, group, model limits, IP allowlist and all other settings are kept, and the id does not change. The new value appears only in this response.
Use it for scheduled rotation or when you suspect a key has leaked. Make sure everything using the key can switch right away: requests still sending the old value get 401.
Delete a key
DELETE /api/token/{id} · scope keys:write
Deletes the key immediately.
Bulk deletion is not available to Admin Keys. Delete keys one at a time, or use the console.