My account
Everything the first render needs: the user's data, their points, the commerce's branding and the points about to expire.
Everything the frontend needs on the first render: the user's data, their points
and subscription in the program of the commerce named in X-Commerce-Id, the
commerce's branding data (name, logo, color, category) and the points about to
expire.
It is the call the app starts with. There is no need to fetch the commerce's data separately: it comes inside.
Headers
X-Commerce-IdintegerheaderrequiredId of the commerce integrating the API. Every response is scoped to this commerce.
Response
A My account object.
curl https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/me \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "X-Commerce-Id: 87"// 200 OK
{
"username": "Ana Pérez",
"email": "ana@example.com",
"phone": null,
"points": 340,
"subscribed": true,
"commerce": {
"id": 87,
"name": "Tienda Central",
"logo": "https://cdn.loybox.com.ar/logos/87.png",
"color": "#f1a10d",
"category_name": "Tienda de comics",
"currency": "ARS"
},
"points_expiration": {
"points": 120,
"expiration_date": "2026-09-30T23:59:59Z",
"days_left": 37,
"months_left": 1,
"mode": "accumulated"
}
}What to do with each piece:
| Field | What for |
|---|---|
points | The big balance on the screen. It is what each benefit's cost is compared against. |
subscribed | If it comes back false, show the call to join instead of the catalog. |
commerce | Logo, name and color to paint the program's branding. |
points_expiration | The "X points expire in Y days" notice. |
When points do not expire
points_expiration does not come back null: it comes with mode: "none" and
points: 0. Check the mode before showing the expiration notice.
Errors
| Code | When |
|---|---|
401 | The access token is missing, expired, or does not belong to an end user. |
422 | The X-Commerce-Id header is missing. |