data-src=/_includes/saas-only.md

Inventory source nomination

The inventory source nomination endpoints are the admin equivalent of the storefront source-level inventory reservations GraphQL features in Adobe Commerce as a Cloud Service. Use these endpoints to read and set the inventory source that fulfills each cart item, and to check source-level and stock-level availability before you place an order.

These endpoints are designed for:

Availability reads and nomination-time checks are advisory and do not reserve inventory. Commerce runs the authoritative availability check when the order is placed. To learn how a nomination is copied to the order and reserved at the source, see Order lifecycle.

Authentication

All endpoints require an admin or integration bearer token. The admin user role or integration must have the role resource listed for each endpoint in the REST API reference.

Differences from the GraphQL features

The admin endpoints are built for operational use, so they do not apply the storefront restrictions of the sourceAvailability and stockAvailability GraphQL queries:

REST API reference

Method
URL
Description
Role resource
GET
/V1/carts/:cartId/nominated-sources
Retrieve the nominated source of each cart item
Magento_Cart::manage
PUT
/V1/carts/:cartId/nominated-sources
Set or clear the nominated source of one or more cart items
Magento_Cart::manage
GET
/V1/inventory/source-availability
Retrieve per-source availability of SKUs for a store
Magento_InventoryApi::source
GET
/V1/inventory/stock-availability
Retrieve the stock-level salable quantity of SKUs for a store
Magento_InventoryApi::stock
data-variant=info
data-slots=text
Commerce omits a field from the REST response when its value is null, so an omitted field is distinguishable from a value of 0.

Retrieve nominated sources

GET /V1/carts/:cartId/nominated-sources returns the current nomination state of every visible item in an active cart.

Response (200):

[
  {
    "item_id": 42,
    "sku": "24-MB01",
    "source_code": "warehouse_a",
    "nominated_source": {
      "source_code": "warehouse_a",
      "sku": "24-MB01",
      "available_qty": 25,
      "is_in_stock": true
    },
    "errors": []
  },
  {
    "item_id": 45,
    "sku": "24-MB02",
    "source_code": "warehouse_b",
    "errors": [
      {
        "code": "SOURCE_DISABLED",
        "message": "The inventory source \"warehouse_b\" is disabled."
      }
    ]
  }
]
Field
Type
Description
item_id
int
The ID of the cart item.
sku
string
The SKU of the cart item.
source_code
string
The stored nominated source code. Commerce keeps the code even when the nomination is no longer valid, so you can identify the problem and clear it. Omitted when the item has no nomination.
nominated_source
object
A live availability snapshot of the nominated source. Omitted when the item has no nomination, or when the source no longer exists or is disabled.
nominated_source.source_code
string
The nominated source code.
nominated_source.sku
string
The SKU that availability is reported for.
nominated_source.available_qty
float
The quantity available at the source. Omitted for a composite parent product whose own SKU holds no stock.
nominated_source.is_in_stock
boolean
Whether the SKU is in stock at the source.
errors
array
The reasons that the current nomination is no longer valid, each with a code and message. The code is UNKNOWN_SOURCE, SOURCE_DISABLED, or NOT_ENOUGH_QTY. Empty when the nomination is valid.

Set or clear nominated sources

PUT /V1/carts/:cartId/nominated-sources sets or clears the nominated source on one or more items in an active cart. Use GET /V1/carts/:cartId/items to find the item_id of each cart item.

Request body:

Wrap the list of items in a nominations object.

{
  "nominations": {
    "items": [
      {
        "item_id": 42,
        "source_code": "warehouse_a"
      },
      {
        "item_id": 43,
        "source_code": null
      },
      {
        "item_id": 44,
        "source_code": "store_nyc_001"
      }
    ]
  }
}
Field
Type
Description
Required
nominations.items
array
The nominations to set or clear. Accepts 1 to 100 items.
Yes
nominations.items[].item_id
int
The ID of a visible item in the cart.
Yes
nominations.items[].source_code
string
The code of the inventory source to nominate. To clear the existing nomination, omit this field or send null or an empty string.
No

Commerce validates that every item_id belongs to the cart before it writes anything. If any item is not in the cart, the request fails with a 404 response and no nominations change.

The endpoint supports partial success. Commerce saves each valid nomination and returns each invalid nomination in rejected_items with a 200 response. A cart supports one nominated source for each SKU.

Response (200):

The items array contains the nomination state of every cart item after the update, in the same format as Retrieve nominated sources.

{
  "items": [ <...> ],
  "rejected_items": [
    {
      "item_id": 44,
      "code": "NOT_ENOUGH_QTY",
      "message": "Not enough quantity available at the inventory source \"store_nyc_001\".",
      "requested_qty": 5,
      "available_qty": 2
    }
  ]
}

Each object in rejected_items contains the following fields:

