pos-search-products
Method: POST
Path: /pos/catalog/products/search
Tags: Products
Summary
Search products
Description
Search for products matching a specific words or characters given.
Pos SDK Usage
SDK Method: pos.searchProducts()
Example:
typescript
// Basic search
const { data, error } = await pos.searchProducts({
query: "smartphone",
page: 1,
limit: 20
});
if (error) {
console.error("Failed to search products:", error.message);
} else {
console.log("Search results:", data.skus?.length || 0, "products found");
console.log("Facet distribution:", data.facet_distribution);
console.log("Facet stats:", data.facet_stats);
console.log("Pagination:", data.pagination);
data.skus?.forEach(sku => {
console.log(`Found: ${sku.product_name} - ${sku.pricing?.selling_price}`);
});
}
// With filter (string expression — Meilisearch syntax)
const { data: filtered, error: filteredError } = await pos.searchProducts({
query: "laptop",
filter: "pricing.selling_price 500 TO 2000 AND product_type = physical",
sort: ["pricing.selling_price:asc"],
facets: ["product_type", "categories.name", "tags"],
page: 1,
limit: 10
});
// With filter (array of conditions — combined with AND)
const { data: arrayFiltered, error: arrayError } = await pos.searchProducts({
query: "shoes",
filter: ["product_type = physical", "rating >= 4", "stock_available > 0"],
sort: ["rating:desc"],
facets: ["*"],
page: 1,
limit: 25
});
// With filter (nested arrays — inner arrays use OR, outer uses AND)
const { data: nestedFiltered, error: nestedError } = await pos.searchProducts({
query: "headphones",
filter: [
"pricing.selling_price 50 TO 300",
["product_type = physical", "product_type = bundle"]
],
page: 1,
limit: 25
});
// Override customer group ID for this specific request
const { data: overrideData, error: overrideError } = await pos.searchProducts(
{
query: "laptop",
filter: "categories.name = computers",
page: 1,
limit: 20
},
{
"x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
}
);TypeScript Definition
typescript
"pos-search-products": {
parameters: {
query?: never;
header?: {
/** @description This param is used to determine product pricing, promotions, and subscription rates. If a valid customer group id is provided, pricing details will be retrieved accordingly. If no matching data is found for the specified customer group id, the system will fall back to the default customer group id. If no data is found for the default group either, the highest applicable price will be returned. */
"x-customer-group-id"?: components["parameters"]["CustomerGroupId"];
};
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["SearchProduct"];
};
};
responses: {
/** @description Success response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
skus: components["schemas"]["ProductSearchItem"][];
facet_distribution: {
[key: string]: {
[key: string]: number;
};
};
facet_stats: {
[key: string]: {
min: number;
max: number;
};
};
pagination: components["schemas"]["Pagination"];
};
};
};
};
/** @description The request is invalid. */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
code?: string;
errors?: {
[key: string]: unknown;
} | string;
content?: {
[key: string]: unknown;
};
};
};
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["parameters"]["CustomerGroupId"] | CustomerGroupId |
components["schemas"]["SearchProduct"] | SearchProduct |
components["schemas"]["ProductSearchItem"] | ProductSearchItem |
components["schemas"]["Pagination"] | Pagination |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- x-customer-group-id (header): This param is used to determine product pricing, promotions, and subscription rates. If a valid customer group id is provided, pricing details will be retrieved accordingly. If no matching data is found for the specified customer group id, the system will fall back to the default customer group id. If no data is found for the default group either, the highest applicable price will be returned.
Request Body
Content Types: application/json
Responses
200
Success response
400
The request is invalid.
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
json
{
"operationId": "pos-search-products",
"summary": "Search products",
"description": "Search for products matching a specific words or characters given.",
"parameters": [
{
"$ref": "#/components/parameters/CustomerGroupId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SearchProduct"
},
"examples": {
"in-operator": {
"summary": "IN operator (string)",
"value": {
"query": "shoes",
"filter": "product_type IN [physical,bundle]"
}
},
"and-string": {
"summary": "AND via string",
"value": {
"query": "shoes",
"filter": "rating > 4 AND product_type = physical"
}
},
"or-string": {
"summary": "OR via string",
"value": {
"query": "shoes",
"filter": "product_type = physical OR product_type = bundle"
}
},
"and-array": {
"summary": "AND via array",
"value": {
"query": "shoes",
"filter": [
"rating > 4",
"product_type = physical"
]
}
},
"or-nested-array": {
"summary": "OR via nested array",
"value": {
"query": "shoes",
"filter": [
[
"product_type = physical",
"product_type = bundle"
]
]
}
},
"mixed-and-or": {
"summary": "AND + OR mixed",
"value": {
"query": "shoes",
"filter": [
"product_type = physical",
[
"product_type = bundle",
"rating > 4"
]
]
}
}
}
}
}
},
"responses": {
"200": {
"description": "Success response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"skus": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ProductSearchItem"
}
},
"facet_distribution": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
}
},
"facet_stats": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
}
},
"required": [
"min",
"max"
]
}
},
"pagination": {
"$ref": "#/components/schemas/Pagination"
}
},
"required": [
"skus",
"facet_distribution",
"facet_stats",
"pagination"
],
"type": "object"
}
},
"required": [
"message",
"success",
"content"
]
}
}
},
"links": {
"AddItemToCart": {
"operationId": "pos-update-cart",
"requestBody": {
"product_id": "$response.body#/content/skus/0/product_id",
"variant_id": "$response.body#/content/skus/0/variant_id"
},
"description": "Add a search result to a cart."
}
}
},
"400": {
"description": "The request is invalid.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"x-speakeasy-error-message": true
},
"success": {
"type": "boolean"
},
"code": {
"type": "string"
},
"errors": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "string"
}
]
},
"content": {
"additionalProperties": true,
"type": "object"
}
},
"required": [
"message",
"success"
]
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"externalDocs": {
"url": "https://llm-docs.commercengine.io/admin-pos/operations/pos-search-products"
},
"security": [
{
"Authorization": []
}
],
"tags": [
"Products"
],
"x-speakeasy-group": "pos",
"x-speakeasy-name-override": "searchProducts"
}Auto-generated from OpenAPI spec and TypeScript definitions