Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Global Pricing Settings API

Overview

Manages restaurant-level price increase/decrease limits. Each restaurant has 4 records representing all combinations of limit_action_type × limit_value_type:

#limit_action_typelimit_value_typeDescription
1increasepercentageMax % a price can increase
2increasefixedMax fixed amount a price can increase
3decreasepercentageMax % a price can decrease
4decreasefixedMax fixed amount a price can decrease

A limit_value of 0 means no limit (any adjustment is allowed).


Authentication

All endpoints require a valid OAuth Bearer token via the Authorization header.

Authorization: Bearer <access_token>

Restaurant Context

The restaurant is identified via one of:

MethodPriorityExample
X-Restaurant-Id headerHighestX-Restaurant-Id: rest_123
restaurant_id query paramMedium?restaurant_id=rest_123
Token’s default restaurantLowest (fallback)—

Endpoints

1. GET /api/partner/v1/global_pricing_setting

Retrieves all 4 global pricing settings for the current restaurant. Auto-creates default records (all limit_value = 0) if they don’t exist yet.

Request

GET /api/partner/v1/global_pricing_setting
Authorization: Bearer <access_token>
X-Restaurant-Id: rest_123

Response 200 OK

{
  "success": true,
  "message": "",
  "data": [
    {
      "id": 1,
      "restaurant_id": "rest_123",
      "limit_action_type": "increase",
      "limit_value_type": "percentage",
      "limit_value": "0.0",
      "created_at": "2026-02-17T09:00:00.000Z",
      "updated_at": "2026-02-17T09:00:00.000Z"
    },
    {
      "id": 2,
      "restaurant_id": "rest_123",
      "limit_action_type": "increase",
      "limit_value_type": "fixed",
      "limit_value": "0.0",
      "created_at": "2026-02-17T09:00:00.000Z",
      "updated_at": "2026-02-17T09:00:00.000Z"
    },
    {
      "id": 3,
      "restaurant_id": "rest_123",
      "limit_action_type": "decrease",
      "limit_value_type": "percentage",
      "limit_value": "0.0",
      "created_at": "2026-02-17T09:00:00.000Z",
      "updated_at": "2026-02-17T09:00:00.000Z"
    },
    {
      "id": 4,
      "restaurant_id": "rest_123",
      "limit_action_type": "decrease",
      "limit_value_type": "fixed",
      "limit_value": "0.0",
      "created_at": "2026-02-17T09:00:00.000Z",
      "updated_at": "2026-02-17T09:00:00.000Z"
    }
  ],
  "meta": {
    "api_version": "partner/v1"
  }
}

Error Responses

StatusCondition
401 UnauthorizedMissing or invalid Bearer token
400 Bad RequestNo restaurant context provided
403 ForbiddenToken doesn’t have access to the requested restaurant

2. PATCH /api/partner/v1/global_pricing_setting

Updates a specific setting identified by limit_action_type + limit_value_type. Creates the record if it doesn’t exist yet (upsert behavior).

Request

PATCH /api/partner/v1/global_pricing_setting
Authorization: Bearer <access_token>
X-Restaurant-Id: rest_123
Content-Type: application/json
{
  "global_pricing_setting": {
    "limit_action_type": "increase",
    "limit_value_type": "percentage",
    "limit_value": 25.0
  }
}

Parameters

ParameterTypeRequiredDescription
limit_action_typestringYes"increase" or "decrease" — identifies which setting to update
limit_value_typestringYes"percentage" or "fixed" — identifies which setting to update
limit_valuedecimalYesThe new limit value. Use 0 for no limit. Must be >= 0

Note: limit_action_type and limit_value_type are used to identify the record. Only limit_value is actually updated.

Response 200 OK

{
  "success": true,
  "message": "",
  "data": {
    "id": 1,
    "restaurant_id": "rest_123",
    "limit_action_type": "increase",
    "limit_value_type": "percentage",
    "limit_value": "25.0",
    "created_at": "2026-02-17T09:00:00.000Z",
    "updated_at": "2026-02-17T10:00:00.000Z"
  },
  "meta": {
    "api_version": "partner/v1"
  }
}

Error Responses

StatusConditionExample Response
401 UnauthorizedMissing or invalid Bearer token—
400 Bad RequestNo restaurant context provided—
403 ForbiddenToken doesn’t have access to the requested restaurant—
422 Unprocessable EntityInvalid or missing limit_action_type / limit_value_typeSee below
422 Unprocessable ContentValidation failed (e.g., negative limit_value)See below

Invalid type combination:

{
  "success": false,
  "message": "Both limit_action_type ('increase'/'decrease') and limit_value_type ('percentage'/'fixed') are required",
  "data": null
}

Validation error (negative value):

{
  "success": false,
  "message": "Validation failed",
  "data": null,
  "errors": ["Limit value must be greater than or equal to 0"],
  "details": {
    "limit_value": ["must be greater than or equal to 0"]
  }
}

Data Model

global_pricing_settings table

ColumnTypeConstraintsDescription
idbigintPKAuto-increment primary key
restaurant_idstringNOT NULLRestaurant identifier
limit_action_typestringNOT NULL"increase" or "decrease"
limit_value_typestringNOT NULL"percentage" or "fixed"
limit_valuedecimal(10,2)NOT NULL, DEFAULT 0Limit value (0 = no limit)
created_atdatetimeNOT NULLRecord creation timestamp
updated_atdatetimeNOT NULLLast update timestamp

Unique index: (restaurant_id, limit_action_type, limit_value_type)


Business Rules

  1. Auto-creation: GET automatically creates all 4 records for a restaurant if they don’t exist, with limit_value = 0 (no limit).
  2. No limit = 0: A limit_value of 0 means the limit is disabled — any price adjustment is allowed.
  3. Non-negative: limit_value must be >= 0. Negative values are rejected.
  4. Enforcement: These limits are checked when creating or updating pricing rules. A pricing rule that would exceed the configured limit will be rejected.
  5. 4 records per restaurant: Each restaurant always has exactly 4 records covering all combinations of action type and value type.