Create Ingredient
Create a new ingredient with its initial branch stock.
Authorization
API-TOKEN Your partner API key. Send it in the API-TOKEN header on every request.
In: header
Header Parameters
API contract version to target. See the Changelog for what changed in each version.
"2.0.0""2.3.0" | "2.2.0" | "2.1.0" | "2.0.0"Request Body
application/json
Must match an existing stored value.
Must match an existing stored value.
Must not be greater than 191 characters.
Must not be greater than 191 characters.
Must not be greater than 191 characters.
Must not be greater than 191 characters.
Must be at least 0.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.flavours.sa/dev/api/v2/ingredients" \ -H "X-API-Version: 2.3.0" \ -H "Content-Type: application/json" \ -d '{ "market_id": "nesciunt", "branch_id": "repellat", "name_en": "fhyroaz", "source_unit": "qqwxnszgbvvbvxo", "target_unit": "bujdzejoendlteovqgsupzpd", "source_rate": 2.2646176, "target_rate": 233.775 }'{
"meta": {
"code": 200,
"status": "success",
"message": "Ingredient created successfully."
},
"data": {
"id": "e5b9894d-ceac-4379-9e19-dd671a076979",
"name_en": "Premium Olive Oil",
"name_ar": "زيت زيتون فاخر",
"deleted_at": null,
"market_id": "eef0da10-dd19-4a4c-ab3d-23dd1b548801",
"source_unit": "box",
"target_unit": "l",
"source_rate": "1.00",
"target_rate": "12.00",
"minimum": "5.00",
"created_at": 1792593338879,
"updated_at": 1792593338879,
"maximum": "100.00"
}
}{
"meta": {
"code": 401,
"status": "error",
"message": "Unauthenticated."
},
"data": null
}{
"meta": {
"code": 403,
"status": "error",
"message": "Unauthorized."
},
"data": null
}{
"meta": {
"code": 404,
"status": "error",
"message": "Resource not found."
},
"data": null
}{
"meta": {
"code": 422,
"status": "error",
"message": "The selected market id is invalid. (and 6 more errors)"
},
"data": [
{
"code": 0,
"message": "The selected market is invalid.",
"field": "market"
},
{
"code": 0,
"message": "The selected branch is invalid.",
"field": "branch"
},
{
"code": 0,
"message": "The Name (English) field is required.",
"field": "name_en"
},
{
"code": 0,
"message": "The Storage Unit field is required.",
"field": "source_unit"
},
{
"code": 0,
"message": "The Recipe Unit field is required.",
"field": "target_unit"
},
{
"code": 0,
"message": "The Storage Unit Factor must be greater than 0.",
"field": "source_rate"
},
{
"code": 0,
"message": "The Recipe Unit Factor must be greater than 0.",
"field": "target_rate"
}
]
}{
"meta": {
"code": 500,
"status": "error",
"message": "Internal server error."
},
"data": null
}Order List GET
Orders of the caller's market and branch, paginated, with the standard `sort`, `key_by`, `includes[]` and `filter.*` parameters. Rows that tie on the `sort` key (or on `created_at`, newest first, when no `sort` is sent) are ordered by `id` in the same direction, so consecutive pages never repeat or skip an order. Every row carries `workday` (the business day the order was stamped with, `YYYY-MM-DD` in the branch timezone; additive, at every `X-API-Version`). **Workday range (FP-1083):** `filter.workday_min` / `filter.workday_max` (`Y-m-d`, inclusive, at most 366 dates) are sent **together with** `filter.created_at_min/max` (or the legacy `created_at_after/before`). With `WORKDAY_ENABLED` on, a branch whose workday switch is ON is then bounded by `orders.workday` (an order rung up after midnight or in overtime belongs to the workday it was taken in) and OFF branches keep the epochs; the response adds `meta.workday` (per-branch period, orders/sales and per-workday rows: the `/v2/reports/overview` block). The live list (`filter.start_at` + `filter.close_at`) and `filter.period_type` / `time_period` win over the range and ignore the workday dates. Without the workday params the response is unchanged. `filter.attendance_id` matches the orders of a shift: on a workday branch by the shift's `workday` (so overtime orders stay with their shift), otherwise by the shift's start and close times.
Decrease Ingredient Stock POST
Decrease the stock of an ingredient for a branch and record the history.