Skip to content

How much quota this key has used

GET
/v1/usage
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.

OK

Media typeapplication/json
object
ok
required
boolean
data
required

Quota position of the key used to make this call.

object
keyId
required

Identifier of the key you authenticated with (the part before the secret).

string
label
required

The label recorded when the key was issued. Empty string if none was set.

string
scope
required

shop (one branch) or franchise (every branch under one franchise).

string | null
rate
required

Ceilings this key runs under.

object
perMin
required

Requests allowed per minute for this key (burst brake).

integer
perDay
required

Requests allowed per Thailand-time calendar day. Resets at 00:00 ICT.

integer
today
required

Position on the current Thailand-time day.

object
date
required

Today in Thailand time, YYYYMMDD.

string
count
required

Requests already counted today, including this one.

integer
remaining
required

perDay minus count, never below zero. Same number as X-RateLimit-Remaining.

integer
days
required

The last seven Thailand-time days, oldest first, today last.

Array<object>

Requests spent on one Thailand-time calendar day.

object
date
required

Calendar day in Thailand time, YYYYMMDD (no dashes).

string
count
required

Requests counted on that day for this key. A day with no calls is 0.

integer
serverTime
required

Server clock when the response was produced (UTC, ISO-8601).

string format: date-time
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"
}
X-RateLimit-Limit
integer

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.

X-RateLimit-Remaining
integer

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).

Media typeapplication/json
object
ok
required
boolean
error
required

Stable machine-readable code. Branch on this, not on message.

string
message

Human-readable explanation. May change without notice.

string
retryAfterSec

Present on rate_limited. Seconds to wait before retrying.

integer
limit

Present on rate_limited. The per-minute ceiling that was hit for this key.

integer
windowSec

Present on rate_limited. Length of the window limit was measured over, in seconds.

integer
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-*.

Media typeapplication/json
object
ok
required
boolean
error
required

Stable machine-readable code. Branch on this, not on message.

string
message

Human-readable explanation. May change without notice.

string
retryAfterSec

Present on rate_limited. Seconds to wait before retrying.

integer
limit

Present on rate_limited. The per-minute ceiling that was hit for this key.

integer
windowSec

Present on rate_limited. Length of the window limit was measured over, in seconds.

integer
Example
{
"ok": false,
"error": "quota_exceeded",
"message": "daily quota exceeded (10000 requests/day, Thailand time). Resets at 00:00 ICT."
}
Retry-After
integer

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.

Media typeapplication/json
object
ok
required
boolean
error
required

Stable machine-readable code. Branch on this, not on message.

string
message

Human-readable explanation. May change without notice.

string
retryAfterSec

Present on rate_limited. Seconds to wait before retrying.

integer
limit

Present on rate_limited. The per-minute ceiling that was hit for this key.

integer
windowSec

Present on rate_limited. Length of the window limit was measured over, in seconds.

integer
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.

Media typeapplication/json
object
ok
required
boolean
error
required

Stable machine-readable code. Branch on this, not on message.

string
message

Human-readable explanation. May change without notice.

string
retryAfterSec

Present on rate_limited. Seconds to wait before retrying.

integer
limit

Present on rate_limited. The per-minute ceiling that was hit for this key.

integer
windowSec

Present on rate_limited. Length of the window limit was measured over, in seconds.

integer
Example
{
"ok": false,
"error": "auth_unavailable",
"message": "Authentication service temporarily unavailable, retry later"
}