Price List - API Documentation

Written By Huda

Last updated 5 months ago

Table of Contents

  1. Introduction

  2. Authentication

  3. Base URL

  4. 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:

  1. Log into WordPress Admin.

  2. Go to Users → Profile (your user).

  3. Scroll to Application Passwords.

  4. Enter a descriptive name and click Add New Application Password.

  5. 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

Field Name

Type

Description

Example

title

string

The name of the price list

"Summer Discount 2025"

aio_price_list_rules

object

Container for pricing rules

{ ... }

aio_price_list_rules Fields

Field Name

Type

Description

Possible Values

price_type

string

Defines pricing method

new_price, percentage_discount

bulk_price_enabled

string (0/1)

Enable bulk pricing

0, 1

"0" (disabled), "1" (enabled)

bulk_price_value

number/string

Bulk price value per item

numeric value

enable_individual_customers

string (0/1)

Restrict to specific customers

0, 1

"0" (disabled), "1" (enabled)

customers.toggle

string

Mode of customer selection

all, specific

"all" = all customers
"specific" = only selected customer IDs

customers.specific

array

List of WordPress user IDs [if toggle = “specific” ]

IDs

enable_user_roles

string (0/1)

Restrict by role

0, 1

user_roles.toggle

string

Mode of role selection

all, specific

user_roles.specific

array

List of WP role names

role names

enable_countries

string (0/1)

Restrict by country

0, 1

countries.toggle

string

Mode of country selection

all, specific

countries.specific

array

List of ISO 2-letter codes

codes

aio_new_price

object

Product-specific prices

productID: price

quantity_rules

object

Quantity-based discounts

productID: array

status

string

Defines the publication state of the price list rule at the time of creation or update

“publish” , “draft”


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": { ... } 
}

Field Reference

Field Name

Type

Description

Example

title

string

The name of the price list

"Summer Discount 2025"

aio_price_list_rules

object

Container for pricing rules

{ ... }

aio_price_list_rules Fields

Field Name

Type

Description

Possible Values

price_type

string

Defines pricing method

new_price, percentage_discount

bulk_price_enabled

string (0/1)

Enable bulk pricing

0, 1

"0" (disabled), "1" (enabled)

bulk_price_value

number/string

Bulk price value per item

numeric value

enable_individual_customers

string (0/1)

Restrict to specific customers

0, 1

"0" (disabled), "1" (enabled)

customers.toggle

string

Mode of customer selection

all, specific

"all" = all customers
"specific" = only selected customer IDs

customers.specific

array

List of WordPress user IDs [if toggle = “specific” ]

IDs

enable_user_roles

string (0/1)

Restrict by role

0, 1

user_roles.toggle

string

Mode of role selection

all, specific

user_roles.specific

array

List of WP role names

role names

enable_countries

string (0/1)

Restrict by country

0, 1

countries.toggle

string

Mode of country selection

all, specific

countries.specific

array

List of ISO 2-letter codes

codes

aio_new_price

object

Product-specific prices

productID: price

quantity_rules

object

Quantity-based discounts

productID: array

status

string

Defines the publication state of the price list rule at the time of creation or update

“publish” , “draft”