Skip to content

Replace a price rule

PUT
/price-rules/{id}
curl --request PUT \
--url https://example.com/price-rules/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f \
--header 'Content-Type: application/json' \
--cookie bottle.session_token=<bottle.session_token> \
--data '{ "name": null, "audience": "consumer", "customerId": null, "rateSetId": null, "scope": "product", "productId": null, "gasTypeId": null, "categoryId": null, "counting": "stepped", "steps": [ { "kind": "percent_off", "fromQuantity": 1, "percent": 1 } ], "active": true }'

The whole rule, as when adding one. Orders already taken keep their prices.

id
required

UUID v7

string format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f

UUID v7

Media typeapplication/json
object
name
string | null
<= 120 characters
audience
required

Consumer: everybody who is not a trade customer, signed in or not. trade: trade customers. rate_set: the members of one rate set, named by rateSetId. customer: one customer, named by customerId.

string
Allowed values: consumer trade rate_set customer
customerId

UUID v7

string | null format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f
rateSetId

UUID v7

string | null format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f
scope
required

What the rule covers: one product (productId), every size of a gas type (gasTypeId), a shop category (categoryId), or everything sold. Never deposits, rent or delivery.

string
Allowed values: product gas_type category all
productId

UUID v7

string | null format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f
gasTypeId

UUID v7

string | null format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f
categoryId

UUID v7

string | null format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f
counting
required

Stepped: each step prices only the units within it (“first 5 at £38, next 5 at £36, then £34.20”). bulk: the highest step reached prices every unit (“10 or more and all of them are £34.20”).

string
Allowed values: stepped bulk
steps
required
Array
>= 1 items <= 10 items
One of:
object
kind
required
string
Allowed values: percent_off
fromQuantity
required
integer
>= 1 <= 100000
percent
required
number
<= 100
active
boolean
default: true

Replaced

Media typeapplication/json
object
name
required
string | null
<= 120 characters
audience
required

Consumer: everybody who is not a trade customer, signed in or not. trade: trade customers. rate_set: the members of one rate set, named by rateSetId. customer: one customer, named by customerId.

string
Allowed values: consumer trade rate_set customer
customerId
required

UUID v7

string | null format: uuid
rateSetId
required

UUID v7

string | null format: uuid
scope
required

What the rule covers: one product (productId), every size of a gas type (gasTypeId), a shop category (categoryId), or everything sold. Never deposits, rent or delivery.

string
Allowed values: product gas_type category all
productId
required

UUID v7

string | null format: uuid
gasTypeId
required

UUID v7

string | null format: uuid
categoryId
required

UUID v7

string | null format: uuid
counting
required

Stepped: each step prices only the units within it (“first 5 at £38, next 5 at £36, then £34.20”). bulk: the highest step reached prices every unit (“10 or more and all of them are £34.20”).

string
Allowed values: stepped bulk
steps
required
Array
>= 1 items <= 10 items
One of:
object
kind
required
string
Allowed values: percent_off
fromQuantity
required
integer
>= 1 <= 100000
percent
required
number
<= 100
active
required
boolean
id
required

UUID v7

string format: uuid
createdAt
required
string format: date-time
updatedAt
required
string format: date-time
Example
{
"audience": "consumer",
"customerId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"rateSetId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"scope": "product",
"productId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"gasTypeId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"categoryId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"counting": "stepped",
"steps": [
{
"kind": "percent_off"
}
],
"id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f"
}

Not signed in

Media typeapplication/json
object
error
required
string
message
required
string
Example
{
"error": "not_found",
"message": "Customer not found"
}

Not a member, or without the permission this needs

Media typeapplication/json
object
error
required
string
message
required
string
Example
{
"error": "not_found",
"message": "Customer not found"
}

No such price rule

Media typeapplication/json
object
error
required
string
message
required
string
Example
{
"error": "not_found",
"message": "Customer not found"
}

Validation failed (validation), or the customer, product, gas type or category named is not this business’s (unknown_target, with the field)

Media typeapplication/json
object
error
required
string
Allowed values: unknown_target
message
required
string
field
required
string
Allowed values: customerId rateSetId productId gasTypeId categoryId
Example
{
"error": "unknown_target",
"field": "customerId"
}