Measura API documentation · v1
Retrieve a specific variant by product ID and variant ID.
GET /api/v1/products/{productId}/variants/{variantId}
Headers:
Authorization: Bearer <api-key>
Content-Type: application/jsonScroll horizontally to see all columns.
| Parameter | Type | Description |
|---|---|---|
productId | string | Required - The Shopify product REST ID |
variantId | string | Required - The Shopify variant REST ID |
{
"success": true,
"data": {
"variant": {
"id": "456",
"isMeasuraEligible": true,
"fractionalInventory": { "123456": { "quantity": 0.25 } },
"unitMeasurement": {
"unit": "kg",
"value": 1
},
"settings": {
"onlineStore": {
"displayStyle": "number",
"rules": {
"min": 0.5,
"increment": 0.5,
"defaultValue": 1
}
}
},
"product": {
"id": "123",
"measurementType": "weight"
}
}
},
"error": null
}Scroll horizontally to see all columns.
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful |
data | object | Response data object |
error | null | Null for a successful request |
data.variant | Variant | The variant object |
Scroll horizontally to see all columns.
| Status code | Description |
|---|---|
| 400 | Bad Request - Missing product ID or variant ID |
| 401 | Unauthorized - Missing or invalid API key |
| 403 | Forbidden - Public API access is unavailable for this shop |
| 422 | Unprocessable Entity - Product is not configured for sell-by-measurement |
| 429 | Too Many Requests - API rate limit exceeded |
| 404 | Not Found - Variant not found, or variant doesn't belong to the specified product |
| 500 | Internal Server Error - Server error while processing the request |
Note
The variant must belong to the specified product, otherwise a 404 error will be returned. The response includes the parent product's ID and measurement type. An excluded variant is returned with isMeasuraEligible set to false. Responses are cached for five minutes; fractionalInventory contains fractional stock remainders rather than total measured inventory.
Related: