---
title: "Query stock and SKU allocations by location or SKU"
method: POST
path: "/api/inventory/stock/location/query"
tags: ["Inventory"]
---

# Query stock and SKU allocations by location or SKU

`POST /api/inventory/stock/location/query`

## Request

- Base URL: `https://api.desty.app`
- URL: `https://api.desty.app/api/inventory/stock/location/query`
- Auth: none declared. Required headers: `Authorization`

Provide at least one nonempty filter: `locationIds` or `skuNumbers`. When both are supplied, return their intersection. Both pagination fields are required.

Returns existing SKU-location associations only, including zero and negative stock; does not expand descendants.

## Headers

- `Authorization` string, required

## Request body

- object
  - `externalWarehouseId` string, required: External warehouse ID returned by POST /api/warehouse/list. Storage must be activated for this warehouse.
  - `locationIds` union[], nullable: Optional exact-location filter, at most 200 entries. IDs must identify storable locations in the selected warehouse, including Default Storage; Organizational locations are rejected. Does not expand descendants.
    - union: Storage location ID in the selected warehouse, including Default Storage.64-bit ID; send as a decimal string (recommended) or a number.
      - string
      - integer
  - `skuNumbers` string[], nullable: Optional SKU filter, at most 200 entries. Unmatched SKU codes produce no rows.
  - `pageNumber` integer, required: Required page number, starting from 1. No default.
  - `pageSize` integer, required: Required page size (1–200). No default.

## Response `200`

successful operation

- object
  - `code` string, required: Business result code: "0" on success; otherwise INVALID_PARAMETER, INVALID_TOKEN, LIMIT_REQUEST or SERVER_ERROR.
  - `msg` string, nullable: Result message; normally null on success.
  - `data` object, nullable
    - `pageNumber` integer, required: Required page number, starting from 1. No default.
    - `pageSize` integer, required: Required page size (1–200). No default.
    - `totalCount` integer, required: Number of matching SKU-location association rows before pagination. Returned as a number.
    - `totalPages` integer, required: Total number of result pages.
    - `results` object[], required: Existing SKU-location associations, including zero/negative stock, sorted by locationId then skuNumber ascending. Quantities use the SKU base unit; unmatched SKU codes yield no rows.
      - `locationId` string, required: Location ID. 64-bit ID returned as a decimal string.
      - `path` string, required: Warehouse name followed by the full location path, separated by ' / ' (space, slash, space), e.g. "Gudang A / Zone 1 / Bin 01".
      - `isUnassigned` boolean, required: True for Default Storage.
      - `skuNumber` string, nullable: Master SKU code.
      - `productName` string, nullable: Product name.
      - `productId` string, required: Internal Master SKU/product ID. 64-bit ID returned as a decimal string.
      - `onHand` number, required: On-hand quantity in the SKU base unit. Decimal number; the number of decimal places varies (e.g. 0, 2, 4.0, 0.000000), so parse it as a decimal.
      - `reserved` number, required: Reserved quantity in the SKU base unit. Decimal number; the number of decimal places varies (e.g. 0, 2, 4.0, 0.000000), so parse it as a decimal.
      - `locationFree` number, required: onHand minus reserved. Warehouse buffer and promotion stock are not deducted. Decimal number; the number of decimal places varies (e.g. 0, 2, 4.0, 0.000000), so parse it as a decimal.
      - `stockToMarketplace` boolean, nullable: Whether this location contributes stock to marketplaces.
  - `success` boolean, required: True when code equals "0".

## Changes

- **2026-11-06** `4946760fb77d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/desty/apis/desty-omni-openapi-2026-6-26/changes/api/inventory/stock/location/query/post.md)

---

[API](https://skmtc.dev/desty/apis/desty-omni-openapi-2026-6-26.md) - [All operations](https://skmtc.dev/desty/apis/desty-omni-openapi-2026-6-26/llms.txt) - [OpenAPI document](https://skmtc.dev/desty/apis/desty-omni-openapi-2026-6-26/revisions/4946760fb77d?raw)
