Create Wholesale Pricing using APIs
Create a new Wholesale Pricing rule via the Public API, including the full request body reference.
This document explains how to create a new Wholesale Pricing rule using the Public API.
1. Endpoint
Section titled “1. Endpoint”To create a new Wholesale Pricing record, use the following endpoint:
POST - https://wholesale.samita.io/api/v1/wholesale-pricings2. Request Headers
Section titled “2. Request Headers”All API requests must include the following required headers:
| Header | Description | Required |
|---|---|---|
X-SAMITA-API-KEY |
API key provided in the Wholesale app | Yes |
X-SAMITA-SHOP-URL |
Shopify shop domain in format xxx.myshopify.com | Yes |
CONTENT-TYPE |
Must be application/json |
Yes |
If any required header is missing, the request will be rejected.
3. Request Body
Section titled “3. Request Body”a. General Format
Section titled “a. General Format”The data used to create Wholesale Pricing must be sent in JSON format.
A sample JSON structure is provided at the end of this document.
Sample Request JSON:
{ "title": "New Wholesale Pricing", "status": true, "apply_customer": { "type": "all", "tags": [] }, "exclude_customer": { "type": "none", "tags": [] }, "apply_product": { "type": "all", "product_ids": [], "product_tags": [], "collection_ids": [], "apply_for_variants": false }, "exclude_product": { "type": "none", "product_ids": [], "collection_ids": [] }, "discount_for_variants": [ { "id": 8516448190631, "variant_pricing": true, "variants": [ { "id": 46747346763943, "discount_groups": [ { "name": "all", "type": "percent", "value": "10" } ] } ] } ], "apply_market": { "type": "all", "handle": [] }, "discount_group": { "type": "percent", "value": "10" }, "active_date": { "types": ["start_date", "end_date"], "start_at": "2026-01-15 10:00:00", "end_at": "2026-01-15 10:00:00" }}b. title (Required)
Section titled “b. title (Required)”- The name used to identify the Wholesale Pricing record
- Must be a string
- Maximum length: 255 characters
c. status (Required)
Section titled “c. status (Required)”- Defines whether the record is active or not
- Accepts only the following values:
| Value | Description |
|---|---|
true |
Pricing rule is active |
false |
Pricing rule is inactive |
d. apply_customer (Required)
Section titled “d. apply_customer (Required)”Defines which customers are eligible for this pricing rule.
Structure:
"apply_customer": { "type": "all", "tags": []}type
Accepted values (only one of the following):
all– Apply to all customerslogged– Apply only to logged-in customersnon-logged– Apply only to guest customerscustomer-tags– Apply only to customers with specific tags
tags
- Required only when
type == customer-tags - Must be a comma-separated array
- Example:
["wholesale","b2b"]
If type is not customer-tags, this field can be ignored.
e. exclude_customer
Section titled “e. exclude_customer”Used to exclude specific customers from the pricing rule.
Structure:
"exclude_customer": { "type": "none", "tags": []}type
- Default value:
none - Accepted values:
| Value | Description |
|---|---|
none |
Do not exclude any customer |
customer-tags |
Exclude customers by tags |
tags
- Required only when
type == customer-tags - Comma-separated array
- Example:
["vip","wholesale"]
f. apply_product (Required)
Section titled “f. apply_product (Required)”Defines which products the pricing rule will be applied to.
Structure:
"apply_product": { "type": "all", "product_ids": [], "product_tags": [], "collection_ids": [], "apply_for_variants": false}type
Accepted values:
allproductscollectionsproduct-tags
product_ids
- Required only when
type == products - Comma-separated list of product IDs
- Example:
[1,2,3]
product_tags
- Required only when
type == product-tags - Example:
["tag1","tag2"]
collection_ids
- Required only when
type == collections - Example:
[1,2,3]
apply_for_variants
- Determines whether discounts can be configured per variant
- Accepted values:
trueorfalse - Default value:
false
g. exclude_product
Section titled “g. exclude_product”Defines products to be excluded from the rule.
Structure:
"exclude_product": { "type": "none", "product_ids": [], "collection_ids": []}type
- Default:
none - Accepted values:
| Value | Description |
|---|---|
none |
Do not exclude any product |
products |
Exclude specific products |
collections |
Exclude specific collections |
Other fields are required only depending on the selected type.
h. discount_for_variants
Section titled “h. discount_for_variants”Used when applying discounts per variant.
- Must be empty if
apply_product.apply_for_variants == false - Required when
apply_product.apply_for_variants == true
Example structure:
"discount_for_variants": [ { "id": 8516448190631, "variant_pricing": true, "variants": [ { "id": 46747346763943, "discount_groups": [ { "name": "all", "type": "percent", "value": "10" } ] } ] }]Structure:
- Array of products
- Each product contains:
id– Product IDvariant_pricing– Must betruevariants– Array of variants
Each variant includes:
id– Variant IDdiscount_groups– Array of discount settings
discount_groups rules
- If
apply_customer.typeisall,logged, ornon-logged:
→ Only one item is allowed in the array - If
apply_customer.type == customer-tags:
→ Multiple discount groups can be provided
Fields inside discount_groups:
| Field | Description |
|---|---|
name |
Must match customer type or customer tag |
type |
Discount type |
value |
Discount value |
Accepted discount types:
percentamountfixed-amount
Value rules:
- Must be a number greater than 0
- If type is
percent, value must be less than 100
i. apply_market (Required)
Section titled “i. apply_market (Required)”Defines which Shopify markets the rule applies to.
Structure:
"apply_market": { "type": "all", "handle": []}type
Accepted values:
allspecific-market
handle
- Required only when
type == specific-market - Comma-separated list of market handles
- Example:
["japan","us"]
To get Market handle, kindly do as follow:
- In Shopify Admin page, go to Markets section > Click on More actions > Choose Edit Market handles > Copy the handle showing there:


