# 获取代码的兑换码使用限制

获取代码可以使用的剩余次数。要筛选代码，请使用`codes`查询参数。
要配置代码限制本身，请前往“管理”部分：
*[兑换码](https://developers.xsolla.com/zh/api/shop-builder/tag/promotions-promo-codes/)

Endpoint: GET /v2/project/{project_id}/admin/code/limit/promocode/external_id/{external_id}
Version: 2.0.0
Security: basicAuth

## Path parameters:

  - `project_id` (integer, required)
    项目ID。您可以在[发布商帐户](https://publisher.xsolla.com/0/projects/0/)的项目名称旁找到此参数；使用项目时，也可以在浏览器地址栏中找到此参数。URL格式如下：`https://publisher.xsolla.com/<merchant_id>/projects/<project_id>`。

  - `external_id` (integer, required)
    促销活动外部ID。项目内的唯一促销活动标识符。

## Query parameters:

  - `codes[]` (array)
    区分大小写的唯一代码。仅包含字母和数字。

  - `limit` (integer)
    页面上元素数量的限制。

  - `offset` (integer)
    生成列表时作为起始位置的元素编号（从0开始计数）。

## Response 200 fields (application/json):

  - `promotion_id` (integer)
    促销活动ID。项目内的唯一促销活动标识符。

  - `items` (array)

  - `items.code` (string)
    区分大小写的唯一兑换码。包含字母和数字。
    Example: WINTER2021

  - `items.per_code` (object)

  - `items.per_code.total` (integer)
    兑换码可使用的最大次数。

  - `items.per_code.available` (integer)
    兑换码的剩余可用次数。

  - `items.per_code.used` (integer)
    兑换码被使用的次数。

  - `items.per_code.reserved` (integer)
    兑换码的预留次数。

  - `total_items_count` (number)
    代码总数。

  - `has_more` (boolean)
    如果存在其他含代码的页面。

## Response 401 fields (application/json):

  - `statusCode` (integer)
    Example: 401

  - `errorCode` (integer)
    Example: 1020

  - `errorMessage` (string)
    Example: [0401-1020]: Error in Authentication method occurred

## Response 404 fields (application/json):

  - `statusCode` (integer)

  - `errorCode` (integer)

  - `errorMessage` (string)

  - `transactionId` (string)

## Response 422 fields (application/json):

  - `statusCode` (integer)

  - `errorCode` (integer)

  - `errorMessage` (string)

  - `errorMessageExtended` (array)

