productVariant
Requires at least one of the permissions inventory:stock_adjustment:create, inventory:stock_transfer:create, payments:invoice:create, 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.
Returns one variant with its stock figures. Fails if the variant does not exist. Needs the products read 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 ProductVariant($id: ID!) {
productVariant(id: $id) {
id
QRCode
name
createdAt
attributes
barcode
baseUOM {
id
code
colorCode
name
pluralName
createdAt
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query ProductVariant($id: ID!) {\n productVariant(id: $id) {\n id\n QRCode\n name\n createdAt\n attributes\n barcode\n baseUOM {\n id\n code\n colorCode\n name\n pluralName\n createdAt\n }\n }\n}",
"variables": {
"id": "id"
}
}
EOF
Variables:
{
"id": "id"
}
Response:
{
"data": {
"productVariant": {
"id": "id",
"QRCode": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"attributes": {},
"barcode": "string",
"baseUOM": {
"id": "id",
"code": "string",
"colorCode": "string",
"name": "string",
"pluralName": "string",
"createdAt": "2025-01-15T00:00:00Z"
}
}
}
}
productVariant(
id: ID!
): ProductVariant!
Arguments
productVariant.id ● ID! non-null scalar
The ID of the variant.
Type
ProductVariant object
A sellable version of a product, with its own SKU, price, units of measure and stock.