Measura API documentation · v1

Write fractional inventory

Adjust or replace Measura inventory using ordinary measured values such as 2.75 kg or 14.5 m.

Available operations

Measura coordinates Shopify integer inventory with its fractional inventory data. Submit the exact measured value and a compatible unit; do not calculate the Shopify and fractional portions yourself.

Scroll horizontally to see all columns.

OperationEndpointUse case
Adjust current inventoryPOST /api/v1/inventory/adjustmentsSales, returns, receiving stock, and inventory corrections.
Set final inventoryPUT /api/v1/inventory/levelsERP, warehouse, and scheduled inventory synchronization.

Shared requirements

  • A Measura public API key and an idempotency key are required.
  • Each request operates on one Shopify location.
  • Each request accepts up to 100 unique variants.
  • Location and variant IDs must be Shopify legacy numeric IDs, not GraphQL GIDs.
  • Variants must be configured for sell-by-measurement, eligible for Measura, and have tracked inventory at the requested location.
  • Measurement units must be compatible with each variant's configured measurement type.

Authentication and idempotency

Send a public API key as a bearer token. Keys have the form apik_<keyId>_<secret> and can be generated from the Measura Public API settings page.

Code example
Authorization: Bearer apik_example_secret
Content-Type: application/json
Idempotency-Key: warehouse-receipt-PO-1048

Generate a new Idempotency-Key for every logical inventory operation. Reuse that key when retrying the same operation so a network retry cannot apply the write twice.

  • Keys must be nonblank and may contain up to 255 characters after trimming.
  • Keys are scoped to the authenticated shop and retained for 24 hours.
  • During that period, never reuse a key with a different endpoint, location, variant, quantity, or unit.

Safe retries:

When a completed request is repeated with the same key and identical normalized request, Measura returns the saved response with the Idempotency-Replayed: true response header.
Code example
POST /api/v1/inventory/adjustments

Headers:
  Authorization: Bearer <api-key>
  Content-Type: application/json
  Idempotency-Key: <unique-operation-key>

Request body

Code example
{
  "locationId": "123456",
  "adjustments": [
    {
      "variantId": "111",
      "delta": {
        "value": 5.75,
        "unit": "kg"
      }
    },
    {
      "variantId": "222",
      "delta": {
        "value": -1.5,
        "unit": "m"
      }
    }
  ]
}

Note

Use an adjustment when the supplied value is a change from current inventory. A positive delta adds inventory; a negative delta removes it. This example adds 5.75 kg to variant 111 and removes 1.5 m from variant 222.

cURL example

Code example
curl --request POST "https://sell-by-weight-app.atomicpos.com/api/v1/inventory/adjustments" \
  --header "Authorization: Bearer apik_example_secret" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: warehouse-receipt-PO-1048" \
  --data '{
    "locationId": "123456",
    "adjustments": [
      {
        "variantId": "111",
        "delta": { "value": 5.75, "unit": "kg" }
      }
    ]
  }'
Code example
PUT /api/v1/inventory/levels

Headers:
  Authorization: Bearer <api-key>
  Content-Type: application/json
  Idempotency-Key: <unique-operation-key>

Request body

Code example
{
  "locationId": "123456",
  "levels": [
    {
      "variantId": "111",
      "quantity": {
        "value": 18.75,
        "unit": "kg"
      }
    },
    {
      "variantId": "222",
      "quantity": {
        "value": 0,
        "unit": "m"
      }
    }
  ]
}

Note

Use an absolute level when the supplied value is the final inventory that should remain. This example sets variant 111 to exactly 18.75 kg and variant 222 to zero. Absolute levels cannot be negative.

cURL example

Code example
curl --request PUT "https://sell-by-weight-app.atomicpos.com/api/v1/inventory/levels" \
  --header "Authorization: Bearer apik_example_secret" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: erp-stock-snapshot-2026-08-13T18:00:00Z" \
  --data '{
    "locationId": "123456",
    "levels": [
      {
        "variantId": "111",
        "quantity": { "value": 18.75, "unit": "kg" }
      }
    ]
  }'

