# RETM Partner API v2 > v2 (current), updated 2026-11-21. Every page of the reference in one file, followed by every schema. Index of all versions: https://api.retm.sa/llms.txt --- # Introduction > RETM Partner API v2 (current) · Getting started · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/introduction **Build on RETM** The RETM Partner API lets a marketplace app read a merchant's catalogue and sales, push orders into their point of sale, and hear about changes through webhooks. - [Read the installation guide](https://api.retm.sa/llms/v2/installation.txt) - [Create an order](https://api.retm.sa/llms/v2/orders.txt) - [Webhooks](https://api.retm.sa/llms/v2/webhooks.txt) ## From install to first call A merchant installs your app, RETM hands your server a code for that merchant, and you trade it for a token. The [installation guide](https://api.retm.sa/llms/v2/installation.txt) walks through each step with screenshots. Actors: Merchant, RETM, Your server. 1. Merchant → RETM: Installs your app 2. RETM → Your server: `POST` success endpoint: `business_id` and `code` 3. Your server → RETM (reply): `200`, optionally a `token` and a settings `url` 4. Your server → RETM: `POST /api/oAuth/token` 5. RETM → Your server (reply): `access_token`, valid 30 days 6. Your server → RETM: Calls `/api/v2/*` with the bearer token 7. RETM → Your server: Webhooks, as things happen ## What you can build - [Read the catalogue](https://api.retm.sa/llms/v2/menu.txt): Categories, products, modifiers, combos, price lists, taxes and branches, shaped for ordering. - [Push orders](https://api.retm.sa/llms/v2/orders.txt): Send an order to a branch. The merchant accepts it and you follow its status. - [Read invoices](https://api.retm.sa/llms/v2/invoices.txt): Page through the sales invoices a merchant has issued, newest first. - [Receive webhooks](https://api.retm.sa/llms/v2/webhooks.txt): Invoices, order status changes and menu edits are POSTed to your server. ## Explore the API **Catalogue** - [Menu](https://api.retm.sa/llms/v2/menu.txt) (1 endpoints): The whole orderable catalogue in one call: every category with its products, their modifiers, variations, taxes and combos. - [Categories](https://api.retm.sa/llms/v2/categories.txt) (2 endpoints): The top-level sections of the catalogue. - [Groups](https://api.retm.sa/llms/v2/groups.txt) (2 endpoints): Groups are alternative product collections a merchant builds for a device or a channel. A group can override a product's price and status. - [Products](https://api.retm.sa/llms/v2/products.txt) (3 endpoints): The things a merchant sells. A product is one of four types, and the type decides how you order it. - [Price lists](https://api.retm.sa/llms/v2/price-lists.txt) (2 endpoints): A price list is an alternative set of prices, for example for a delivery channel. Catalogue reads take a price_list_id, but in v2 that is the list's internal numeric id, not the id returned here. **Store setup** - [Branches](https://api.retm.sa/llms/v2/branches.txt) (2 endpoints): A merchant's locations. An order is always pushed to one branch. - [Devices](https://api.retm.sa/llms/v2/devices.txt) (2 endpoints): The point-of-sale devices registered at the merchant's branches. - [Order types](https://api.retm.sa/llms/v2/order-types.txt) (3 endpoints): How an order is fulfilled: dine-in, takeaway, delivery, or a type your app creates for itself. - [Payment methods](https://api.retm.sa/llms/v2/payment-methods.txt) (3 endpoints): The ways a merchant takes money. Reference one in an order's payments to record how the order was paid. - [Taxes](https://api.retm.sa/llms/v2/taxes.txt) (3 endpoints): The taxes a merchant applies. A product lists its own taxes; send their identifiers and amounts on each order line. - [Charges](https://api.retm.sa/llms/v2/charges.txt) (3 endpoints): Order-level fees such as delivery or service. An order carries at most one charge. **Sales** - [Orders](https://api.retm.sa/llms/v2/orders.txt) (4 endpoints): Push an order into a merchant's branch, follow it as the merchant handles it, and read it back. - [Invoices](https://api.retm.sa/llms/v2/invoices.txt) (1 endpoints): The sales invoices a merchant has issued, from every channel, newest first. - [Customers](https://api.retm.sa/llms/v2/customers.txt) (2 endpoints): The merchant's customers. Customers are created for you when you push an order with a new phone number. **Webhooks** - [Webhook events](https://api.retm.sa/llms/v2/webhook-events.txt) (4 events): The body of each webhook module. Every body also carries business_refrence and timestamp. ## How it fits together Every merchant has its own subdomain and its own data, so every request goes to that merchant's host. Your app is registered once in the RETM developer portal, then **installed** by each merchant who wants it. Installing gives you a `code` for that merchant, which you exchange for an access token. | Term | Meaning | | --- | --- | | Merchant | One merchant account, identified by its `business_id`. That id is also the subdomain of the merchant's host: `acme` in `https://acme.retm.sa`. | | App | Your integration, registered in the developer portal. It has a `client_id`, a `client_secret`, the permissions it asks for and the webhook modules it listens to. | | Installation | One merchant connecting your app. It gives you a `code` and a `business_id` that together identify that merchant. | | Permission | An ability granted to your app, such as `read products` or `create order`. Each endpoint names the one it needs. | ## Base URLs All endpoints of this version live under `/api/v2` on the merchant's host. Replace `{business_id}` with the value your success endpoint receives at installation. Staging and its availability are covered in [Environments](https://api.retm.sa/llms/v2/environments.txt). - Production: `https://{business_id}.retm.sa/api/v2` - Staging: `https://stg.retm.sa/api/v2`. One shared test merchant. Its `business_id` is `stg`. ## Latest changes - **2026-11-21 · breaking:** Disabled group products and child groups report `0`. In [Get a group](https://api.retm.sa/llms/v2/groups.txt), a product the group disables now has `status: 0`, and a child group the parent disables has `status: 0`. Both used to report as enabled (the product's own status, or `true`). Enabled ones are unchanged. - **2026-11-20 · changed:** You can only cancel your own orders. [Cancel an order](https://api.retm.sa/llms/v2/orders.txt) now answers `404` for an order your app did not create, instead of cancelling it. Cancelling your own orders is unchanged. - **2026-11-18 · breaking:** Combos are ordered and sold as their items. A combo is no longer one priced line. Each option now has its own price in the combo (`original_price`, `discount_applied`, `price`) and its own `taxes`; a group's `is_optional` is a boolean; `upcharge` is gone. On [Create an order](https://api.retm.sa/llms/v2/orders.txt), send one ordinary line per picked product tagged `combo: {id, group, key}` instead of a combo line with `components`; a line whose `id` is a combo is refused. Order lines are read back with a `combo` object instead of `components`, and invoices list the picked items as ordinary lines. > **Note:** This reference describes what the API does today. When a contract changes, the change is listed in the [changelog](https://api.retm.sa/llms/v2/changelog.txt) with its date, and breaking changes are marked. Index of every page: https://api.retm.sa/llms.txt --- # Environments > RETM Partner API v2 (current) · Getting started · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/environments RETM runs two environments. Build and test against staging, then go live on production once your integration is approved. | Environment | Purpose | Host | Availability | | --- | --- | --- | --- | | **Staging** | Integration testing in a production-like setting. Fully functional, with the same versioned API as production. | `https://stg.retm.sa` | 9 AM to 6 PM Saudi Arabia time (UTC+3). Maintenance may happen outside those hours. | | **Production** | Live transactions and real data for active merchants. | `https://{business_id}.retm.sa` | Always on. Requires integration approval. | ## Base URLs All endpoints of this version live under `/api/v2`. Use the switch in the top bar to change the environment every example on this site uses, and type a business id next to it to fill in `{business_id}`. - Production: `https://{business_id}.retm.sa/api/v2` - Staging: `https://stg.retm.sa/api/v2`. One shared test merchant. Its `business_id` is `stg`. ## Staging Staging is one shared test merchant. Its `business_id` is `stg`, so every staging call, including the token exchange, goes to `https://stg.retm.sa`. ## Test your app in staging Use the **Install & test** flow to open staging with only your own apps visible in the marketplace, so you can try installation and webhooks without touching production. 1. **Sign in to the developer portal**: Use your RETM developer account. Your app must already exist. 2. **Open your app**: From your apps list, choose the app you want to test to open its **App Details** page. 3. **Go to Webhooks**: Inside App Details, open the **Webhooks** section. 4. **Click Install & test**: You are taken to staging, where the marketplace lists only the apps owned by your developer account. ## Production In production every merchant has its own host. You never guess it: the `business_id` you receive when a merchant installs your app is the subdomain to call, as in `https://{business_id}.retm.sa`. - Production access requires **integration approval**: your app must be approved and published before merchants can install it. - A token belongs to one merchant. Use each merchant's own host with that merchant's token. ## Maintenance The RETM technical team announces scheduled maintenance windows that may affect availability ahead of time. Index of every page: https://api.retm.sa/llms.txt --- # Installation guide > RETM Partner API v2 (current) · Getting started · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/installation How a merchant connects your app, end to end: from the Install button in the RETM marketplace to your first authenticated call. Actors: Merchant, RETM, Your app. 1. Merchant → RETM: Clicks **Install** on your listing 2. RETM → Your app: Opens your Install URL (optional) 3. Your app → RETM: Redirects to the authorization page 4. Merchant → RETM: Reviews the permissions and approves 5. RETM → Your app: `POST` success endpoint: `code`, `business_id`, `data` 6. Your app → RETM (reply): `200`, optionally a `token` and a settings `url` 7. Your app → RETM: `POST /api/oAuth/token` 8. RETM → Your app (reply): `access_token`, valid 30 days ## What you configure Everything below is configured on your app in the RETM developer portal. | Setting | What it is | | --- | --- | | Client ID and secret | Your app's credentials. The secret is 32 characters and can be regenerated. Keep it on your server. | | Install URL | Optional, recommended. A page on your side where the merchant signs in to your platform before authorizing. | | Success endpoint | Your HTTPS endpoint that receives the `code` after the merchant approves. It must accept `POST`. | | Permissions | What your app may read and write. The merchant sees them on the consent screen. | | Notification URLs | One HTTPS URL per webhook module you listen to. See [Webhooks](https://api.retm.sa/llms/v2/webhooks.txt). | ## URLs by environment | Step | Production | Staging | | --- | --- | --- | | Authorization page | `https://retm.sa/integrations/authorized?client_id={client_id}` | `https://stg.retm.sa/integrations/authorized?client_id={client_id}` | | Token exchange | `https://{business_id}.retm.sa/api/oAuth/token` | `https://stg.retm.sa/api/oAuth/token` | | API calls | `https://{business_id}.retm.sa/api/v2` | `https://stg.retm.sa/api/v2` | ## Step by step #### 1. The merchant clicks Install In the RETM marketplace, the merchant opens your app listing and clicks **Install**. That starts the flow. ![An app listing in the RETM marketplace with the Install button highlighted](https://api.retm.sa/assets/guide/install-button.png) *The Install button on an app listing in the merchant's dashboard.* #### 2. Your Install URL (optional, recommended) If you want to verify the merchant on your side first, configure an Install URL. RETM sends the merchant there, you show a sign-in or verification screen, and then you send them on to the RETM authorization page. - Redirect the merchant to your platform. - Authenticate the merchant there. - Redirect them to the authorization page, attaching any parameters you need to recognise them in the next steps. ![A partner's own sign-in page shown to the merchant before authorization](https://api.retm.sa/assets/guide/partner-login.png) *Example of a partner's sign-in page, shown before the merchant authorizes the app.* #### 3. Redirect to the authorization page Send the merchant to the authorization page with your `client_id`. You may append your own parameters; RETM hands them back to you untouched in step 5. **Authorization page, with your own parameters** ```text https://retm.sa/integrations/authorized?client_id={client_id}&account_id=12345&status=1 ``` #### 4. The merchant grants access The merchant reviews what your app asks for and approves. If they decline, the flow stops and nothing is sent to you. ![The RETM consent dialog asking the merchant to allow the app to access their account](https://api.retm.sa/assets/guide/consent.png) *The consent dialog. Approving it triggers the call to your success endpoint.* #### 5. RETM calls your success endpoint After approval, RETM sends a `POST` to your success endpoint. **POST {your success endpoint}** ```json { "business_id": "acme", "code": "pQ7dX2mLk9RtYv4HsB1nZc8WfA", "data": { "account_id": "12345", "status": "1" } } ``` - `business_id` (string): The merchant's business id. Use it as the subdomain for every later call: `https://{business_id}.retm.sa`. - `code` (string): 26 characters. The authorization code for this merchant. It stays valid while the app is installed, so keep it to request new tokens. - `data` (object | null): The parameters you appended in step 3, returned as-is. > **Heads up:** `data` is passed through untouched and can be altered in the browser. Do not treat it as trusted: validate it against the merchant on your side. #### 6. Answer with 200 Your success endpoint **must** answer `200`, and quickly: do slow work after responding. If the call fails, RETM tries once more a second later; any other outcome cancels the installation. The body is optional JSON. **200 response from your success endpoint** ```json { "token": "a-secret-you-generate-for-this-merchant", "url": "https://partner.example.com/retm/settings" } ``` - `token` (string): Optional. A secret of your choosing for this merchant. RETM sends it back, encrypted, as the bearer token on every webhook, so you can tell the call is genuine. See [Verifying a webhook](https://api.retm.sa/llms/v2/webhooks.txt). - `url` (string): Optional. A settings page on your side. The merchant can open it from their dashboard, and RETM appends the encrypted token as a `token` query parameter: `https://partner.example.com/retm/settings?token=…`. Store `code` and `business_id`. Together they identify this merchant. #### 7. Exchange the code for a token Call [`POST /api/oAuth/token`](https://api.retm.sa/llms/v2/authentication.txt) on the merchant's host with the `code`, your `client_id` and your `client_secret`. #### 8. Call the API Send the token as `Authorization: Bearer ` on every request to `https://{business_id}.retm.sa/api/v2`. The token lasts 30 days. When it expires and a call answers `401`, [repeat step 7](https://api.retm.sa/llms/v2/authentication.txt) with the same `code` to get a new one. ## Partner checklist - Your app's visibility in the developer portal is set correctly for production (public or private). - Your Install URL is publicly reachable over HTTPS and responds quickly. - Your success endpoint is publicly reachable over HTTPS and accepts `POST`. - Your success endpoint stores `code` and `business_id`, and any `data` values you need. - The token exchange goes to the right environment's host. - API requests use `https://{business_id}.retm.sa` in production. ## Common issues | Symptom | Usual cause | | --- | --- | | `404` on the production authorization page | The app is not public or active for production, or the authorization URL is wrong. | | The authorization page loads but your success endpoint is never called | The success endpoint is unreachable or invalid, or the merchant cancelled at the consent step. | | Staging works but the production token exchange fails | The production exchange must go to `https://{business_id}.retm.sa/api/oAuth/token`, not to `stg.retm.sa`. | | The token exchange answers `401` | The `code` is not this merchant's, or the client id and secret do not match the installed app. | > **Heads up:** If a merchant uninstalls and installs again, you receive a new `code`. The old one stops working. Index of every page: https://api.retm.sa/llms.txt --- # Authentication > RETM Partner API v2 (current) · Getting started · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/authentication Every `/api/v2` request carries a bearer token that belongs to one app installed at one merchant. Tokens are JWTs. A token is valid for **30 days**. Requesting a new token ends the previous one, so one installation has one live token at a time. When it expires, [request a new one the same way](https://api.retm.sa/llms/v2/authentication.txt). **Authenticated request** ```http GET /api/v2/branches/list HTTP/1.1 Host: acme.retm.sa Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOi... Accept: application/json ``` ## When a token expires A token lasts 30 days. There is no refresh token and no separate renewal call: **you get a new token exactly the way you got the first one.** Send the same `code`, `client_id` and `client_secret` to [`POST /api/oAuth/token`](https://api.retm.sa/llms/v2/authentication.txt) on the merchant's host. Actors: Your server, RETM. 1. Your server → RETM: Any `/api/v2` call with the old token 2. RETM → Your server (reply): `401`: the token has expired 3. Your server → RETM: `POST /api/oAuth/token` with the same `code`, `client_id`, `client_secret` 4. RETM → Your server (reply): A new `access_token`, valid 30 days 5. Your server → RETM: Repeat the call with the new token - **The `code` does not expire.** The one you stored at installation keeps working for as long as the merchant has your app installed. You do not need the merchant to do anything. - **A `401` is your signal.** A missing, expired or replaced token answers `401` on every endpoint. Request a new token, then repeat the call once. - **Or renew ahead of time.** `expires_in` is in minutes; you can request a new token shortly before it runs out instead of waiting for a `401`. - **The new token replaces the old one.** As soon as a new token is issued, the previous one stops working, so store the new one everywhere you use it. - **If the token request itself answers `401`,** the merchant has uninstalled your app, or installed it again and you hold the old `code`. Use the `code` from the latest installation. **Renew on 401, then retry once (JavaScript)** ```javascript async function getToken(merchant) { const response = await fetch(`https://${merchant.businessId}.retm.sa/api/oAuth/token`, { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify({ code: merchant.code, client_id: process.env.RETM_CLIENT_ID, client_secret: process.env.RETM_CLIENT_SECRET, }), }); if (!response.ok) throw new Error("The app is no longer installed for this merchant"); merchant.token = (await response.json()).access_token; return merchant.token; } async function callRetm(merchant, path, options = {}) { const send = (token) => fetch(`https://${merchant.businessId}.retm.sa${path}`, { ...options, headers: { ...options.headers, Authorization: `Bearer ${token}`, Accept: "application/json" }, }); let response = await send(merchant.token ?? (await getToken(merchant))); if (response.status === 401) { response = await send(await getToken(merchant)); } return response; } ``` ## Best practices - **Keep credentials on your server.** Never ship your client secret in a browser or a mobile app, and never store it in plain text. - **Use the right host.** Staging tokens come from `https://stg.retm.sa/api/oAuth/token`; production tokens from the merchant's own host, `https://{business_id}.retm.sa/api/oAuth/token`. - **One token per merchant.** A token only works on the host of the merchant it was issued for. - **On `401`, get a new token** with the same `code`, then repeat the call. > **Note:** The token request takes only `code`, `client_id` and `client_secret`. `grant_type` and `redirect_url`, shown in earlier versions of this reference, are not needed. There is no refresh token. ## Get an access token `POST /api/oAuth/token` Exchange an installation code and your app credentials for a bearer token. Use the same call for your first token and for every token after it. - Auth: none > **Note:** This is also how you renew. When a token expires, call this endpoint again with the same `code`: it does not expire while the app stays installed. ### Request body - `code` (string, required): The `code` your success endpoint received at installation. - `client_id` (string, required): Your app's public client id. - `client_secret` (string, required): Your app's client secret. ### Example request ```bash curl -X POST "https://{business_id}.retm.sa/api/oAuth/token" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "code": "pQ7dX2mLk9RtYv4HsB1nZc8WfA", "client_id": "your-client-id", "client_secret": "your-32-character-client-secret" }' ``` ### Response 200 - `token_type` (string): Always `bearer`. - `access_token` (string): The JWT to send in the `Authorization` header. - `expires_in` (integer): Lifetime in **minutes**: `43200` is 30 days. ```json { "token_type": "bearer", "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi...", "expires_in": 43200 } ``` ### Errors - `401`: The `code` is unknown for this merchant, or the client id and secret do not match the installed app. ```json { "message": "Unauthorized", "extra": [] } ``` - `422`: A field is missing. ```json { "message": "The code field is required.", "errors": { "code": [ "The code field is required." ] } } ``` Index of every page: https://api.retm.sa/llms.txt --- # Conventions > RETM Partner API v2 (current) · Getting started · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/conventions The rules that hold across every endpoint. ## Requests and responses - Everything is JSON. Send `Content-Type: application/json` on requests with a body. Responses are always JSON, including errors. - A successful read returns the resource directly: an object, or an array of objects. There is no `data` envelope. - Send `Accept-Language: en` or `Accept-Language: ar` to choose the language of messages. Without it you get the merchant's default language. ## Identifiers Resources are addressed by a string identifier (a UUID or ULID). It is the value to use in a path and to send back in an order. > **Heads up:** The key holding it is not uniform in v2. Catalogue resources call it `id`. Branches, devices, order types, payment methods, taxes and charges call it `uuid`. Customers return both a numeric `id` and a `uuid`; paths take the `uuid`. Each resource page shows the exact key. ## Translated text Names and descriptions come as an object with both languages, never as a single resolved string. **A translated field** ```json { "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" } } ``` ## Money and quantities - Amounts and quantities are returned as **decimal strings** with three decimals (`"20.000"`). Parse them as decimals, never as floats. - Amounts you send may be JSON numbers. - Amounts are in the merchant's currency. The API does not return a currency code. ## Dates and times Times are in the **merchant's time zone** unless a field says otherwise. The one exception is `created_at` inside the invoice webhook body, which is UTC. ## Pagination Small reference lists (branches, taxes, payment methods, …) return every row as a plain array. Larger lists are paged, 15 rows per page, with a `page` query parameter. Two page shapes exist. **Counted pages: products, orders, customers** ```json { "items": [], "pagination": { "from": 1, "to": 15, "per": 15, "total": 132, "current": 1, "path": "https://acme.retm.sa/api/v2/products/list" } } ``` **Forward-only pages: invoices** ```json { "items": [], "pagination": { "per": 15, "current_page": 1, "has_more": true, "next_page_url": "https://acme.retm.sa/api/v2/invoices/list?page=2", "prev_page_url": null } } ``` ## Rate limits | Scope | Limit | | --- | --- | | All of `/api/v2` | 1000 requests per minute | | `GET /api/v2/invoices/list` | 5 per minute | | `GET /api/v2/orders/list`, `GET /api/v2/orders/{order}` | 5 per minute | | `GET /api/v2/customers/list` | 5 per minute | Over the limit you get `429`. The heavy list endpoints are meant for sync jobs, not for polling: use [webhooks](https://api.retm.sa/llms/v2/webhooks.txt) to hear about changes. ## Permissions Each endpoint shows the permission it needs. Your app asks for permissions in the developer portal and the merchant sees them when installing. A call without the permission answers `403`. Index of every page: https://api.retm.sa/llms.txt --- # Errors > RETM Partner API v2 (current) · Getting started · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/errors Errors use standard HTTP status codes and always carry a JSON body with a `message`. | Status | Meaning | Body | | --- | --- | --- | | `401` | No token, or the token is expired, replaced or invalid. [Request a new token](https://api.retm.sa/llms/v2/authentication.txt) the same way you got the first one, then repeat the call. | `{ "message" }` | | `403` | Your app lacks the permission this endpoint needs. | `{ "message" }` | | `404` | The resource does not exist, is inactive, or belongs to another app. Also returned for an unknown merchant host. | `{ "message": "Entry Not Found" }` | | `409` | The request is valid but conflicts with the current state, for example a repeated `partner_reference`. | `{ "message", "extra" }` or `{ "success": false }` | | `422` | Validation failed, or a business rule refused the payload. | `{ "message", "errors" }` or `{ "message", "extra" }` | | `423` | The merchant's subscription has expired. Nothing can be read or written until it is renewed. | `{ "expired": true }` | | `429` | Rate limit reached. | `{ "message" }` | | `5xx` | Something failed on our side. Safe to retry reads. For order pushes, retry with the same `partner_reference`. | `{ "message" }` | ## Validation errors `errors` is keyed by the path of the failing field, with a list of messages for each. Array items are addressed by index. **422 Unprocessable Content** ```json { "message": "The Quantity field must be greater than or equal to 1.", "errors": { "products.0.quantity": [ "The Quantity field must be greater than or equal to 1." ] } } ``` ## Business refusals When a rule refuses a request, `extra` carries the machine-readable detail. Rely on the status code and `extra`; the `message` text is translated and may be reworded. **422 with detail** ```json { "message": "An option must be chosen from every required combo group.", "extra": { "line": 0, "code": "combo_selection_required_missing", "pick": null, "group": "01jbx0w3q1a2b3c4d5e6f7g8h9" } } ``` Index of every page: https://api.retm.sa/llms.txt --- # Menu > RETM Partner API v2 (current) · Catalogue · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/menu The whole orderable catalogue in one call: every category with its products, their modifiers, variations, taxes and combos. Use this to build or refresh a full menu. It returns only what a partner may sell: categories and products enabled for the API, and only products that can be ordered right now. ## Get the menu `GET /api/v2/menu` All API-enabled categories, each with its orderable products. - Auth: Bearer token - Permission: `read cats` ### Query parameters - `price_list_id` (string): The price list's internal **numeric** id. This is not the `id` that [Price lists](https://api.retm.sa/llms/v2/price-lists.txt) returns, so ask the merchant for it. Prices come from that list where it has one, and products, variations and modifier items switched off in that list are left out. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/menu" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `Category` objects. ```json [ { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "name": { "ar": "الوجبات", "en": "Meals" }, "status": 1, "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "description": { "ar": null, "en": null }, "image": "classic.png", "price": "18.000", "calories": 540, "estimated_time": 10, "type": 2, "status": 1, "modifiers": [ { "id": "01HBRKGPWKN282TFTP0SVJ5MD1", "name": { "ar": "إضافات", "en": "Extras" }, "multiple": 1, "min_selection": 0, "max_selection": 2, "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52C9", "name": { "ar": "جبنة", "en": "Cheese" }, "max_selection": 1, "extra_price": "3.000" } ] } ], "variations": [], "category": { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "title": { "ar": "الوجبات", "en": "Meals" } }, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "type": 2, "from_final_total": 0 } ], "combo": null } ] } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Categories > RETM Partner API v2 (current) · Catalogue · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/categories The top-level sections of the catalogue. ## List categories `GET /api/v2/categories/list` Every API-enabled category, in display order, without products. - Auth: Bearer token - Permission: `read cats` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/categories/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `Category` objects. `products` is not included in the list. ```json [ { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "name": { "ar": "الوجبات", "en": "Meals" }, "status": 1 } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a category `GET /api/v2/categories/{category}` One category with its orderable products, shaped exactly as in the menu. - Auth: Bearer token - Permission: `read cats` ### Path parameters - `category` (string, required): The category `id`. ### Query parameters - `price_list_id` (string): Apply a price list, as on [Get the menu](https://api.retm.sa/llms/v2/menu.txt). ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/categories/{category}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Category` object. ```json { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "name": { "ar": "الوجبات", "en": "Meals" }, "status": 1, "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "description": { "ar": null, "en": null }, "image": "classic.png", "price": "18.000", "calories": 540, "estimated_time": 10, "type": 2, "status": 1, "modifiers": [ { "id": "01HBRKGPWKN282TFTP0SVJ5MD1", "name": { "ar": "إضافات", "en": "Extras" }, "multiple": 1, "min_selection": 0, "max_selection": 2, "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52C9", "name": { "ar": "جبنة", "en": "Cheese" }, "max_selection": 1, "extra_price": "3.000" } ] } ], "variations": [], "category": { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "title": { "ar": "الوجبات", "en": "Meals" } }, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "type": 2, "from_final_total": 0 } ], "combo": null } ] } ``` ### Errors - `404`: Unknown category, or one not enabled for the API. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Groups > RETM Partner API v2 (current) · Catalogue · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/groups Groups are alternative product collections a merchant builds for a device or a channel. A group can override a product's price and status. ## List groups `GET /api/v2/groups/list` Every group, without products. - Auth: Bearer token - Permission: `read cats` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/groups/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `Group` objects. `groups` and `products` are not included in the list. ```json [ { "id": "01HBRKGPWKN282TFTP0SVJ5GR1", "name": { "ar": "قائمة التوصيل", "en": "Delivery menu" }, "image": null, "icon": null, "status": true } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a group `GET /api/v2/groups/{group}` One group with its child groups and its orderable products. - Auth: Bearer token - Permission: `read cats` On each product, `status` is the group's own setting for it (`1` or `0`), even when it differs from the product's own status. `price` is the group's override when it has one, and the product's price otherwise. > **Note:** Unlike the menu, a group lists products whether or not they are enabled for the API, and `price_list_id` is not applied here. ### Path parameters - `group` (string, required): The group `id`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/groups/{group}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Group` object. ```json { "id": "01HBRKGPWKN282TFTP0SVJ5GR1", "name": { "ar": "قائمة التوصيل", "en": "Delivery menu" }, "image": null, "icon": null, "status": true, "groups": [], "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "description": { "ar": null, "en": null }, "image": "classic.png", "price": "18.000", "calories": 540, "estimated_time": 10, "type": 2, "status": 1, "modifiers": [ { "id": "01HBRKGPWKN282TFTP0SVJ5MD1", "name": { "ar": "إضافات", "en": "Extras" }, "multiple": 1, "min_selection": 0, "max_selection": 2, "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52C9", "name": { "ar": "جبنة", "en": "Cheese" }, "max_selection": 1, "extra_price": "3.000" } ] } ], "variations": [], "category": { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "title": { "ar": "الوجبات", "en": "Meals" } }, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "type": 2, "from_final_total": 0 } ], "combo": null } ] } ``` ### Errors - `404`: Unknown group. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Products > RETM Partner API v2 (current) · Catalogue · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/products The things a merchant sells. A product is one of four types, and the type decides how you order it. | `type` | Kind | How to order it | | --- | --- | --- | | `1` | Normal | Send the product `id`. | | `2` | With modifiers | Send the product `id` and the chosen modifier items in `modifiers`. | | `3` | Combo | Listed for display. Order its picked items as ordinary lines tagged with `combo`. See [Ordering a combo](https://api.retm.sa/llms/v2/orders.txt). | | `4` | With variations | Send the product `id` and the chosen variation in `variant`. `price` is `null` on the product; each variation has its own. | ## What is listed The list, the single product, the menu and a category return only products that are enabled for the API, in an API-enabled category, and **orderable**. A combo with a required group that has no available option is left out, so the catalogue never offers something the order endpoint would refuse. ## List products `GET /api/v2/products/list` Orderable products with full detail, 15 per page. - Auth: Bearer token - Permission: `read products` ### Query parameters - `page` (integer): Page number, from `1`. - `price_list_id` (string): Apply a price list, as on [Get the menu](https://api.retm.sa/llms/v2/menu.txt). ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/products/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 A page of `Product` objects under `items`, with a counted `pagination` object (`from`, `to`, `per`, `total`, `current`, `path`). ```json { "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "description": { "ar": null, "en": null }, "image": "classic.png", "price": "18.000", "calories": 540, "estimated_time": 10, "type": 2, "status": 1, "modifiers": [ { "id": "01HBRKGPWKN282TFTP0SVJ5MD1", "name": { "ar": "إضافات", "en": "Extras" }, "multiple": 1, "min_selection": 0, "max_selection": 2, "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52C9", "name": { "ar": "جبنة", "en": "Cheese" }, "max_selection": 1, "extra_price": "3.000" } ] } ], "variations": [], "category": { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "title": { "ar": "الوجبات", "en": "Meals" } }, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "type": 2, "from_final_total": 0 } ], "combo": null } ], "pagination": { "from": 1, "to": 1, "per": 15, "total": 1, "current": 1, "path": "https://acme.retm.sa/api/v2/products/list" } } ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## List product names `GET /api/v2/products/simple` Every API-enabled product as `{id, name}`, unpaged, for mapping to your own catalogue. - Auth: Bearer token - Permission: `read products` This list includes every product type and is **not** filtered by availability. A mapping you have saved must not disappear because a combo is temporarily unorderable. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/products/simple" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of object objects. - `id` (string): The product identifier. - `name` (Localized): The product name. ```json [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" } } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a product `GET /api/v2/products/{product}` One orderable product with full detail. - Auth: Bearer token - Permission: `read products` ### Path parameters - `product` (string, required): The product `id`. ### Query parameters - `price_list_id` (string): Apply a price list, as on [Get the menu](https://api.retm.sa/llms/v2/menu.txt). ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/products/{product}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Product` object. ```json { "id": "01JBX0W3Q0C8K5M2N7P4R6T8V0", "name": { "ar": "وجبة برجر", "en": "Burger Meal" }, "description": { "ar": "برجر مع بطاطس ومشروب", "en": "Burger with fries and a drink" }, "image": "burger-meal.png", "price": "22.000", "calories": null, "estimated_time": null, "type": 3, "status": 1, "modifiers": [], "variations": [], "category": { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "title": { "ar": "الوجبات", "en": "Meals" } }, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "type": 2, "from_final_total": 0 } ], "combo": { "include_modifier_prices": false, "groups": [ { "id": "01jbx0w3q1a2b3c4d5e6f7g8h9", "name": { "ar": "البرجر", "en": "Burger" }, "is_optional": false, "sort": 0, "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "sku": "BRG-CLS", "type": 2, "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "image": "classic.png", "original_price": "18.000", "discount_applied": "2.000", "price": 16, "sort": 0, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "type": 2, "from_final_total": 0 } ], "modifiers": [ { "id": "01HBRKGPWKN282TFTP0SVJ5MD1", "name": { "ar": "إضافات", "en": "Extras" }, "multiple": 1, "min_selection": 0, "max_selection": 2, "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52C9", "name": { "ar": "جبنة", "en": "Cheese" }, "max_selection": 1, "extra_price": "3.000" } ] } ] } ] }, { "id": "01jbx0w3q3k4m5n6p7q8r9s0t1", "name": { "ar": "المشروب", "en": "Drink" }, "is_optional": true, "sort": 1, "items": [ { "id": "01HBRKGPWKN282TFTP0SVJ52D4", "sku": "JUC-ORG", "type": 1, "name": { "ar": "عصير برتقال", "en": "Orange Juice" }, "image": null, "original_price": "8.000", "discount_applied": "2.000", "price": 6, "sort": 0, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "type": 2, "from_final_total": 0 } ], "modifiers": [] } ] } ] } } ``` ### Errors - `404`: Unknown product, one not enabled for the API, or a combo that cannot be ordered right now. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Price lists > RETM Partner API v2 (current) · Catalogue · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/price-lists A price list is an alternative set of prices, for example for a delivery channel. Catalogue reads take a `price_list_id`, but in v2 that is the list's internal numeric id, not the `id` returned here. ## List price lists `GET /api/v2/priceLists/list` Every active price list. - Auth: Bearer token - Permission: `read priceLists` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/priceLists/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `PriceList` objects. ```json [ { "id": "01HBRKGPWKN282TFTP0SVJ5PL1", "name": { "ar": "أسعار التوصيل", "en": "Delivery prices" } } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a price list `GET /api/v2/priceLists/{list}` One active price list. - Auth: Bearer token - Permission: `read priceLists` ### Path parameters - `list` (string, required): The price list `id`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/priceLists/{list}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `PriceList` object. ```json { "id": "01HBRKGPWKN282TFTP0SVJ5PL1", "name": { "ar": "أسعار التوصيل", "en": "Delivery prices" } } ``` ### Errors - `404`: Unknown or inactive price list. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Branches > RETM Partner API v2 (current) · Store setup · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/branches A merchant's locations. An order is always pushed to one branch. ## List branches `GET /api/v2/branches/list` Every active branch. - Auth: Bearer token - Permission: `read branches` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/branches/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `Branch` objects. ```json [ { "uuid": "01HBRKGPWKN282TFTP0SVJ5BR1", "code": "RUH-01", "refrence": 4127, "name": { "ar": "فرع العليا", "en": "Olaya Branch" }, "open_time": "08:00", "close_time": "23:30", "longitude": "46.6753", "latitude": "24.7136", "order_radius": 8 } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a branch `GET /api/v2/branches/{branch}` One active branch. - Auth: Bearer token - Permission: `read branches` ### Path parameters - `branch` (string, required): The branch `uuid`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/branches/{branch}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Branch` object. ```json { "uuid": "01HBRKGPWKN282TFTP0SVJ5BR1", "code": "RUH-01", "refrence": 4127, "name": { "ar": "فرع العليا", "en": "Olaya Branch" }, "open_time": "08:00", "close_time": "23:30", "longitude": "46.6753", "latitude": "24.7136", "order_radius": 8 } ``` ### Errors - `404`: Unknown or inactive branch. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Devices > RETM Partner API v2 (current) · Store setup · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/devices The point-of-sale devices registered at the merchant's branches. ## List devices `GET /api/v2/devices/list` Every device. - Auth: Bearer token - Permission: `read devices` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/devices/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `Device` objects. ```json [ { "uuid": "01HBRKGPWKN282TFTP0SVJ5DV1", "name": { "ar": "كاشير 1", "en": "Cashier 1" }, "status": 1, "created_at": "2026-03-02T09:14:51.000000Z", "branch": "01HBRKGPWKN282TFTP0SVJ5BR1" } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a device `GET /api/v2/devices/{device}` One device. - Auth: Bearer token - Permission: `read devices` ### Path parameters - `device` (string, required): The device `uuid`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/devices/{device}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Device` object. ```json { "uuid": "01HBRKGPWKN282TFTP0SVJ5DV1", "name": { "ar": "كاشير 1", "en": "Cashier 1" }, "status": 1, "created_at": "2026-03-02T09:14:51.000000Z", "branch": "01HBRKGPWKN282TFTP0SVJ5BR1" } ``` ### Errors - `404`: Unknown device. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Order types > RETM Partner API v2 (current) · Store setup · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/order-types How an order is fulfilled: dine-in, takeaway, delivery, or a type your app creates for itself. ## List order types `GET /api/v2/orderTypes/list` Every active order type. - Auth: Bearer token - Permission: `read orderTypes` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/orderTypes/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `OrderType` objects. ```json [ { "uuid": "01HBRKGPWKN282TFTP0SVJ5OT1", "name": { "ar": "توصيل", "en": "Delivery" }, "is_credit": 0, "is_flowable": 1 } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get an order type `GET /api/v2/orderTypes/{orderType}` One active order type. - Auth: Bearer token - Permission: `read orderTypes` ### Path parameters - `orderType` (string, required): The order type `uuid`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/orderTypes/{orderType}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `OrderType` object. ```json { "uuid": "01HBRKGPWKN282TFTP0SVJ5OT1", "name": { "ar": "توصيل", "en": "Delivery" }, "is_credit": 0, "is_flowable": 1 } ``` ### Errors - `404`: Unknown or inactive order type. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Create an order type `POST /api/v2/orderTypes/create` Add an order type, for example one named after your channel. - Auth: Bearer token - Permission: `create orderTypes` ### Request body - `name` (object, required): The name in both languages. - `en` (string, required): English name. - `ar` (string, required): Arabic name. - `is_flowable` (boolean, required): Whether orders of this type move through the kitchen flow. ### Example request ```bash curl -X POST "https://{business_id}.retm.sa/api/v2/orderTypes/create" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "name": { "en": "Partner delivery", "ar": "توصيل الشريك" }, "is_flowable": true }' ``` ### Response 200 One `OrderType` object. ```json { "uuid": "01JCD8M2R5T7V9X1Z3B5D7F9H1", "name": { "en": "Partner delivery", "ar": "توصيل الشريك" }, "is_credit": 0, "is_flowable": true } ``` ### Errors - `422`: A required field is missing. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Payment methods > RETM Partner API v2 (current) · Store setup · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/payment-methods The ways a merchant takes money. Reference one in an order's `payments` to record how the order was paid. ## List payment methods `GET /api/v2/payments/list` Every active payment method. - Auth: Bearer token - Permission: `read payments` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/payments/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `PaymentMethod` objects. ```json [ { "uuid": "01HBRKGPWKN282TFTP0SVJ5PM1", "name": { "ar": "نقدي", "en": "Cash" }, "type": "1", "ecr_enabled": 0, "auto_open_drawer": 1 } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a payment method `GET /api/v2/payments/{payment}` One active payment method. - Auth: Bearer token - Permission: `read payments` ### Path parameters - `payment` (string, required): The payment method `uuid`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/payments/{payment}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `PaymentMethod` object. ```json { "uuid": "01HBRKGPWKN282TFTP0SVJ5PM1", "name": { "ar": "نقدي", "en": "Cash" }, "type": "1", "ecr_enabled": 0, "auto_open_drawer": 1 } ``` ### Errors - `404`: Unknown or inactive payment method. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Create a payment method `POST /api/v2/payments/create` Add a payment method, for example one that stands for money your platform collected. - Auth: Bearer token - Permission: `create payments` ### Request body - `name` (object, required): The name in both languages. - `en` (string, required): English name. - `ar` (string, required): Arabic name. - `type` (integer, required): The kind of payment, `1` to `7`. See [Payment method types](https://api.retm.sa/llms/v2/enums.txt). - `ecr_enabled` (boolean, required): Whether the method drives a connected card terminal. - `auto_open_drawer` (boolean): Whether taking this payment opens the cash drawer. ### Example request ```bash curl -X POST "https://{business_id}.retm.sa/api/v2/payments/create" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "name": { "en": "Partner wallet", "ar": "محفظة الشريك" }, "type": 2, "ecr_enabled": false, "auto_open_drawer": false }' ``` ### Response 200 One `PaymentMethod` object. ```json { "uuid": "01JCD8M2R5T7V9X1Z3B5D7F9H2", "name": { "en": "Partner wallet", "ar": "محفظة الشريك" }, "type": 2, "ecr_enabled": false, "auto_open_drawer": false } ``` ### Errors - `422`: A required field is missing, or `type` is outside `1` to `7`. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Taxes > RETM Partner API v2 (current) · Store setup · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/taxes The taxes a merchant applies. A product lists its own taxes; send their identifiers and amounts on each order line. ## List taxes `GET /api/v2/taxes/list` Every active tax. - Auth: Bearer token - Permission: `read taxes` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/taxes/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `Tax` objects. ```json [ { "uuid": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "type": 2, "value": "15.000", "price_include_tax": 1 } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a tax `GET /api/v2/taxes/{tax}` One active tax. - Auth: Bearer token - Permission: `read taxes` ### Path parameters - `tax` (string, required): The tax `uuid`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/taxes/{tax}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Tax` object. ```json { "uuid": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "type": 2, "value": "15.000", "price_include_tax": 1 } ``` ### Errors - `404`: Unknown or inactive tax. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Create a tax `POST /api/v2/taxes/create` Add a percentage tax. - Auth: Bearer token - Permission: `create taxes` A tax created through the API is always a **percentage** tax (`type` `2`). ### Request body - `name` (object, required): The name in both languages. - `en` (string, required): English name. - `ar` (string, required): Arabic name. - `value` (number, required): The rate, in percent. ### Example request ```bash curl -X POST "https://{business_id}.retm.sa/api/v2/taxes/create" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "name": { "en": "Service tax", "ar": "ضريبة الخدمة" }, "value": 5 }' ``` ### Response 200 One `Tax` object. ```json { "uuid": "01JCD8M2R5T7V9X1Z3B5D7F9H3", "name": { "en": "Service tax", "ar": "ضريبة الخدمة" }, "type": 2, "value": 5, "price_include_tax": null } ``` ### Errors - `422`: A required field is missing. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Charges > RETM Partner API v2 (current) · Store setup · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/charges Order-level fees such as delivery or service. An order carries at most one charge. ## List charges `GET /api/v2/charges/list` Every active charge. - Auth: Bearer token - Permission: `read charges` ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/charges/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 An array of `Charge` objects. ```json [ { "uuid": "01HBRKGPWKN282TFTP0SVJ5CH1", "name": { "ar": "رسوم التوصيل", "en": "Delivery fee" }, "value": "10.000", "tax": { "uuid": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "type": 2, "value": "15.000", "price_include_tax": 1 } } ] ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a charge `GET /api/v2/charges/{charge}` One active charge. - Auth: Bearer token - Permission: `read charges` ### Path parameters - `charge` (string, required): The charge `uuid`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/charges/{charge}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Charge` object. ```json { "uuid": "01HBRKGPWKN282TFTP0SVJ5CH1", "name": { "ar": "رسوم التوصيل", "en": "Delivery fee" }, "value": "10.000", "tax": { "uuid": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "type": 2, "value": "15.000", "price_include_tax": 1 } } ``` ### Errors - `404`: Unknown or inactive charge. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Create a charge `POST /api/v2/charges/create` Add an order charge. - Auth: Bearer token - Permission: `create charges` ### Request body - `name` (object, required): The name in both languages. - `en` (string, required): English name. - `ar` (string, required): Arabic name. - `value` (number, required): The default amount of the charge. ### Example request ```bash curl -X POST "https://{business_id}.retm.sa/api/v2/charges/create" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "name": { "en": "Partner delivery fee", "ar": "رسوم توصيل الشريك" }, "value": 12 }' ``` ### Response 200 One `Charge` object. ```json { "uuid": "01JCD8M2R5T7V9X1Z3B5D7F9H4", "name": { "en": "Partner delivery fee", "ar": "رسوم توصيل الشريك" }, "value": 12 } ``` ### Errors - `422`: A required field is missing. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Orders > RETM Partner API v2 (current) · Sales · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/orders Push an order into a merchant's branch, follow it as the merchant handles it, and read it back. ## Lifecycle An order you push starts as `under_review` and waits for the merchant to accept it. From there the merchant moves it forward, and each move is sent to your `order` webhook. 1. `under_review`: Pushed, waiting for the merchant 2. `processing`: Accepted 3. `ready`: Prepared 4. `done`: Handed over - Exit to `cancelled` from `under_review`: Withdrawn by you, before the merchant accepts - Exit to `rejected` from `processing`: Refused by the merchant, before or after accepting | Status | Reached from | Who | Webhook | | --- | --- | --- | --- | | `under_review` | — | You, by pushing the order | none | | `processing` | `under_review` | Merchant accepts | `status: 2` | | `rejected` | `under_review`, `processing` | Merchant rejects | `status: 3` | | `ready` | `processing` | Merchant marks it ready | `status: 4` | | `done` | `processing`, `ready` | Merchant completes it | `status: 6` | | `cancelled` | `under_review` | You, by cancelling | none | ## Make pushes safe to retry Send a `partner_reference` with every order: your own id for it, up to 36 characters. It is unique per app. If the same reference arrives twice, the second push is refused with `409` instead of creating a second order. - **Treat that `409` as success.** It means the order is already in RETM. It is the correct answer to a retry whose first attempt landed. - **Store `order.id` from the `200`.** It is the identifier for reading and cancelling the order. - Without a `partner_reference`, a repeated push creates a second order. ## You calculate the amounts RETM stores the amounts you send. It does not reprice the order. Read prices, taxes and combo discounts from the catalogue and compute each line and the order totals before pushing. - Taxes go on the lines only: `products[].taxes[]`. The order keeps one `tax` total. An order-level `taxes` array is ignored. - A line's `total` is what the customer pays for it; `subtotal` is before tax; `tax` and `discount` are the line's own. ## Ordering a combo You order **the picked items, not the combo**. Send one ordinary line per pick: `id` is the picked product, priced like that product with the combo discount in `discount`, and tagged `combo: {id, group, key}`. The combo itself is never a line, and its `price` is a display figure you never send. - Exactly one line from every required group (`is_optional: false`), at most one from every optional group. - Every line's product must be an option currently listed in the group it names. - Every line of one combo carries the same `quantity` and the same `combo.key`. A second combo in the same order, even of the same combo product, takes the next `key`. - A line whose `id` is a combo is refused: a combo cannot be ordered as a product. **Pricing a line of a combo** ```text line subtotal = (option original_price + chosen modifier prices, unless include_modifier_prices is true ) × quantity line discount = option discount_applied × quantity line tax = the option's own taxes on (subtotal − discount) line total = subtotal − discount + tax ``` ## List orders `GET /api/v2/orders/list` The orders your app has pushed, 15 per page. - Auth: Bearer token - Permission: `read orders` - Rate limit: 5 per minute You only ever see orders created by your own app. ### Query parameters - `page` (integer): Page number, from `1`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/orders/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 A page of `Order` objects under `items`, with a counted `pagination` object (`from`, `to`, `per`, `total`, `current`, `path`). ```json { "items": [ { "id": "01JB7Q4K8M0N2P4R6T8V0X2Z4B", "order_reference": 41022, "partner_reference": "ORD-88231", "total": "86.250", "subtotal": "65.000", "tax": "9.750", "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "amount": "9.750" } ], "payments": [ { "id": "01HBRKGPWKN282TFTP0SVJ5PM1", "name": { "ar": "نقدي", "en": "Cash" }, "amount": "86.250" } ], "status": "processing", "rate": null, "note": "Leave at the door", "meta": { "source": "api", "auto_accept": false }, "estimated_time": "2026-11-18T12:40:00.000000Z", "created_at": "2026-11-18T12:20:11.000000Z", "updated_at": "2026-11-18T12:25:00.000000Z", "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "variant": { "id": null, "name": null }, "modifiers": [], "total": "36.800", "subtotal": "36.000", "tax": "4.800", "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "amount": "4.800" } ], "discount": "4.000", "quantity": "2.000", "note": null, "combo": { "id": "01JBX0W3Q0C8K5M2N7P4R6T8V0", "name": { "ar": "وجبة برجر", "en": "Burger Meal" }, "key": 1, "group": { "id": "01jbx0w3q1a2b3c4d5e6f7g8h9", "name": { "ar": "البرجر", "en": "Burger" } } } }, { "id": "01HBRKGPWKN282TFTP0SVJ52D4", "name": { "ar": "عصير برتقال", "en": "Orange Juice" }, "variant": { "id": null, "name": null }, "modifiers": [], "total": "13.800", "subtotal": "16.000", "tax": "1.800", "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "amount": "1.800" } ], "discount": "4.000", "quantity": "2.000", "note": null, "combo": { "id": "01JBX0W3Q0C8K5M2N7P4R6T8V0", "name": { "ar": "وجبة برجر", "en": "Burger Meal" }, "key": 1, "group": { "id": "01jbx0w3q3k4m5n6p7q8r9s0t1", "name": { "ar": "المشروب", "en": "Drink" } } } } ], "charges": { "id": 3, "name": { "ar": "رسوم التوصيل", "en": "Delivery fee" }, "value": "11.500" }, "coupon": { "code": null, "amount": "0.000" }, "order_type": { "id": "01HBRKGPWKN282TFTP0SVJ5OT1", "name": { "ar": "توصيل", "en": "Delivery" } }, "branch": { "id": "01HBRKGPWKN282TFTP0SVJ5BR1", "name": { "ar": "فرع العليا", "en": "Olaya Branch" } }, "customer": { "id": "01HBRKGPWKN282TFTP0SVJ5CU1", "name": { "ar": "Sara Ahmed", "en": "Sara Ahmed" }, "phone": "0551234567" } } ], "pagination": { "from": 1, "to": 1, "per": 15, "total": 1, "current": 1, "path": "https://acme.retm.sa/api/v2/orders/list" } } ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get an order `GET /api/v2/orders/{order}` One order your app pushed, with its lines and the combo each was ordered under. - Auth: Bearer token - Permission: `read orders` - Rate limit: 5 per minute ### Path parameters - `order` (string, required): The order `id`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/orders/{order}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Order` object. ```json { "id": "01JB7Q4K8M0N2P4R6T8V0X2Z4B", "order_reference": 41022, "partner_reference": "ORD-88231", "total": "86.250", "subtotal": "65.000", "tax": "9.750", "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "amount": "9.750" } ], "payments": [ { "id": "01HBRKGPWKN282TFTP0SVJ5PM1", "name": { "ar": "نقدي", "en": "Cash" }, "amount": "86.250" } ], "status": "processing", "rate": null, "note": "Leave at the door", "meta": { "source": "api", "auto_accept": false }, "estimated_time": "2026-11-18T12:40:00.000000Z", "created_at": "2026-11-18T12:20:11.000000Z", "updated_at": "2026-11-18T12:25:00.000000Z", "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "variant": { "id": null, "name": null }, "modifiers": [], "total": "36.800", "subtotal": "36.000", "tax": "4.800", "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "amount": "4.800" } ], "discount": "4.000", "quantity": "2.000", "note": null, "combo": { "id": "01JBX0W3Q0C8K5M2N7P4R6T8V0", "name": { "ar": "وجبة برجر", "en": "Burger Meal" }, "key": 1, "group": { "id": "01jbx0w3q1a2b3c4d5e6f7g8h9", "name": { "ar": "البرجر", "en": "Burger" } } } }, { "id": "01HBRKGPWKN282TFTP0SVJ52D4", "name": { "ar": "عصير برتقال", "en": "Orange Juice" }, "variant": { "id": null, "name": null }, "modifiers": [], "total": "13.800", "subtotal": "16.000", "tax": "1.800", "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "value": "15.000", "amount": "1.800" } ], "discount": "4.000", "quantity": "2.000", "note": null, "combo": { "id": "01JBX0W3Q0C8K5M2N7P4R6T8V0", "name": { "ar": "وجبة برجر", "en": "Burger Meal" }, "key": 1, "group": { "id": "01jbx0w3q3k4m5n6p7q8r9s0t1", "name": { "ar": "المشروب", "en": "Drink" } } } } ], "charges": { "id": 3, "name": { "ar": "رسوم التوصيل", "en": "Delivery fee" }, "value": "11.500" }, "coupon": { "code": null, "amount": "0.000" }, "order_type": { "id": "01HBRKGPWKN282TFTP0SVJ5OT1", "name": { "ar": "توصيل", "en": "Delivery" } }, "branch": { "id": "01HBRKGPWKN282TFTP0SVJ5BR1", "name": { "ar": "فرع العليا", "en": "Olaya Branch" } }, "customer": { "id": "01HBRKGPWKN282TFTP0SVJ5CU1", "name": { "ar": "Sara Ahmed", "en": "Sara Ahmed" }, "phone": "0551234567" } } ``` ### Errors - `404`: Unknown order, or an order pushed by another app. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Create an order `POST /api/v2/orders/create` Push an order to a branch. It arrives at the branch's point of sale, where the merchant accepts or rejects it. - Auth: Bearer token - Permission: `create order` The customer is matched by phone number and created if new. This happens before the order is checked, so a refused order can still leave a new customer behind. ### Request body - `partner_reference` (string): Your id for this order, up to 36 characters. Makes the push safe to retry. Strongly recommended. - `branch` (string, required): The branch `uuid`. - `ordertype` (string): The order type `uuid`. - `customer` (object, required): Who the order is for. - `phone` (string, required): The customer's phone number. A nine-digit number without the leading zero gets one added. - `name` (string | Localized): A plain string, or `{ar, en}`. Used only when the customer is new. Defaults to the phone number. - `email` (string): Optional email. - `products` (array, required): The order lines. At least one. - `id` (string, required): The product `id`. - `quantity` (number, required): At least `1`. - `total` (number, required): Line total, tax included. `0` or more. - `subtotal` (number): Line amount before tax. Default `0`. - `tax` (number): Line tax amount. Default `0`. - `discount` (number): Line discount amount. Default `0`. - `variant` (string): The chosen variation `id`, for a product with variations. - `note` (string): A note for the kitchen. - `taxes` (array): The taxes on this line. - `id` (string, required): The tax identifier, as listed on the product. - `value` (number, required): The tax **amount** on this line, not the rate. - `modifiers` (array): Chosen modifier items. - `id` (string, required): The modifier item `id`. - `quantity` (number, required): At least `1`. - `amount` (number, required): The price charged for this modifier item. `0` or more. - `combo` (object): The combo this line was picked for. Omit it on a line that is not part of a combo. - `id` (string, required): The combo `id`. - `group` (string, required): The `id` of the combo group the product was picked from. - `key` (integer): The combo's number inside this order, `1` or more. Default `1`. Every line of one ordered combo shares it. - `subtotal` (number, required): Order amount before tax. - `tax` (number): Order tax total. Default `0`. - `total` (number, required): Order total. - `payments` (array): How the order was paid, if it was paid on your side. - `id` (string, required): The payment method `uuid`. - `amount` (number, required): The amount paid with it. - `charges` (object): One order charge. - `id` (string): The charge `uuid`. - `amount` (number): The charge amount. Default `0`. - `discount` (object): One order discount. - `code` (string): The coupon code used. - `amount` (number): The discount amount. Default `0`. - `note` (string): A note on the whole order. - `auto_accept` (boolean): Recorded on the order as `meta.auto_accept`. Default `false`. ### Example request ```bash curl -X POST "https://{business_id}.retm.sa/api/v2/orders/create" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "partner_reference": "ORD-88231", "branch": "01HBRKGPWKN282TFTP0SVJ5BR1", "ordertype": "01HBRKGPWKN282TFTP0SVJ5OT1", "customer": { "phone": "0551234567", "name": "Sara Ahmed" }, "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "quantity": 1, "subtotal": 21, "tax": 3.15, "discount": 0, "total": 24.15, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "value": 3.15 } ], "modifiers": [ { "id": "01HBRKGPWKN282TFTP0SVJ52C9", "quantity": 1, "amount": 3 } ] }, { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "quantity": 2, "subtotal": 36, "tax": 4.8, "discount": 4, "total": 36.8, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "value": 4.8 } ], "combo": { "id": "01JBX0W3Q0C8K5M2N7P4R6T8V0", "group": "01jbx0w3q1a2b3c4d5e6f7g8h9", "key": 1 } }, { "id": "01HBRKGPWKN282TFTP0SVJ52D4", "quantity": 2, "subtotal": 16, "tax": 1.8, "discount": 4, "total": 13.8, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "value": 1.8 } ], "combo": { "id": "01JBX0W3Q0C8K5M2N7P4R6T8V0", "group": "01jbx0w3q3k4m5n6p7q8r9s0t1", "key": 1 } } ], "payments": [ { "id": "01HBRKGPWKN282TFTP0SVJ5PM1", "amount": 86.25 } ], "charges": { "id": "01HBRKGPWKN282TFTP0SVJ5CH1", "amount": 11.5 }, "subtotal": 65, "tax": 9.75, "total": 86.25, "note": "Leave at the door" }' ``` ### Response 200 - `message` (string): A translated confirmation. - `order` (object): The created order. - `id` (string): The order identifier. Use it to read and cancel the order. Store it. - `order_reference` (integer): RETM's own number for the order. It is what the merchant sees, and what webhooks call `order_reference`. - `partner_reference` (string | null): The reference you sent. ```json { "message": "Order Created Successfully", "order": { "id": "01JB7Q4K8M0N2P4R6T8V0X2Z4B", "order_reference": 41022, "partner_reference": "ORD-88231" } } ``` ### Errors - `409`: You have already pushed this `partner_reference`. The order is in RETM: stop, and do not resend under a new reference. ```json { "message": "An order with this partner reference already exists", "extra": [] } ``` - `409`: Two pushes of the same reference are in flight at the same instant. Retry once; the retry gets the 409 above. ```json { "message": "An order with this partner reference is already being created", "extra": [] } ``` - `404`: A branch, product, variation, modifier, tax, payment method, order type or charge identifier does not exist. `extra.missing` lists the unknown ones. ```json { "message": "Referenced product was not found.", "extra": { "missing": [ "01HBRKGPWKN282TFTP0SVJ5XXX" ] } } ``` - `422`: A field fails validation. `errors` is keyed by path, such as `products.0.quantity`. - `422`: A line's product is of a type that cannot be ordered remotely. ```json { "message": "These products cannot be ordered remotely", "extra": { "products": [ "01HBRKGPWKN282TFTP0SVJ5XXX" ] } } ``` - `422`: A combo rule is broken. `extra.code` says which; see Combo refusals below. ```json { "message": "An option must be chosen from every required combo group.", "extra": { "line": "01JBX0W3Q0C8K5M2N7P4R6T8V0:1", "code": "combo_selection_required_missing", "pick": null, "group": "01jbx0w3q1a2b3c4d5e6f7g8h9" } } ``` Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). #### Combo refusals `extra.line` is the combo concerned as `:`, `extra.pick` the index in `products` of the offending line (or `null`), and `extra.group` the group concerned (or `null`). Only the first refusal is returned. | `extra.code` | When | | --- | --- | | `combo_selection_quantity_mismatch` | The lines of one combo carry different quantities. `extra.line` is the index in `products` of its first line. | | `combo_selection_not_a_combo` | `combo.id` is a product that is not a combo. | | `combo_selection_group_unknown` | `combo.group` is not a group of this combo. | | `combo_selection_option_unknown` | The line's product is not offered in that group, or it is inactive. | | `combo_selection_group_repeated` | Two lines of one combo in the same group. | | `combo_selection_required_missing` | A required group has no line. | A line whose `id` is a combo is refused with `422` and `extra.products` listing those identifiers. ## Cancel an order `POST /api/v2/orders/{order}/cancel` Withdraw an order the merchant has not accepted yet. - Auth: Bearer token - Permission: `create order` Only an order your app created, and still `under_review`, can be cancelled: an order from another app or from the merchant's digital menu answers `404`, exactly like an unknown id. Send no body. Cancelling does not trigger a webhook back to you. ### Path parameters - `order` (string, required): The order `id` from the create response. Not the `partner_reference`. ### Example request ```bash curl -X POST "https://{business_id}.retm.sa/api/v2/orders/{order}/cancel" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 - `success` (boolean): `true` when the order was cancelled. ```json { "success": true } ``` ### Errors - `409`: The order has already been accepted, rejected or finished. ```json { "message": "Cannot change remote order status from processing to cancelled.", "extra": [] } ``` - `404`: Unknown order, or an order your app did not create. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Invoices > RETM Partner API v2 (current) · Sales · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/invoices The sales invoices a merchant has issued, from every channel, newest first. An invoice is the fiscal record of a sale or a refund. It is the same object the `invoice` webhook delivers. For an ongoing sync, listen to the webhook and use this list to backfill a date range. > **Heads up:** This endpoint does not check an app permission in v2: any installed app can read every invoice of the merchant. ## List invoices `GET /api/v2/invoices/list` Invoices ordered by `invoice_id` descending, in forward-only pages. - Auth: Bearer token - Rate limit: 5 per minute The sort order is fixed: newest invoice first, stable while you page. `filter[sort]` is ignored. Keep requesting `next_page_url` while `has_more` is `true`. There is no total count. ### Query parameters - `filter[range][date][dated_at][from]` (date): Start of a business-date range, `YYYY-MM-DD`. Send both ends. - `filter[range][date][dated_at][to]` (date): End of the range, inclusive to the end of that day. - `filter[column][{column}]` (string): Exact match on one of: `id`, `branch_id`, `device_id`, `charges_id`, `customer_id`, `order_type_id`, `discount_code`, `created_by`, `status`, `brand_id`, `type`, `transaction_id`, `register_id`, `giftcard_code`, `sale_refrence`. - `filter[search][transaction_id]` (string): Search on the transaction id. - `filter[limit]` (integer): Page size. Default `15`, capped at `100`. - `page` (integer): Page number, from `1`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/invoices/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 A page of `Invoice` objects under `items`, with a forward-only `pagination` object (`per`, `current_page`, `has_more`, `next_page_url`, `prev_page_url`). ```json { "items": [ { "event": "order.created", "event_type": "create.order", "invoice_id": 10432, "order_refrence": 10432, "sale_id": 9981, "order_reference": "10432", "branch_id": "01HBRKGPWKN282TFTP0SVJ5BR1", "device_id": "01HBRKGPWKN282TFTP0SVJ5DV1", "created_at": "2026-11-18 12:31:07", "total_price": "24.150", "subtotal_price": "21.000", "tax": "3.150", "status": 1, "note": null, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "amount": "3.150" } ], "payments": [ { "id": "01HBRKGPWKN282TFTP0SVJ5PM1", "name": { "ar": "نقدي", "en": "Cash" }, "amount": "24.150" } ], "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "sku": "BRG-CLS", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "quantity": "1.000", "total": "24.150", "subtotal": "21.000", "unit_price": 21, "discount_amount": "0.000", "tax": "3.150", "note": null, "category": { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "name": { "ar": "الوجبات", "en": "Meals" } }, "variation": { "id": null, "name": null }, "modifiers": [ { "id": "01HBRKGPWKN282TFTP0SVJ52C9", "name": { "ar": "جبنة", "en": "Cheese" }, "quantity": "1.000", "price": "3.000" } ] } ], "customer": { "id": "01HBRKGPWKN282TFTP0SVJ5CU1", "name": { "ar": "Sara Ahmed", "en": "Sara Ahmed" }, "phone": "0551234567", "email": null }, "discount": { "id": null, "amount": "0.000" }, "order_charge": { "id": null, "amount": "0.000" }, "order_type": { "id": "01HBRKGPWKN282TFTP0SVJ5OT1", "name": { "ar": "توصيل", "en": "Delivery" } }, "meta": { "order_reference": null } } ], "pagination": { "per": 15, "current_page": 1, "has_more": true, "next_page_url": "https://acme.retm.sa/api/v2/invoices/list?page=2", "prev_page_url": null } } ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Customers > RETM Partner API v2 (current) · Sales · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/customers The merchant's customers. Customers are created for you when you push an order with a new phone number. ## List customers `GET /api/v2/customers/list` Active customers, 15 per page. - Auth: Bearer token - Permission: `read customers` - Rate limit: 5 per minute ### Query parameters - `page` (integer): Page number, from `1`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/customers/list" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 A page of `Customer` objects under `items`, with a counted `pagination` object (`from`, `to`, `per`, `total`, `current`, `path`). ```json { "items": [ { "id": 5521, "uuid": "01HBRKGPWKN282TFTP0SVJ5CU1", "name": { "ar": "Sara Ahmed", "en": "Sara Ahmed" }, "phone": "0551234567", "status": 1, "created_at": "2026-10-04T16:02:44.000000Z" } ], "pagination": { "from": 1, "to": 1, "per": 15, "total": 1, "current": 1, "path": "https://acme.retm.sa/api/v2/customers/list" } } ``` ### Errors Only the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). ## Get a customer `GET /api/v2/customers/{customer}` One active customer. - Auth: Bearer token - Permission: `read customers` ### Path parameters - `customer` (string, required): The customer `uuid`. ### Example request ```bash curl "https://{business_id}.retm.sa/api/v2/customers/{customer}" \ -H "Authorization: Bearer $RETM_TOKEN" \ -H "Accept: application/json" ``` ### Response 200 One `Customer` object. ```json { "id": 5521, "uuid": "01HBRKGPWKN282TFTP0SVJ5CU1", "name": { "ar": "Sara Ahmed", "en": "Sara Ahmed" }, "phone": "0551234567", "status": 1, "created_at": "2026-10-04T16:02:44.000000Z" } ``` ### Errors - `404`: Unknown or inactive customer. Plus the errors every endpoint can answer: `401` expired or missing token, `403` missing permission, `423` expired subscription, `429` rate limit. See [Errors](https://api.retm.sa/llms/v2/errors.txt). Index of every page: https://api.retm.sa/llms.txt --- # Webhooks > RETM Partner API v2 (current) · Webhooks · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/webhooks RETM calls your server when something happens at a merchant who installed your app, so you never have to poll. ## Key concepts | Term | Meaning | | --- | --- | | Subscription | Your app's registration for a webhook module: the events you want, and the URL to send them to. | | Event | Something that happened at a merchant, triggered by an action in their dashboard, at the point of sale, or through the API. | | Notification URL | The HTTPS endpoint on your server that receives and processes the event. | ## How it works You subscribe per **module**. A module is a family of events: `invoice`, `order`, `menu` and `error`. The body of each is on [Webhook events](https://api.retm.sa/llms/v2/webhook-events.txt). 1. **Subscribe**: In the developer portal, choose the modules your app listens to and give each one a notification URL. 2. **An event happens**: A matching event at a merchant who installed your app makes RETM build a notification. 3. **RETM delivers it**: RETM sends a `POST` with the event as JSON to your notification URL. 4. **You acknowledge**: Your server answers with a `2xx` status to confirm receipt. ## The request **What your server receives** ```http POST /retm/invoice HTTP/1.1 Host: partner.example.com Authorization: Bearer Content-Type: application/json { ...event body..., "business_refrence": "acme", "timestamp": 1795004324 } ``` Every body, whatever the module, ends with the same two keys: - `business_refrence` (string): The `business_id` of the merchant the event belongs to. Note the spelling of the key: it is part of the contract. - `timestamp` (integer): Unix time, in seconds, when the event was queued. ## Verifying a webhook The `Authorization` header carries the token you returned from your success endpoint, encrypted with your client secret. Recompute it and compare. If you returned no token at installation, the header is empty and you cannot verify the caller. **The webhook token** ```text webhook token = base64( AES-256-ECB( token you returned , key = your client_secret ) ) ``` **Verify in Node.js** ```javascript import crypto from 'node:crypto'; function expectedToken(installToken, clientSecret) { const cipher = crypto.createCipheriv('aes-256-ecb', Buffer.from(clientSecret), null); return Buffer.concat([cipher.update(installToken, 'utf8'), cipher.final()]).toString('base64'); } function isFromRetm(req, installToken, clientSecret) { const sent = (req.headers.authorization || '').replace(/^Bearer /, ''); const want = expectedToken(installToken, clientSecret); return sent.length === want.length && crypto.timingSafeEqual(Buffer.from(sent), Buffer.from(want)); } ``` **Verify in PHP** ```php $sent = preg_replace('/^Bearer /', '', $_SERVER['HTTP_AUTHORIZATION'] ?? ''); $want = openssl_encrypt($installToken, 'AES-256-ECB', $clientSecret); if (! hash_equals($want, $sent)) { http_response_code(401); exit; } ``` **Or decrypt the header to get your token back (PHP)** ```php $encrypted = preg_replace('/^Bearer /', '', $_SERVER['HTTP_AUTHORIZATION'] ?? ''); $token = openssl_decrypt($encrypted, 'AES-256-ECB', $clientSecret); // $token is now the value you returned from your success endpoint ``` #### Signature header Every webhook also carries `X-Retm-Signature`: `sha256=` followed by the HMAC-SHA256 of the **raw request body**, keyed with your app's client secret. It proves both who sent the body and that nobody changed it. Compute it over the bytes you received, before parsing the JSON. **Verify the signature (PHP)** ```php $rawBody = file_get_contents('php://input'); $want = 'sha256=' . hash_hmac('sha256', $rawBody, $clientSecret); if (! hash_equals($want, $_SERVER['HTTP_X_RETM_SIGNATURE'] ?? '')) { http_response_code(401); exit; } ``` ## Responding - Your notification URL must be reachable publicly over **HTTPS**. - Answer with any `2xx` status within **25 seconds**. The body is recorded but not interpreted. - Do the slow work after you answer. Queue the event and return. - Anything else is a failed delivery: a non-2xx status, a timeout, or a connection error. ## Retries and failures Actors: RETM, Your notification URL, Your error URL. 1. RETM → Your notification URL: `POST` the event body 2. Your notification URL → RETM (reply): Any `2xx` within 25 seconds: delivered 3. RETM → Your notification URL: Otherwise, one retry after half a second 4. RETM → Your error URL: Still failing: `POST` the reason to your `error` module - A failed call is retried **once**, automatically, after half a second. - If it fails again, RETM calls your `error` module, if you subscribed to it, with the reason. - There are no further automatic retries. The merchant can see every delivery in their dashboard and press **Retry**, which re-sends the exact bytes of the original body. - Deliveries are kept for the merchant to inspect: about 10 days for successes and 30 days for failures. ## Best practices - **Expect a short delay.** Notifications typically arrive within 30 seconds of the event. - **Be idempotent.** A retry or a manual replay delivers the same body again. Key on `invoice_id`, or on `order.id` plus `status`. - **Do not rely on order.** Deliveries are sent from a queue and may arrive out of sequence. - **Treat the body as a notification.** For the menu, re-read the resource rather than applying `changes` blindly. Index of every page: https://api.retm.sa/llms.txt --- # Webhook events > RETM Partner API v2 (current) · Webhooks · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/webhook-events The body of each webhook module. Every body also carries `business_refrence` and `timestamp`. ## Invoice issued Module: `invoice`. RETM sends a `POST` with this body to your `invoice` notification URL. Sent to every subscribed app when a sale or a refund invoice is issued, from any channel. The body is one [Invoice](https://api.retm.sa/llms/v2/invoices.txt), exactly as the invoice list returns it, with one difference: `created_at` here is **UTC** (`YYYY-MM-DD HH:MM:SS`, no offset). | `event` | `event_type` | Meaning | | --- | --- | --- | | `order.created` | `create.order` | A sale invoice. | | `order.refunded` | `update.items` | A refund invoice. | A sold combo appears as its picked items: ordinary lines in `products`, each with its own price and the combo discount in its discount amount. No line carries the combo's own `id`, and summing `products` still gives the invoice. ### Body One `Invoice` object (see the schemas below). ```json { "event": "order.created", "event_type": "create.order", "invoice_id": 10432, "order_refrence": 10432, "sale_id": 9981, "order_reference": "10432", "branch_id": "01HBRKGPWKN282TFTP0SVJ5BR1", "device_id": "01HBRKGPWKN282TFTP0SVJ5DV1", "created_at": "2026-11-18 09:31:07", "total_price": "24.150", "subtotal_price": "21.000", "tax": "3.150", "status": 1, "note": null, "taxes": [ { "id": "01HBRKGPWKN282TFTP0SVJ52AA", "name": { "ar": "ضريبة القيمة المضافة", "en": "VAT" }, "amount": "3.150" } ], "payments": [ { "id": "01HBRKGPWKN282TFTP0SVJ5PM1", "name": { "ar": "نقدي", "en": "Cash" }, "amount": "24.150" } ], "products": [ { "id": "01HBRKGPWKN282TFTP0SVJ52B1", "sku": "BRG-CLS", "name": { "ar": "برجر كلاسيك", "en": "Classic Burger" }, "quantity": "1.000", "total": "24.150", "subtotal": "21.000", "unit_price": 21, "discount_amount": "0.000", "tax": "3.150", "note": null, "category": { "id": "01HBRKGPWKN282TFTP0SVJ5CT7", "name": { "ar": "الوجبات", "en": "Meals" } }, "variation": { "id": null, "name": null }, "modifiers": [] } ], "customer": { "id": null, "name": null, "phone": null, "email": null }, "discount": { "id": null, "amount": "0.000" }, "order_charge": { "id": null, "amount": "0.000" }, "order_type": { "id": "01HBRKGPWKN282TFTP0SVJ5OT1", "name": { "ar": "توصيل", "en": "Delivery" } }, "meta": { "order_reference": 41022 }, "business_refrence": "acme", "timestamp": 1795004324 } ``` ## Order status changed Module: `order`. RETM sends a `POST` with this body to your `order` notification URL. Sent only to the app that pushed the order, when the merchant accepts, rejects, readies or completes it. `status` is a **number** here, not the status name the order endpoints return. | `status` | Order status | Meaning | | --- | --- | --- | | `2` | `processing` | The merchant accepted the order. | | `3` | `rejected` | The merchant rejected the order. | | `4` | `ready` | The order is prepared. | | `6` | `done` | The order was handed over. | Creating and cancelling an order are your own actions and send no webhook. ### Body - `order` (object): The order that changed. - `id` (string): The order `id`, as returned when you created it. - `order_reference` (integer): RETM's number for the order. - `status` (integer): `2`, `3`, `4` or `6`. ```json { "order": { "id": "01JB7Q4K8M0N2P4R6T8V0X2Z4B", "order_reference": 41022, "status": 2 }, "business_refrence": "acme", "timestamp": 1795004324 } ``` ## Menu changed Module: `menu`. RETM sends a `POST` with this body to your `menu` notification URL. Sent to every subscribed app when a product, combo, category, modifier or variation is created or edited. Use it as a signal to re-read the catalogue. For a product or a combo, `reference` is its `id` and you can fetch it directly with [Get a product](https://api.retm.sa/llms/v2/products.txt). | `category` | What changed | `reference` | `changes` | | --- | --- | --- | --- | | `product` | A product or a combo | Its `id` | The changed columns, or `{"groups": true}` when a combo's groups, options or option discounts changed. Empty on `menu.created`. | | `category` | A category | An internal number | Always empty | | `modifier` | A modifier or one of its items | An internal number | Always empty | | `variation` | A product variation | An internal number | Always empty | > **Heads up:** For `category`, `modifier` and `variation`, `reference` is an internal number that no endpoint accepts. Re-read the [menu](https://api.retm.sa/llms/v2/menu.txt) when one arrives. Bulk deletes from the dashboard send no webhook. ### Body - `event` (string): `menu.` followed by the change, such as `menu.created` or `menu.updated`. - `category` (string): The kind of entity: `product`, `category`, `modifier` or `variation`. - `reference` (string | integer): The entity. See the table above. - `changes` (object | array): The changed columns with their new values, or an empty array. ```json { "event": "menu.updated", "category": "product", "reference": "01HBRKGPWKN282TFTP0SVJ52B1", "changes": { "price": "19.000" }, "business_refrence": "acme", "timestamp": 1795004324 } ``` ## Delivery failed Module: `error`. RETM sends a `POST` with this body to your `error` notification URL. Sent to your `error` notification URL when a delivery to one of your other notification URLs failed after its retry. This body does not carry `business_refrence`. It is sent once, with a 10-second timeout, and is not retried. A manual replay from the dashboard never triggers it. ### Body - `endpoint` (string): The notification URL that failed. - `message` (string): `HTTP : `, or the connection error. - `code` (integer): The HTTP status your server answered, or the transport error code (`0` for most connection failures). - `job_id` (string | null): RETM's id for the delivery job. Quote it when asking support about a delivery. - `timestamp` (integer): Unix time, in seconds, of the original event. ```json { "endpoint": "https://partner.example.com/retm/invoice", "message": "HTTP 500: {\"error\":\"internal\"}", "code": 500, "job_id": "9f2a41c6-7d3e-4b1a-9c55-0e8f6a2b7d10", "timestamp": 1795004324 } ``` Index of every page: https://api.retm.sa/llms.txt --- # Enumerations > RETM Partner API v2 (current) · Reference · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/enums The fixed sets of values that appear in requests, responses and webhooks. ## Order status | Value | Meaning | | --- | --- | | `under_review` | Pushed, waiting for the merchant. | | `processing` | Accepted and being prepared. | | `ready` | Prepared. | | `done` | Handed over. Final. | | `rejected` | Refused by the merchant. Final. | | `cancelled` | Withdrawn by the app. Final. | ## Invoice status | Value | Meaning | | --- | --- | | `0` | Handling | | `1` | Closed | | `2` | Pending | | `3` | Active | | `4` | Return | | `5` | Void | ## Product type | Value | Meaning | | --- | --- | | `1` | Normal | | `2` | With modifiers | | `3` | Combo | | `4` | With variations | ## Tax type | Value | Meaning | | --- | --- | | `1` | Fixed amount | | `2` | Percentage | ## Payment method type | Value | Meaning | | --- | --- | | `1` | Cash | | `2` | Card | | `4` | Gift card | | `5` | Credit | | `3`, `6`, `7` | Accepted on create; reserved. | ## Record status On categories, products, devices and customers, `status` is `1` for active and `0` for inactive. Index of every page: https://api.retm.sa/llms.txt --- # Changelog > RETM Partner API v2 (current) · Reference · updated 2026-11-21 > Web page: https://api.retm.sa/#/v2/changelog Every change to this version's contracts, newest first. Breaking changes are marked. - **2026-11-21 · breaking:** Disabled group products and child groups report `0`. In [Get a group](https://api.retm.sa/llms/v2/groups.txt), a product the group disables now has `status: 0`, and a child group the parent disables has `status: 0`. Both used to report as enabled (the product's own status, or `true`). Enabled ones are unchanged. - **2026-11-20 · changed:** You can only cancel your own orders. [Cancel an order](https://api.retm.sa/llms/v2/orders.txt) now answers `404` for an order your app did not create, instead of cancelling it. Cancelling your own orders is unchanged. - **2026-11-18 · breaking:** Combos are ordered and sold as their items. A combo is no longer one priced line. Each option now has its own price in the combo (`original_price`, `discount_applied`, `price`) and its own `taxes`; a group's `is_optional` is a boolean; `upcharge` is gone. On [Create an order](https://api.retm.sa/llms/v2/orders.txt), send one ordinary line per picked product tagged `combo: {id, group, key}` instead of a combo line with `components`; a line whose `id` is a combo is refused. Order lines are read back with a `combo` object instead of `components`, and invoices list the picked items as ordinary lines. - **2026-11-18 · added:** Signed webhooks. Every webhook now carries an `X-Retm-Signature` header: the HMAC-SHA256 of the raw body, keyed with your client secret. Bodies are unchanged. See [Verifying a webhook](https://api.retm.sa/llms/v2/webhooks.txt). - **2026-11-07 · added:** Combos. Products of type `3` now appear in the catalogue with a `combo` object, can be ordered with `components` on [Create an order](https://api.retm.sa/llms/v2/orders.txt), and are read back with `components` on each order line. The `menu` webhook reports a combo as a product and sends `changes: {"groups": true}` when its structure changes. An integration that ignores the `combo` key still sees a combo as a product with a price. - **2026-10-06 · breaking:** Invoice list paging. [List invoices](https://api.retm.sa/llms/v2/invoices.txt) no longer returns `total`, `from`, `to`, `path` or `current`. Its `pagination` is now `per`, `current_page`, `has_more`, `next_page_url` and `prev_page_url`, and the list is ordered by `invoice_id` descending instead of by creation time. Page until `has_more` is `false`; there is no replacement for `total`. - **2026-09-22 · added:** Safe order retries. [Create an order](https://api.retm.sa/llms/v2/orders.txt) accepts `partner_reference`. A repeated reference is refused with `409` instead of creating a second order. - **2026-09-14 · changed:** Webhook bodies no longer carry `resource`. The `resource` key, which echoed your previous response back to you, was removed from every webhook body, together with the `save_response` option in the developer portal. Merchants can now see each delivery and replay it from their dashboard. Index of every page: https://api.retm.sa/llms.txt --- # Schemas The objects the pages above refer to by name. ## Localized - `ar` (string | null): Arabic text. - `en` (string | null): English text. ## Category - `id` (string): The category identifier. - `name` (Localized): The category name. - `status` (integer): `1` active, `0` inactive. - `products` (array of Product): The category's orderable products. Present on the menu and on a single category only. ## Group - `id` (string): The group identifier. - `name` (Localized): The group name. - `image` (string | null): Image URL. - `icon` (string | null): Icon name. - `status` (integer | boolean): `true` on a group read on its own or listed at the top level. On a child group (in `groups`), the parent group's setting for it: `1` enabled, `0` disabled. - `groups` (array of Group): Child groups. Present on a single group only. - `products` (array of Product): The group's orderable products, with the group's price and status overrides applied. Present on a single group only. ## Product - `id` (string): The product identifier. - `name` (Localized): The product name. - `description` (Localized): The product description. - `image` (string | null): The image file reference. - `price` (decimal string | null): The base price, from the price list when `price_list_id` is sent and the product has a price in it. `null` when the product has variations. - `calories` (number | null): Calories, when the merchant recorded them. - `estimated_time` (number | null): Preparation time in minutes. - `type` (integer): `1` normal, `2` with modifiers, `3` combo, `4` with variations. - `status` (integer): `1` active, `0` inactive. - `modifiers` (array of ModifierGroup): The modifier groups of the product. Always empty on a combo. - `variations` (array of Variation): The active variations, in display order. - `category` (object): The category the product belongs to. - `id` (string): The category identifier. - `title` (Localized): The category name. - `taxes` (array of ProductTax): The product's active taxes. When it has none, the merchant's default tax. - `combo` (Combo | null): The combo definition. `null` unless `type` is `3`. ## ModifierGroup - `id` (string): The modifier group identifier. - `name` (Localized): The group name, such as Extras. - `multiple` (integer): Whether more than one item may be chosen. - `min_selection` (integer): Fewest items the customer must choose. - `max_selection` (integer): Most items the customer may choose. - `items` (array): The choosable items. - `id` (string): The modifier item identifier. Send it in an order line's `modifiers[].id`. - `name` (Localized): The item name. - `max_selection` (integer | null): Most units of this one item. - `extra_price` (decimal string): The price the item adds. ## Variation - `id` (string): The variation identifier. Send it as an order line's `variant`. - `sku` (string | null): Stock keeping unit. - `name` (Localized): The variation name, such as Large. - `price` (decimal string): The variation's price, from the price list when it has one. - `image` (string | null): The image file reference. ## ProductTax - `id` (string): The tax identifier. Send it in an order line's `taxes[].id`. - `name` (Localized): The tax name. - `value` (decimal string): The rate or the fixed amount, by `type`. - `type` (integer): `1` fixed amount, `2` percentage. - `from_final_total` (integer): `1` when the tax is computed on the final total. ## Combo - `include_modifier_prices` (boolean): `true`: modifiers chosen on the options are free. Charge nothing for them and send `amount: 0`. - `groups` (array): The groups of the combo, in order. A group with no available option is left out. - `id` (string): The group identifier. Send it as `combo.group`. - `name` (Localized): The group name. - `is_optional` (boolean): `false`: one pick is required. `true`: the group may be skipped. - `sort` (integer): Display order. - `items` (array): The options that can be picked right now. Never empty. - `id` (string): The option's product identifier. Send it as the order line's `id`. - `sku` (string | null): Stock keeping unit. - `type` (integer): `1` normal or `2` with modifiers. - `name` (Localized): The option name. - `image` (string | null): The image file reference. - `original_price` (decimal string): The product's base price on its own. No price list applies inside a combo. - `discount_applied` (decimal string): What the combo takes off one unit of the option. - `price` (number): The option's price in this combo: `original_price` minus `discount_applied`, never below `0`. - `sort` (integer): Display order. - `taxes` (array of Tax): The option's own taxes. They tax its order line. - `modifiers` (array of ModifierGroup): The option's own modifier groups. ## PriceList - `id` (string): The price list identifier. - `name` (Localized): The price list name. ## Branch - `uuid` (string): The branch identifier. Send it as an order's `branch`. - `code` (string | null): The merchant's own code for the branch. - `refrence` (integer | null): The branch's running bill counter. Note the spelling. - `name` (Localized): The branch name. - `open_time` (string | null): Opening time. - `close_time` (string | null): Closing time. - `longitude` (string | null): Longitude. - `latitude` (string | null): Latitude. - `order_radius` (number | null): The radius the branch accepts orders from. ## Device - `uuid` (string): The device identifier. - `name` (Localized): The device name. - `status` (integer): `1` active, `0` inactive. - `created_at` (timestamp): When the device was registered. - `branch` (string | null): The `uuid` of the branch the device belongs to. ## OrderType - `uuid` (string): The order type identifier. Send it as an order's `ordertype`. - `name` (Localized): The order type name. - `is_credit` (integer): `1` when orders of this type are sold on credit. - `is_flowable` (integer | boolean): Whether orders of this type move through the kitchen flow. ## PaymentMethod - `uuid` (string): The payment method identifier. Send it in an order's `payments[].id`. - `name` (Localized): The payment method name. - `type` (string | integer): The kind of payment. See [Payment method type](https://api.retm.sa/llms/v2/enums.txt). - `ecr_enabled` (integer | boolean): Whether the method drives a connected card terminal. - `auto_open_drawer` (integer | boolean | null): Whether taking this payment opens the cash drawer. ## Tax - `uuid` (string): The tax identifier. - `name` (Localized): The tax name. - `type` (integer): `1` fixed amount, `2` percentage. - `value` (decimal string): The rate or the fixed amount, by `type`. - `price_include_tax` (integer | null): `1` when the merchant's prices already include this tax. ## Charge - `uuid` (string): The charge identifier. Send it as an order's `charges.id`. - `name` (Localized): The charge name. - `value` (decimal string): The default amount of the charge. - `tax` (Tax): The tax applied to the charge. Present only when the charge is taxed. ## Customer - `id` (integer): The numeric customer id. - `uuid` (string): The customer identifier used in paths. - `name` (Localized): The customer name. - `phone` (string): The phone number. - `status` (integer): `1` active, `0` inactive. - `created_at` (timestamp): When the customer was created. ## Order - `id` (string): The order identifier. - `order_reference` (integer): RETM's number for the order. - `partner_reference` (string | null): The reference you sent. - `total` (decimal string): Order total. - `subtotal` (decimal string): Order amount before tax. - `tax` (decimal string): Order tax total. - `taxes` (array): The order's taxes: its lines' taxes grouped by tax. - `id` (string): The tax identifier. - `name` (Localized): The tax name. - `value` (decimal string): The tax rate or fixed amount. - `amount` (decimal string): The tax amount on this order. - `payments` (array): The payments recorded on the order. - `id` (string): The payment method identifier. - `name` (Localized): The payment method name. - `amount` (decimal string): The amount paid with it. - `status` (string): The order status. See [Order status](https://api.retm.sa/llms/v2/enums.txt). - `rate` (number | null): The customer's rating of the order, when given. - `note` (string | null): The order note. - `meta` (object): Extra data stored with the order, such as `source` and `auto_accept`. - `estimated_time` (timestamp | null): When the order is expected to be ready. `null` until the order is accepted. - `created_at` (timestamp): When the order was pushed. - `updated_at` (timestamp): When the order last changed. - `products` (array of OrderLine): The order lines. - `charges` (object): The order charge. - `id` (integer | null): An internal number for the charge. Not the charge `uuid`. - `name` (Localized | null): The charge name. - `value` (decimal string): The charge amount. - `coupon` (object): The order discount. - `code` (string | null): The coupon code. - `amount` (decimal string): The discount amount. - `order_type` (object): The order type. - `id` (string | null): The order type identifier. - `name` (Localized | null): The order type name. - `branch` (object): The branch the order was pushed to. - `id` (string): The branch identifier. - `name` (Localized): The branch name. - `customer` (object): The customer. - `id` (string): The customer `uuid`. - `name` (Localized): The customer name. - `phone` (string): The phone number. ## OrderLine - `id` (string): The product identifier. - `name` (Localized): The product name. - `variant` (object): The chosen variation. Both keys are `null` when there is none. - `id` (string | null): The variation identifier. - `name` (Localized | null): The variation name. - `modifiers` (array): The chosen modifier items. - `id` (string): The modifier item identifier. - `title` (Localized): The modifier group name. - `name` (Localized): The modifier item name. - `quantity` (decimal string): Units chosen. - `amount` (decimal string): The amount you sent for it. - `total` (decimal string): Line total. - `subtotal` (decimal string): Line amount before tax. - `tax` (decimal string): Line tax amount. - `taxes` (array): The line's taxes, as `{id, name, value, amount}`. - `discount` (decimal string): Line discount amount. - `quantity` (decimal string): Line quantity. - `note` (string | null): The line note. - `combo` (object | null): The combo the line was ordered under. `null` on a line that is not part of a combo. - `id` (string): The combo's product identifier. - `name` (Localized): The combo name. - `key` (integer): The combo's number inside the order. Lines sharing `id` and `key` are one ordered combo. - `group` (object): The group the product was picked from, as `{id, name}`. ## Invoice - `event` (string): `order.created` for a sale, `order.refunded` for a refund. - `event_type` (string): `create.order` for a sale, `update.items` for a refund. - `invoice_id` (integer): The invoice number. Unique per merchant; use it to de-duplicate. - `order_refrence` (integer): The sale reference, as a number. Note the spelling. - `order_reference` (string): The same sale reference, as a string. - `sale_id` (integer | null): On a refund, the invoice it refunds. - `branch_id` (string | null): The branch `uuid`. - `device_id` (string | null): The device `uuid`. - `created_at` (datetime): The invoice date, `YYYY-MM-DD HH:MM:SS`. Merchant time in the list; UTC in the webhook. - `total_price` (decimal string): Invoice total. - `subtotal_price` (decimal string): Invoice amount before tax. - `tax` (decimal string): Invoice tax total. - `status` (integer): See [Invoice status](https://api.retm.sa/llms/v2/enums.txt). - `note` (string | null): The invoice note. - `taxes` (array): The invoice's taxes. - `id` (string): The tax identifier. - `name` (Localized): The tax name. - `amount` (decimal string): The tax amount on this invoice. - `payments` (array): How the invoice was paid. - `id` (string): The payment method identifier. - `name` (Localized): The payment method name. - `amount` (decimal string): The amount paid with it. - `products` (array): The invoice lines. A sold combo appears as its picked items, each an ordinary line. - `id` (string): The product identifier. - `sku` (string | null): Stock keeping unit. - `name` (Localized): The product name. - `quantity` (decimal string): Line quantity. - `total` (decimal string): Line total. - `subtotal` (decimal string): Line amount before tax. - `unit_price` (number): `subtotal` divided by `quantity`. A JSON number, not a string. - `discount_amount` (decimal string): Line discount amount. - `tax` (decimal string): Line tax amount. - `note` (string | null): The line note. - `category` (object): The product's category, as `{id, name}`. - `variation` (object): The sold variation, as `{id, name}`. Both `null` when there is none. - `modifiers` (array): The sold modifier items. - `id` (string): The modifier item identifier. - `name` (Localized): The modifier item name. - `quantity` (decimal string): Units sold. - `price` (decimal string): The amount charged for it. - `customer` (object): The customer. Every key is `null` for a walk-in sale. - `id` (string | null): The customer `uuid`. - `name` (Localized | null): The customer name. - `phone` (string | null): The phone number. - `email` (string | null): The email address. - `discount` (object): The invoice discount. - `id` (string | null): The discount code. - `amount` (decimal string): The discount amount. - `order_charge` (object): The invoice charge. - `id` (string | null): The charge `uuid`. - `amount` (decimal string): The charge amount. - `order_type` (object): The order type, as `{id, name}`. - `meta` (object): Links to other records. - `order_reference` (integer | null): When the invoice came from a pushed order, that order's `order_reference`. Set in the webhook; `null` in the list.