Measura API documentation · v1

Get specific variant

Retrieve a specific variant by product ID and variant ID.

Code example
GET /api/v1/products/{productId}/variants/{variantId}

Headers:
  Authorization: Bearer <api-key>
  Content-Type: application/json

Path parameters

Scroll horizontally to see all columns.

ParameterTypeDescription
productIdstringRequired - The Shopify product REST ID
variantIdstringRequired - The Shopify variant REST ID

Response example (200 success)

Code example
{
  "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
}

Response fields

Scroll horizontally to see all columns.

FieldTypeDescription
successbooleanIndicates whether the request was successful
dataobjectResponse data object
errornullNull for a successful request
data.variantVariantThe variant object

Error responses

Scroll horizontally to see all columns.

Status codeDescription
400Bad Request - Missing product ID or variant ID
401Unauthorized - Missing or invalid API key
403Forbidden - Public API access is unavailable for this shop
422Unprocessable Entity - Product is not configured for sell-by-measurement
429Too Many Requests - API rate limit exceeded
404Not Found - Variant not found, or variant doesn't belong to the specified product
500Internal 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:

See the Variant object and Product object documentation for response structure details.