searchVariants
Requires at least one of the permissions inventory:stock_adjustment:create, inventory:stock_transfer:create, payments:invoice:create, products:product:list, products:product:read, purchase:debit_note:create, purchase:grn:create, purchase:purchase_order:create, purchase:purchase_order:update, sales:quote:create, sales:quote:update, sales:sales_invoice:create, sales:sales_order:create or sales:sales_order:update.
Searches variants across the catalog. Search text matches SKU, name, barcode and product name; other filters cover product, brand, categories, status, stock and price range. Needs the products read or list permission, or permission to create or edit a document or stock form that picks products.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query SearchVariants($filter: VariantFilterInput!) {
searchVariants(filter: $filter) {
total
variants {
id
QRCode
name
createdAt
attributes
barcode
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query SearchVariants($filter: VariantFilterInput!) {\n searchVariants(filter: $filter) {\n total\n variants {\n id\n QRCode\n name\n createdAt\n attributes\n barcode\n }\n }\n}",
"variables": {
"filter": {}
}
}
EOF
Variables:
{
"filter": {}
}
Response:
{
"data": {
"searchVariants": {
"total": 0,
"variants": [
{
"id": "id",
"QRCode": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"attributes": {},
"barcode": "string"
}
]
}
}
}
searchVariants(
filter: VariantFilterInput!
): VariantSearchResult!
Arguments
searchVariants.filter ● VariantFilterInput! non-null input
The search text and filters, with paging.
Type
VariantSearchResult object
A page of variant search results.