---
title: "批量查询地点库存数量"
description: "批量查询指定库存单位在各地点的可用库存数量。"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/inventory/get-inventory-quantities'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/inventory/get-inventory-quantities.md'
---
# 批量查询地点库存数量

批量查询指定库存单位在各地点的可用库存数量。

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `read_inventory`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
GET /inventory_levels.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。

## Required Permissions

* `read_inventory`

## Request

### Query Parameters

* `inventory_item_ids`

  string (required)

  指定查询的库存单位 ID，多个 ID 用英文逗号分隔。

* `location_ids`

  string (optional)

  指定查询的地点 ID，多个 ID 用英文逗号分隔。

### Request Headers

* `Content-Type`

  string (required)

  字段值固定为 `application/json; charset=utf-8`。

* `Authorization`

  string (required)

  资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。

## Response

### Status Codes

* `200`

  更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。

### Response Body

#### 200

* `inventory_levels`

  array<object>

  库存水平列表。每条库存水平记录包含库存单位在对应地点的可用库存信息。

  * `available`

    long

    库存单位在该地点的可用库存数量。

  * `created_at`

    string

    库存水平记录创建的日期和时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

  * `inventory_item_id`

    string

    库存单位的唯一标识 ID。

  * `location_id`

    string

    地点的唯一标识 ID。

  * `updated_at`

    string

    库存单位最近一次更新的日期和时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

  * `variant_id`

    string

    商品款式的唯一标识 ID。


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "tags": [
    "批量查询地点库存数量"
  ],
  "description": "批量查询指定库存单位在各地点的可用库存数量。",
  "externalDocs": {
    "description": "接口使用的权限点: `read_inventory` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": "| Error Code | HTTP Status Code | Error Description |\n|------------|------------------|-------------------|\n| DATA_NOT_EXIST | 404 | The requested data does not exist. |\n| INVALID_PARAMETER | 400 | The provided parameter is invalid. |\n| SUCCESS | 200 | request success |\n| SYSTEM_ERROR | 500 | system error |\n"
  },
  "operationId": "bAkyZIRu",
  "parameters": [
    {
      "name": "inventory_item_ids",
      "in": "query",
      "description": "指定查询的库存单位 ID，多个 ID 用英文逗号分隔。",
      "required": true,
      "style": "form",
      "schema": {
        "name": "inventory_item_ids",
        "description": "指定查询的库存单位 ID，多个 ID 用英文逗号分隔。",
        "type": "string",
        "example": "5703943240925324252"
      },
      "example": "5703943240925324252",
      "examples": {
        "查询多个地点的可用库存数量": {
          "value": "5703943240925324252"
        }
      },
      "explode": true
    },
    {
      "name": "location_ids",
      "in": "query",
      "description": "指定查询的地点 ID，多个 ID 用英文逗号分隔。",
      "style": "form",
      "schema": {
        "name": "location_ids",
        "description": "指定查询的地点 ID，多个 ID 用英文逗号分隔。",
        "type": "string",
        "example": "5421703880295066100,5421704248135526901"
      },
      "example": "5421703880295066100,5421704248135526901",
      "examples": {
        "查询多个地点的可用库存数量": {
          "value": "5421703880295066100,5421704248135526901"
        }
      },
      "explode": true
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "responses": {
    "200": {
      "description": "更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。",
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "name": "body",
            "type": "object",
            "properties": {
              "inventory_levels": {
                "name": "inventory_levels",
                "description": "库存水平列表。每条库存水平记录包含库存单位在对应地点的可用库存信息。",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "available": {
                      "name": "available",
                      "description": "库存单位在该地点的可用库存数量。",
                      "type": "long",
                      "example": 10
                    },
                    "created_at": {
                      "name": "created_at",
                      "description": "库存水平记录创建的日期和时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
                      "type": "string",
                      "example": "2022-12-06T20:23:06+08:00"
                    },
                    "inventory_item_id": {
                      "name": "inventory_item_id",
                      "description": "库存单位的唯一标识 ID。",
                      "type": "string",
                      "example": "5703943240925324252"
                    },
                    "location_id": {
                      "name": "location_id",
                      "description": "地点的唯一标识 ID。",
                      "type": "string",
                      "example": "5421703880295066100"
                    },
                    "updated_at": {
                      "name": "updated_at",
                      "description": "库存单位最近一次更新的日期和时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
                      "type": "string",
                      "example": "2022-12-06T20:25:55+08:00"
                    },
                    "variant_id": {
                      "name": "variant_id",
                      "description": "商品款式的唯一标识 ID。",
                      "type": "string",
                      "example": "18057039432358082693350282"
                    }
                  },
                  "example": {
                    "available": 10,
                    "created_at": "2022-12-06T20:23:06+08:00",
                    "inventory_item_id": "5703943240925324252",
                    "location_id": "5421703880295066100",
                    "updated_at": "2022-12-06T20:25:55+08:00",
                    "variant_id": "18057039432358082693350282"
                  }
                }
              }
            },
            "example": {
              "inventory_levels": null
            }
          },
          "examples": {
            "查询多个地点的可用库存数量": {
              "description": "查询库存单位 `5703943240925324252` 在两个地点的可用库存数量。将 `inventory_item_ids` 和 `location_ids` 作为查询参数传入。示例响应中，地点 `5421703880295066100` 和 `5421704248135526901` 的可用库存数量分别为 `10` 和 `0`。",
              "value": {
                "inventory_levels": [
                  {
                    "available": 10,
                    "created_at": "2022-12-06T20:23:06+08:00",
                    "inventory_item_id": "5703943240925324252",
                    "location_id": "5421703880295066100",
                    "updated_at": "2022-12-06T20:25:55+08:00",
                    "variant_id": "18057039432358082693350282"
                  },
                  {
                    "available": 0,
                    "created_at": "2022-12-06T20:23:06+08:00",
                    "inventory_item_id": "5703943240925324252",
                    "location_id": "5421704248135526901",
                    "updated_at": "2022-12-06T20:25:55+08:00",
                    "variant_id": "18057039432358082693350282"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "get",
  "path": "/inventory_levels.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。"
        }
      }
    }
  ],
  "info": {
    "title": "批量查询地点库存数量",
    "version": "v20270301"
  },
  "authIndexes": [
    "read_inventory"
  ]
}
```