Referência da API
Prezo's public API gives read-only access, over HTTPS and in JSON, to your business's data: purchases, catalogue, recipes and sales. Every request is authenticated with your business's API token.
Autenticação
Every request carries your business's API token in the Authorization header (Bearer). The token belongs to a restaurant or to a group, not to a person: a restaurant token sees that location, and a group token the group's locations whose plan includes the API. The business administrator creates it in Administration > API if its plan includes the API, and it is shown only when created; if you lose it, revoke it and create another. What each endpoint can read depends on the modules your business has. Without a token, or with a revoked or expired one, the API answers 401; if the plan does not include the API, Prezo has cut off the access or the module for that data is not active, 403.
Authorization: Bearer pz_live_your_token
Accept: application/jsonLimites e quota
Limits come with the plan: each restaurant has a monthly request quota shared by all its tokens, and each token its own requests per minute; a group token has its own. The quota resets on the 1st, and you can have up to 5 active tokens per restaurant and per group. Every response tells you what is left in its headers; if you go over, you get a 429 with Retry-After and X-RateLimit-Window, which says whether the per-minute or the monthly limit tripped. Listings are paginated (page and perPage, up to 500) and the ones by date accept at most 12 months per request. Amounts arrive as decimal strings ("123.45") so no cents are lost. Within v1 only fields are added: ignore the ones you do not know.
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 29
X-RateLimit-Reset: 1791367260
X-Monthly-Quota-Limit: 10000
X-Monthly-Quota-Remaining: 8732
X-Monthly-Quota-Reset: 1793487600Business
2 endpointsThe business's restaurants and providers, with their fiscal data: the ids the filters use.
Catalogue
3 endpointsThe business's catalogue: families, master products and provider products with their prices per restaurant.
Purchases
5 endpointsProvider orders, delivery notes with their totals and taxes, their lines and what was bought by product.
Recipes
2 endpointsRecipes with their cost per restaurant, sale price, food cost and the POS codes they are sold under.
Sales
2 endpointsSales by restaurant and day, and what was sold item by item with its theoretical cost.
Erros
Errors follow the RFC 9457 standard (Problem Details): they arrive with content-type application/problem+json and a code field from a closed vocabulary. Always program against code, never against the title and detail texts, which come in the language you ask for in the Accept-Language header (Spanish by default). Every error also carries a requestId, also sent in the X-Request-Id header: it is what we need to trace a specific request.
{
"type": "https://errors.prezo.es/validation_failed",
"title": "Os dados enviados não são válidos",
"status": 422,
"code": "validation_failed",
"detail": "Verifique os campos que errors detalha.",
"instance": "/public/v1/delivery-notes",
"requestId": "01K2M7QW8YB3F4ZC5X6N7P8Q9R",
"errors": [
{
"field": "dateFrom",
"code": "in",
"message": "O valor selecionado não é válido."
}
]
}