Request fields

Scroll horizontally to see all columns.

FieldTypeDescription
locationIdstringRequired. Shopify legacy numeric location ID; numeric strings are recommended. Safe nonnegative integer numbers are also accepted.
adjustmentsarrayRequired for an adjustment request. One to 100 unique variant adjustments.
adjustments[].variantIdstringRequired. Shopify legacy numeric product variant ID; numeric strings are recommended. Safe nonnegative integer numbers are also accepted.
adjustments[].delta.valuenumberRequired. Finite positive, negative, or zero change; numeric strings are not accepted.
adjustments[].delta.unitstringRequired. A measurement unit compatible with the variant configuration.
levelsarrayRequired for an absolute-level request. One to 100 unique variant levels.
levels[].variantIdstringRequired. Shopify legacy numeric product variant ID; numeric strings are recommended. Safe nonnegative integer numbers are also accepted.
levels[].quantity.valuenumberRequired. Finite value greater than or equal to zero; numeric strings are not accepted.
levels[].quantity.unitstringRequired. A measurement unit compatible with the variant configuration.

Duplicate variants:

Variant IDs must be unique within a request. Measura rejects duplicate variants instead of processing them in request order. For idempotency comparison, reordering unique variants does not change the request; changing a unit label still changes the request.

Errors and retries

Scroll horizontally to see all columns.

StatusCodeMeaning
400bad_requestInvalid JSON, missing idempotency key, invalid numeric IDs or quantities, empty/oversized batch, or duplicate variants.
401 / 403 / 429unauthorized / forbidden / rate_limitedAuthentication, Public API entitlement, or rate-limit failure.
409inventory_update_in_progressAnother public inventory write owns this location. Honor Retry-After: 2 and retry the same request and key.
409idempotency_key_reusedThe key belongs to a different normalized inventory request.
422unprocessable_entityLocation or variant not found, inventory not tracked at this location, product not configured, variant excluded, or incompatible unit.
500internal_errorInventory update could not finish. Changes may already have applied; preserve the original request and key when investigating or retrying.

Inventory recovery:

An error does not promise rollback across Shopify inventory, fractional stock, and adjustment history. Never replace a failed adjustment with a new key simply to bypass an error. Repeated failures need reconciliation with support before another write.

These endpoints use their own 24-hour inventory receipts. They do not return the permanent operation IDs used by kit and order writes, and their receipts cannot be retrieved through the operation-status endpoint. Successful writes clear the shop's public API response cache and return Cache-Control: no-store.

Successful response

Measura returns the previous and resulting measured inventory in each variant's configured inventory unit. The returned unit can differ from the submitted unit when Measura performs a compatible conversion.

Code example
{
  "success": true,
  "data": {
    "operation": "adjustment",
    "locationId": "123456",
    "results": [
      {
        "variantId": "111",
        "status": "updated",
        "previousQuantity": {
          "value": 12.5,
          "unit": "kg"
        },
        "quantity": {
          "value": 18.25,
          "unit": "kg"
        }
      }
    ]
  },
  "error": null,
  "requestId": "4a402347-312f-4628-8c88-b24ee4ec3d86"
}

Scroll horizontally to see all columns.

FieldTypeDescription
successbooleanWhether the request completed successfully.
data.operationstringadjustment for POST adjustments; level for PUT levels.
data.locationIdstringThe Shopify legacy numeric location ID.
data.resultsarrayThe result for every submitted variant.
data.results[].variantIdstringThe Shopify legacy numeric variant ID.
data.results[].statusstringThe outcome for the variant, such as updated.
data.results[].previousQuantityobjectMeasured inventory before the write, in the configured inventory unit.
data.results[].quantityobjectMeasured inventory after the write, in the configured inventory unit.
errornullNull for a successful request.
requestIdstringRequest identifier to include when contacting support.

For the standard error envelope and status codes, see Error codes.