Skip to content

Rotate the current token

Rate limit 120 requests/min (authenticated)

POST
/auth/refresh
curl --request POST \
--url https://app.ridebox.my/api/auth/refresh \
--header 'Authorization: Bearer <token>' \
--header 'X-API-Version: v1'

Revokes the presented token and issues a replacement in one call. Refresh once expires_at is within 7 days.

Authenticated tier: 120 requests/min per user.

X-API-Version
string
default: v1
Allowed values: v1

Selects the API version. With no version header the request is served as v1. An Accept: application/vnd.ridebox+v1+json header selects the version too; X-API-Version is read first when both are sent. An unsupported version answers 400 with supported_versions.

Example

v1

Replacement token issued; the presented token is now revoked.

Media type application/json
Token response

The response shape shared by POST /auth/login and POST /auth/refresh.

object
data
required
Issued token

A bearer token. Store it securely: it is returned once and cannot be retrieved again.

object
token
required

The token value.

string
token_type
required
string
Allowed value: Bearer
expires_at
required

UTC instant at which the token expires, 30 days after issue.

string format: date-time
user
required
User

The account the token belongs to.

object
id
required
string format: uuid
name
required
string
email
required
string format: email
timezone
required

IANA zone to render timestamps in. Timestamps themselves are always UTC.

string

Example

{
"data": {
"token": "YOUR_API_TOKEN",
"token_type": "Bearer",
"expires_at": "2026-10-12T02:14:00Z",
"user": {
"id": "YOUR_USER_UUID",
"name": "YOUR_NAME",
"email": "[email protected]",
"timezone": "Asia/Kuala_Lumpur"
}
}
}
X-API-Version
string
Allowed value: v1

The API version that served this response. Always v1 on this surface.

Example
v1
X-RateLimit-Limit
integer

Requests permitted in the current window for the applicable tier.

Example
120
X-RateLimit-Remaining
integer

Requests remaining in the current window.

Example
0

Missing, invalid, expired or revoked token. When a token was presented, code tells an expired token from a revoked one.

Media type application/json
Error envelope

The single shape used by every non-2xx response. message is always present and safe to display. errors is present only on 422. code is present on a 401 that presented a token.

object
message
required

Human-readable, safe to display to the end user.

string
errors

Present only on 422. Field name to array of messages.

object
key
additional properties
Array<string>
code
Machine-readable error code

Tells an expired token, which you can replace by signing in again, from a revoked one.

string
Allowed values: token_expired token_revoked

Examples

No token presented

{
"message": "Unauthenticated."
}
X-API-Version
string
Allowed value: v1

The API version that served this response. Always v1 on this surface.

Example
v1

Rate limited. Back off and honour Retry-After.

Media type application/json
Error envelope

The single shape used by every non-2xx response. message is always present and safe to display. errors is present only on 422. code is present on a 401 that presented a token.

object
message
required

Human-readable, safe to display to the end user.

string
errors

Present only on 422. Field name to array of messages.

object
key
additional properties
Array<string>
code
Machine-readable error code

Tells an expired token, which you can replace by signing in again, from a revoked one.

string
Allowed values: token_expired token_revoked

Example

{
"message": "Too many requests. Please try again shortly."
}
Retry-After
required
integer
>= 1

Seconds to wait before retrying.

Example
42
X-RateLimit-Limit
integer

Requests permitted in the current window for the applicable tier.

Example
120
X-RateLimit-Remaining
integer

Requests remaining in the current window.

Example
0
X-RateLimit-Reset
integer

Unix timestamp at which the current window resets. Sent on 429.

Example
1789180500
X-API-Version
string
Allowed value: v1

The API version that served this response. Always v1 on this surface.

Example
v1