Price List - API Documentation
Written By Huda
Last updated 5 months ago
Table of Contents
Introduction
Authentication
Base URL
Endpoints
Get All Price Lists
Get Price List by ID
Create a Price List
Update a Price List
1. Introduction
The Price List APIs allows developers to create, retrieve, and manage custom price lists and pricing rules in WordPress. This API is useful for implementing wholesale pricing, role-based discounts, and country-specific pricing logic.
2. Authentication
Mechanism: Basic Authentication using a WordPress Application Password.
Header format:
Authorization: Basic <base64(username:application-password)> Example (cURL):
curl -X GET "https://<SITE>/wp-json/wp/v2/price_list_rule" \ -H "Authorization: Basic <base64(username:application-password)>" How to create an application password:
Log into WordPress Admin.
Go to Users → Profile (your user).
Scroll to Application Passwords.
Enter a descriptive name and click Add New Application Password.
Copy and securely store the generated password (shown once).
3. Base URL
Production Base URL:
https://<SITE>/wp-json/wp/v2/price_list_rule 4. Endpoints
4.1 Get All Price Lists
Description: Retrieves a list of all price lists existing in wp-admin.
API Endpoint: GET /wp-json/wp/v2/price_list_rule Response (200):
[ { "id": 101, "title": "Summer Discount 2025", "aio_price_list_rules": { ... } } ] 4.2 Get Price List by ID
Description: Retrieves a the details of a specific pricelist from wp-admin.
API Endpoint: GET /wp-json/wp/v2/price_list_rule/{id} Path Parameters:
id(integer, required): The ID of the price list.
Response (200):
{ "id": 101, "title": "Summer Discount 2025", "aio_price_list_rules": { ... } } 4.3 Create a New Price List
Description: Creates a new price list rule in WordPress Admin. The rule defines custom pricing that will be applied to specific user segments such as individual customers, user roles, companies, or countries.
API Endpoint: POST /wp-json/wp/v2/price_list_rule
Content-Type: application/json Body Example:
{
"title": "Wholesale New Prices",
"aio_price_list_rules":
{
"price_type": "new_price",
"bulk_price_enabled": "1",
"bulk_price_value": "400",
"enable_individual_customers": "1",
"customers":
{
"toggle": "specific",
"specific": ["14", "25"]
},
"enable_user_roles": "0",
"user_roles":
{
"toggle": "all",
"specific": []
},
"enable_countries": "1",
"countries": {
"toggle": "specific",
"specific": ["US", "GB"]
}, "aio_new_price":
{
"101": "250", "102": "300"
},
"quantity_rules":
{
"101": [
{
"break": "10", "discount": "20"}, {"break": "20", "discount": "30"
}
]
}
}
} Response (201 Created):
{ "id": 102, "title": "Wholesale New Prices", "aio_price_list_rules": { ... } } Field Reference
aio_price_list_rules Fields
4.4 Update a Price List
Description: Use this endpoint to update an existing price list rule in WordPress Admin. The request body follows the same structure as Create a Price List, allowing you to modify pricing details, customer or role assignments, and country-specific rules.
API endpoint: PUT /wp-json/wp/v2/price_list_rule/{id}
Content-Type: application/json Path Parameters:
id(integer, required): The ID of the price list to be updated.
Request Body
{
"title": "Wholesale New Prices",
"aio_price_list_rules":
{
"price_type": "new_price",
"bulk_price_enabled": "1",
"bulk_price_value": "400",
"enable_individual_customers": "1",
"customers": {
"toggle": "specific",
"specific": ["14", "25"]
},
"enable_user_roles": "0",
"user_roles":
{
"toggle": "all",
"specific": []
},
"enable_countries": "1",
"countries": {
"toggle": "specific",
"specific": ["US", "GB"]
},
"aio_new_price":
{
"101": "250", "102": "300"
},
"quantity_rules": {
"101": [ {
"break": "10", "discount": "20"
},
{
"break": "20", "discount": "30"
} ] } } }
Response (200 OK):
{
"id": 102,
"title": "title": {
"raw": "Wholesale New Prices",
"rendered": "Wholesale New Prices"
},
"aio_price_list_rules": { ... }
}