j. discount_group
Section titled “j. discount_group”Used when discount is not configured per variant.
Required when:
apply_product.typeis notproducts, ORapply_product.type == productsAND variants are not applied
Structure:
"discount_group": { "type": "percent", "value": "10"}Rules are the same as described above for discount types and values.
k. active_date
Section titled “k. active_date”Used to configure start and end time for the pricing rule.
Structure:
"active_date": { "types": ["start_date", "end_date"], "start_at": "2026-01-15 10:00:00", "end_at": "2026-01-15 10:00:00"}types
- Optional
- Accepted values:
start_date,end_date - Can include one or both, separated by comma
- Example:
["start_date","end_date"]
start_at
- Required if
typesincludesstart_date - Format:
YYYY-MM-DD HH:MM:SS
end_at
- Required if
typesincludesend_date - Format:
YYYY-MM-DD HH:MM:SS
4. API Response
Section titled “4. API Response”a. Error Responses
Section titled “a. Error Responses”401 – Unauthorized
Possible reasons:
- Missing shop URL
- Missing API key
- Invalid shop URL
- Invalid API key
- API key does not match the shop
403 – This action is unauthorized
- API key does not have Create permission
- Each API key can have: View, Create, Update, Delete permissions
- This API requires Create permission
- Also returned when a provided ID does not exist
429 – Too Many Requests
- Rate limit exceeded
- Maximum allowed:
| Limit | Value |
|---|---|
| Request frequency | 1 request per 5 minutes |
| Daily limit | 50 requests per day |
b. Success Response
Section titled “b. Success Response”200 – API Success
- Wholesale Pricing record created successfully
- Response returned in JSON format
{ "id": 1, "title": "New Wholesale Pricing", "status": true, "apply_customer": { "type": "all", "tags": [] }, "exclude_customer": { "type": "none", "tags": [] }, "apply_product": { "type": "all", "product_ids": [], "product_tags": [], "collection_ids": [], "apply_for_variants": false }, "exclude_product": { "type": "none", "product_ids": [], "collection_ids": [] }, "discount_for_variants": [ { "id": 8516448190631, "variant_pricing": true, "variants": [ { "id": 46747346763943, "discount_groups": [ { "name": "all", "type": "percent", "value": "10" } ] } ] } ], "apply_market": { "type": "all", "handle": [] }, "discount_group": { "type": "percent", "value": "10" }, "active_date": { "types": ["start_date", "end_date"], "start_at": "2026-01-15 10:00:00", "end_at": "2026-01-15 10:00:00" }, "created_at": "2026-01-15T10:00:00", "updated_at": "2026-01-15T10:00:00"}