Renew the token
A new access token from the refresh token, without asking the user for another code.
POST/v1/auth/refreshNo token
Returns a new access token from the refresh token obtained when verifying the code, without needing to ask the user for a new code.
It is what makes the session feel continuous: when a call to
My account returns 401, you renew and retry.
Headers
X-Commerce-IdintegerheaderrequiredId of the commerce integrating the API. Every response is scoped to this commerce.
Body
refreshstringrequiredThe refresh token returned by verifying the code.
Response
accessstringrequiredThe new access token.
expires_ininteger | nullSeconds the new token stays valid.
curl -X POST https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/auth/refresh \
-H "X-Commerce-Id: 87" \
-H "Content-Type: application/json" \
-d '{
"refresh": "eyJhbGciOiJIUzI1NiIs..."
}'// 200 OK
{
"access": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 3600
}It does not return a new refresh
The response carries only the access. The refresh you already had is still the
valid one: keep it and keep using it.
Errors
| Code | When |
|---|---|
401 | The refresh token is invalid or expired. |
422 | The X-Commerce-Id header is missing, or the refresh field is missing. |
A 401 here means the session really ended: you have to
request a code again.