Developers

API reference

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.

Base URLhttps://api.prezo.esVersionv1AuthenticationBearer

Authentication

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.

Headers
Authorization: Bearer pz_live_your_token
Accept: application/json

Limits and 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.

Headers
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: 1793487600

Business

2 endpoints

The business's restaurants and providers, with their fiscal data: the ids the filters use.

Recipes

2 endpoints

Recipes with their cost per restaurant, sale price, food cost and the POS codes they are sold under.

Sales

2 endpoints

Sales by restaurant and day, and what was sold item by item with its theoretical cost.

Errors

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.

Possible values of code
api_key_invalidapi_key_revokedapi_key_expiredsubscription_not_activemodule_inactivevalidation_failednot_foundrate_limit_exceededmonthly_quota_exceededinternal_error
Example error response
{
  "type": "https://errors.prezo.es/validation_failed",
  "title": "The data you sent is not valid",
  "status": 422,
  "code": "validation_failed",
  "detail": "Check the fields listed in errors.",
  "instance": "/public/v1/delivery-notes",
  "requestId": "01K2M7QW8YB3F4ZC5X6N7P8Q9R",
  "errors": [
    {
      "field": "dateFrom",
      "code": "in",
      "message": "The selected value is not valid."
    }
  ]
}