Field
Type
Description
item_id
int
The ID of the cart item whose nomination was rejected.
code
string
The reason for the rejection. See the following table.
message
string
A human-readable description of the rejection.
requested_qty
float
The requested quantity. Returned only for NOT_ENOUGH_QTY.
available_qty
float
The quantity available at the source. Returned only for NOT_ENOUGH_QTY.

The code field returns one of the following values:

Code
Description
UNKNOWN_SOURCE
The source code does not exist.
SOURCE_DISABLED
The source exists, but it is disabled.
NOT_ENOUGH_QTY
The available quantity at the source is less than the quantity of the item.
SKU_SOURCE_CONFLICT
The same SKU is already nominated to a different source in this cart.

Retrieve source availability

GET /V1/inventory/source-availability returns the source-level availability of each requested SKU at the store's sources.

Source-level availability is the physical quantity net of source-level reservations. It does not account for stock-level reservations that cannot be attributed to a source, so it is not the purchasable quantity. Use stock availability to determine whether a SKU can be purchased.

Query parameters:

Parameter
Type
Description
Required
storeId
int
The ID of the store view whose sales-channel stock scopes the sources.
Yes
skus[]
string array
The SKUs to report. Accepts 1 to 100 values.
Yes
sourceCodes[]
string array
Restricts the report to these sources. Accepts up to 100 values. Sources that are not assigned to the stock of the store are ignored.
No
onlyInStock
boolean
When true, omits sources where the SKU is not in stock. Defaults to false.
No

The following example returns the availability of one SKU at two sources:

GET /V1/inventory/source-availability?storeId=1&skus[]=24-MB01&sourceCodes[]=warehouse_a&sourceCodes[]=store_nyc_001

Response (200):

The response contains one entry for each requested SKU, in request order.

[
  {
    "sku": "24-MB01",
    "sources": [
      {
        "source_code": "warehouse_a",
        "name": "Warehouse A",
        "is_pickup_location_active": false,
        "available_qty": 25,
        "is_in_stock": true
      },
      {
        "source_code": "store_nyc_001",
        "name": "NYC Flagship Store",
        "is_pickup_location_active": true,
        "available_qty": 0,
        "is_in_stock": false
      }
    ]
  }
]
Field
Type
Description
sku
string
The SKU.
sources[].source_code
string
The source code.
sources[].name
string
The source name.
sources[].is_pickup_location_active
boolean
Whether the source is an active in-store pickup location.
sources[].available_qty
float
The quantity available at the source.
sources[].is_in_stock
boolean
Whether the SKU is in stock at the source.

Retrieve stock availability

GET /V1/inventory/stock-availability returns the stock-level salable quantity and purchase eligibility of each requested SKU for the store's sales channel. It uses the same calculation that the cart enforces, including reservations, backorders, minimum and increment quantity rules, and composite products.

Query parameters:

Parameter
Type
Description
Required
storeId
int
The ID of the store view whose sales-channel stock is evaluated.
Yes
skus[]
string array
The SKUs to report. Accepts 1 to 100 values.
Yes

The following example returns the stock availability of two SKUs:

GET /V1/inventory/stock-availability?storeId=1&skus[]=24-MB01&skus[]=24-MB04

Response (200):

The response contains one entry for each requested SKU, in request order.

[
  {
    "sku": "24-MB01",
    "salable_qty": 12,
    "is_in_stock": true,
    "is_salable": true
  },
  {
    "sku": "24-MB04",
    "salable_qty": 0,
    "is_in_stock": false,
    "is_salable": false
  }
]
Field
Type
Description
sku
string
The SKU.
salable_qty
float
The stock-level salable quantity. Omitted when the SKU has no quantity of its own, such as a composite parent product.
is_in_stock
boolean
Whether the SKU is in stock.
is_salable
boolean
Whether the SKU can currently be purchased.
backorder_message
string
The backorder notice to show the customer. Omitted when there is no notice.

Error handling

Status code
Condition
Error message
400
The nominations.items list is empty
Required parameter "items" is missing or empty.
400
The nominations.items list contains more than 100 items
Parameter "items" may contain at most 100 entries.
400
An item_id is not a positive integer
Each entry of "items" requires a positive "item_id".
404
An item_id is not a visible item in the cart
Could not find cart item with id "<item_id>".
400
The storeId is 0 or negative
Parameter "storeId" must identify a store view.
400
The storeId does not exist
Store with id "<storeId>" does not exist.
400
The skus[] list is empty
Required parameter "skus" is missing or empty.
400
The skus[] list contains more than 100 values
Parameter "skus" may contain at most 100 entries.
400
The sourceCodes[] list contains more than 100 values
Parameter "sourceCodes" may contain at most 100 entries.

REST input validation also rejects a request that omits the required storeId or skus[] parameter with a 400 response.