---
title: "POST /pricebooks/search"
method: POST
path: "/pricebooks/search"
tags: ["Pricebooks"]
---

# POST /pricebooks/search

`POST /pricebooks/search`

Search for pricebook items across multiple pricebooks

This endpoint allows you to search for products/items across one or more supplier pricebooks using a text-based search query. The search is performed across item names, product codes, and search values.

**Search Behavior:**
- Searches match when the search term appears anywhere within searchable fields (substring matching)
- Results are ranked by relevance (exact matches and word-start matches ranked higher)
- Pagination uses cursor-based navigation with encoded ranking information

**allSuppliers**

When `allSuppliers` is provided and set to `true`, it will override the list of `supplierIds` array.

For example the below payload will search across all suppliers for the term "hammer" and apply the pricing tier with id 123:

```
{
  "search": "hammer",
  "pricingTierId": 123,
  "allSuppliers": true,
  "supplierIds": [
    101,
    102,
    103
  ]
}
```

To narrow search by specific suppliers, set `allSuppliers` to `false` and provide a list of supplier IDs:

```
{
  "search": "hammer",
  "pricingTierId": 123,
  "allSuppliers": false,
  "supplierIds": [
    101,
    102,
    103
  ]
}
```

## Query parameters

- `pageSize` integer
- `sortOrder` union
  - 'asc'
  - 'desc'
- `pageCursor` string

## Request body

- PriceBookSearch
  - `search` string, required — Search term for pricebook items (minimum 3 characters). Searches across: - `name` - Product or item name - `productCode` - Product identification code - `supplierSku` - Supplier SKU/part number
  - `pricingTierId` number — Filter results to show prices for a specific pricing tier ID. If not provided, the default pricing tier will be used
  - `allSuppliers` boolean — When true (default), searches across all supplier pricebooks. When false, only searches pricebooks specified in supplierIds
  - `supplierIds` number[] — Array of supplier/pricebook IDs to limit the search scope. Only used when allSuppliers is false

## Response `200`

Successful Response

- SearchPricebooksResponse
  - `result` string, required
  - `data` PricebookSearchItem[], required
    - `id` number, required — Unique identifier for the pricebook item
    - `name` string, nullable, required — Product or item name
    - `productCode` string, nullable, required — Product identification code
    - `priceBookId` number, nullable, required — ID of the pricebook this item belongs to
    - `salesAccountId` number, nullable, required — Sales account ID associated with this item
    - `unitType` string, nullable, required — Unit of measure (e.g., 'each', 'm', 'kg')
    - `costPrice` number, required — Cost price of the item (price paid to supplier). Price shown is for the selected pricing tier or default tier
    - `retailPrice` number, required — Retail/selling price of the item. Price shown is for the selected pricing tier or default tier
    - `searchValues` string, nullable, required — Concatenated searchable values used for search ranking
    - `updatedAt` string, date-time, nullable, required — Timestamp of when the item was last updated
    - `supplierSku` string, nullable, required — Supplier's SKU or part number
    - `links` Links[], required
      - `href` string, required
      - `rel` string, required
      - `type` 'GET' | 'POST' | 'PUT' | 'PATCH', required
  - `paging` Pagination
    - `perPage` number, required
    - `pageCount` number, required
    - `links` object, required
      - `self` string, required
      - `previous` string, nullable, required
      - `next` string, nullable, required

## Other responses

- `4XX` — Client Request Errors
- `5XX` — Server Errors

---

[API](https://skmtc.dev/fergus/apis/fergus-api.md) · [All operations](https://skmtc.dev/fergus/apis/fergus-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fergus/fergus-api/revisions/b4f232a22363/schema)
