How much quota this key has used
const url = 'https://api.scanfood.co/ext/v1/usage';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.scanfood.co/ext/v1/usage \ --header 'Authorization: Bearer <token>'Returns this key’s own usage: the daily ceilings it runs under, how many requests it has already spent today, how many are left, and the last seven Thailand-time days.
Use it to watch your own consumption without having to read X-RateLimit-Remaining off
every response. It reads the same counters the quota meter itself decides on, so the numbers
cannot drift apart from what actually gets enforced.
today.count includes this request: the meter counts a request before the endpoint runs.
So today.remaining matches the X-RateLimit-Remaining header on this very response.
This call spends one request of the daily quota, like any other.
Scope is fixed to the key you authenticate with — there is no parameter, and no way to read
another key’s numbers. Days you never called on are returned with count: 0, not omitted.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”OK
object
Quota position of the key used to make this call.
object
Identifier of the key you authenticated with (the part before the secret).
The label recorded when the key was issued. Empty string if none was set.
shop (one branch) or franchise (every branch under one franchise).
Ceilings this key runs under.
object
Requests allowed per minute for this key (burst brake).
Requests allowed per Thailand-time calendar day. Resets at 00:00 ICT.
Position on the current Thailand-time day.
object
Today in Thailand time, YYYYMMDD.
Requests already counted today, including this one.
perDay minus count, never below zero. Same number as X-RateLimit-Remaining.
The last seven Thailand-time days, oldest first, today last.
Requests spent on one Thailand-time calendar day.
object
Calendar day in Thailand time, YYYYMMDD (no dashes).
Requests counted on that day for this key. A day with no calls is 0.
Server clock when the response was produced (UTC, ISO-8601).
Example
{ "ok": true, "data": { "keyId": "k7v2mq1x", "label": "ERP ของร้านพาสต้า", "scope": "shop", "rate": { "perMin": 60, "perDay": 10000 }, "today": { "date": "20260910", "count": 127, "remaining": 9873 }, "days": [ { "date": "20260904", "count": 96 }, { "date": "20260905", "count": 101 }, { "date": "20260906", "count": 0 }, { "date": "20260907", "count": 88 }, { "date": "20260908", "count": 143 }, { "date": "20260909", "count": 132 }, { "date": "20260910", "count": 127 } ] }, "serverTime": "2026-09-10T06:45:12.310Z"}Headers
Section titled “Headers”Daily quota for this key — requests allowed per Thailand-time calendar day.
This is not the per-minute burst limit; hitting that limit returns rate_limited
with a Retry-After header, and is not reflected in these two headers.
Not sent on every response. The pair is added by the daily meter, which runs after the
key check and after the per-minute brake, so 401, 503, and 429 rate_limited carry
neither header. Everything that reaches the meter — including 429 quota_exceeded and
4xx/5xx raised by the handler itself — carries both.
Requests left in the current Thailand-time day for this key, after this request.
Sent under the same conditions as X-RateLimit-Limit.
Missing or unusable key. error is invalid_key (absent, malformed, or wrong secret — the
API does not reveal whether the key id exists) or key_revoked (the key was revoked).
object
Stable machine-readable code. Branch on this, not on message.
Human-readable explanation. May change without notice.
Present on rate_limited. Seconds to wait before retrying.
Present on rate_limited. The per-minute ceiling that was hit for this key.
Present on rate_limited. Length of the window limit was measured over, in seconds.
Example
{ "ok": false, "error": "invalid_key", "message": "Invalid API key"}rate_limited — too many requests per minute for this key. The body carries retryAfterSec,
limit (the per-minute ceiling that was hit) and windowSec (the window it was measured
over), and the response also has a Retry-After header. X-RateLimit-* are not sent on
this one, because the per-minute brake sits in front of the daily meter.
quota_exceeded — the daily quota for this key is used up; it resets at 00:00 Thailand time
(ICT). This one does carry X-RateLimit-*.
object
Stable machine-readable code. Branch on this, not on message.
Human-readable explanation. May change without notice.
Present on rate_limited. Seconds to wait before retrying.
Present on rate_limited. The per-minute ceiling that was hit for this key.
Present on rate_limited. Length of the window limit was measured over, in seconds.
Example
{ "ok": false, "error": "quota_exceeded", "message": "daily quota exceeded (10000 requests/day, Thailand time). Resets at 00:00 ICT."}Headers
Section titled “Headers”Seconds to wait before trying again. Sent on 429 rate_limited (the per-minute brake).
Not sent on 429 quota_exceeded, where the wait is until the next Thailand-time day.
internal — temporary failure on our side. Retry with backoff.
object
Stable machine-readable code. Branch on this, not on message.
Human-readable explanation. May change without notice.
Present on rate_limited. Seconds to wait before retrying.
Present on rate_limited. The per-minute ceiling that was hit for this key.
Present on rate_limited. Length of the window limit was measured over, in seconds.
Example
{ "ok": false, "error": "internal", "message": "temporary failure, please retry"}auth_unavailable — the store we check keys against could not be read, so the request was
refused instead of being let through. Your key is fine; this is our side. Retry with backoff.
X-RateLimit-* are not sent on this response.
object
Stable machine-readable code. Branch on this, not on message.
Human-readable explanation. May change without notice.
Present on rate_limited. Seconds to wait before retrying.
Present on rate_limited. The per-minute ceiling that was hit for this key.
Present on rate_limited. Length of the window limit was measured over, in seconds.
Example
{ "ok": false, "error": "auth_unavailable", "message": "Authentication service temporarily unavailable, retry later"}