> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unibee.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Batch Template List

> Get batch discount template list

## Endpoint Overview

**GET** `https://api.unibee.dev/merchant/discount/batch/template/list`

Get batch discount template list

***

## Authorization

All UniBee Merchant API requests require authentication via API key.

| Header          | Required | Description                           |
| --------------- | -------- | ------------------------------------- |
| `Authorization` | Yes      | Bearer `<your_api_key>`               |
| `Content-Type`  | Yes      | `application/json` (for request body) |

***

## Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

### Query parameters

| Name              | Type    | Required | Description                                                              |
| ----------------- | ------- | -------- | ------------------------------------------------------------------------ |
| `discountType`    | array   | No       | Filter by discount\_type, 1-percentage, 2-fixed\_amount                  |
| `billingType`     | array   | No       | Filter by billing\_type, 1-one-time, 2-recurring                         |
| `status`          | array   | No       | Filter by status, 1-editable, 2-active, 3-deactive, 4-expire, 10-archive |
| `codePrefix`      | string  | No       | Filter by code prefix                                                    |
| `searchKey`       | string  | No       | Search by code prefix or name                                            |
| `currency`        | string  | No       | Filter by currency                                                       |
| `sortField`       | string  | No       | Sort field, gmt\_create\|gmt\_modify, default gmt\_modify                |
| `sortType`        | string  | No       | Sort type, asc\|desc, default desc                                       |
| `page`            | integer | No       | Page number, start from 0                                                |
| `count`           | integer | No       | Count per page                                                           |
| `createTimeStart` | integer | No       | Filter by create time start, UTC timestamp in seconds                    |
| `createTimeEnd`   | integer | No       | Filter by create time end, UTC timestamp in seconds                      |

***

## Request examples

### cURL

```bash theme={null}
curl -X GET "https://api.unibee.dev/merchant/discount/batch/template/list" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
```

### Sandbox

```bash theme={null}
curl -X GET "https://api-sandbox.unibee.top/merchant/discount/batch/template/list" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json"
```

***

## Response

Success responses return a JSON envelope with `code`, `data`, `message`, `redirect`, and `requestId`. `code` `0` indicates success.

| Field                      | Type    | Description                                                |
| -------------------------- | ------- | ---------------------------------------------------------- |
| `code`                     | integer | Response code. `0` = success                               |
| `data`                     | object  | Response payload                                           |
| `data.activeTemplateCount` | integer | Total count of active template codes                       |
| `data.templates`           | array   | Batch template list                                        |
| `data.total`               | integer | Total count                                                |
| `data.totalChildCodeCount` | integer | Total count of all child codes                             |
| `data.usageRate`           | number  | Usage rate (usedChildCodeCount / totalChildCodeCount), 0-1 |
| `data.usedChildCodeCount`  | integer | Total count of used child codes                            |
| `message`                  | string  | Human-readable message                                     |
| `requestId`                | string  | Request ID for support                                     |

***

## Error handling

| HTTP status | Meaning                                                                   |
| ----------- | ------------------------------------------------------------------------- |
| 400         | Bad request — invalid or missing parameters. Check `message` in the body. |
| 401         | Unauthorized — missing or invalid API key.                                |
| 404         | Not found — invalid path or resource.                                     |
| 500         | Server error — retry with backoff.                                        |

When `code` in the response body is non-zero, check `message` for details. Use `requestId` when contacting support.


## OpenAPI

````yaml get /merchant/discount/batch/template/list
openapi: 3.0.0
info:
  description: UniBee Api Server
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: OpenAPI UniBee
  version: daily,buildtime:202603161017
servers:
  - url: https://api.unibee.dev
  - url: https://api-sandbox.unibee.top
security:
  - Authorization: []
paths:
  /merchant/discount/batch/template/list:
    get:
      tags:
        - Batch Discount
      summary: Get Batch Template List
      description: Get batch discount template list
      parameters:
        - description: Filter by discount_type, 1-percentage, 2-fixed_amount
          in: query
          name: discountType
          schema:
            description: Filter by discount_type, 1-percentage, 2-fixed_amount
            format: '[]int'
            items:
              format: int
              properties: {}
              type: integer
            properties: {}
            type: array
        - description: Filter by billing_type, 1-one-time, 2-recurring
          in: query
          name: billingType
          schema:
            description: Filter by billing_type, 1-one-time, 2-recurring
            format: '[]int'
            items:
              format: int
              properties: {}
              type: integer
            properties: {}
            type: array
        - description: >-
            Filter by status, 1-editable, 2-active, 3-deactive, 4-expire,
            10-archive
          in: query
          name: status
          schema:
            description: >-
              Filter by status, 1-editable, 2-active, 3-deactive, 4-expire,
              10-archive
            format: '[]int'
            items:
              format: int
              properties: {}
              type: integer
            properties: {}
            type: array
        - description: Filter by code prefix
          in: query
          name: codePrefix
          schema:
            description: Filter by code prefix
            format: string
            properties: {}
            type: string
        - description: Search by code prefix or name
          in: query
          name: searchKey
          schema:
            description: Search by code prefix or name
            format: string
            properties: {}
            type: string
        - description: Filter by currency
          in: query
          name: currency
          schema:
            description: Filter by currency
            format: string
            properties: {}
            type: string
        - description: Sort field, gmt_create|gmt_modify, default gmt_modify
          in: query
          name: sortField
          schema:
            description: Sort field, gmt_create|gmt_modify, default gmt_modify
            format: string
            properties: {}
            type: string
        - description: Sort type, asc|desc, default desc
          in: query
          name: sortType
          schema:
            description: Sort type, asc|desc, default desc
            format: string
            properties: {}
            type: string
        - description: Page number, start from 0
          in: query
          name: page
          schema:
            description: Page number, start from 0
            format: int
            properties: {}
            type: integer
        - description: Count per page
          in: query
          name: count
          schema:
            description: Count per page
            format: int
            properties: {}
            type: integer
        - description: Filter by create time start, UTC timestamp in seconds
          in: query
          name: createTimeStart
          schema:
            description: Filter by create time start, UTC timestamp in seconds
            format: int64
            properties: {}
            type: integer
        - description: Filter by create time end, UTC timestamp in seconds
          in: query
          name: createTimeEnd
          schema:
            description: Filter by create time end, UTC timestamp in seconds
            format: int64
            properties: {}
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    format: int
                    properties: {}
                    type: integer
                  data:
                    properties:
                      activeTemplateCount:
                        description: Total count of active template codes
                        format: int64
                        properties: {}
                        type: integer
                      templates:
                        description: Batch template list
                        format: '[]*bean.MerchantBatchDiscountCodeTemplate'
                        items:
                          $ref: >-
                            #/components/schemas/unibee.api.bean.MerchantBatchDiscountCodeTemplate
                        properties: {}
                        type: array
                      total:
                        description: Total count
                        format: int
                        properties: {}
                        type: integer
                      totalChildCodeCount:
                        description: Total count of all child codes
                        format: int64
                        properties: {}
                        type: integer
                      usageRate:
                        description: >-
                          Usage rate (usedChildCodeCount / totalChildCodeCount),
                          0-1
                        format: float64
                        properties: {}
                        type: number
                      usedChildCodeCount:
                        description: Total count of used child codes
                        format: int64
                        properties: {}
                        type: integer
                    type: object
                  merchantId:
                    format: int64
                    properties: {}
                    type: integer
                  message:
                    format: string
                    properties: {}
                    type: string
                  redirect:
                    format: string
                    properties: {}
                    type: string
                  requestId:
                    format: string
                    properties: {}
                    type: string
                type: object
          description: ''
components:
  schemas:
    unibee.api.bean.MerchantBatchDiscountCodeTemplate:
      properties:
        advance:
          description: >-
            AdvanceConfig, 0-false,1-true, will enable all advance config if set
            true
          format: bool
          properties: {}
          type: boolean
        billingType:
          description: billing_type, 1-one-time, 2-recurring
          format: int
          properties: {}
          type: integer
        childCodeCount:
          description: Number of generated child codes
          format: int64
          properties: {}
          type: integer
        code:
          description: code
          format: string
          properties: {}
          type: string
        codePrefix:
          description: codePrefix
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        currency:
          description: currency of discount, available when discount_type is fixed_amount
          format: string
          properties: {}
          type: string
        cycleLimit:
          description: the count limitation of subscription cycle , 0-no limit
          format: int
          properties: {}
          type: integer
        discountAmount:
          description: amount of discount, available when discount_type is fixed_amount
          format: int64
          properties: {}
          type: integer
        discountPercentage:
          description: >-
            percentage of discount, 100=1%, available when discount_type is
            percentage
          format: int64
          properties: {}
          type: integer
        discountType:
          description: discount_type, 1-percentage, 2-fixed_amount
          format: int
          properties: {}
          type: integer
        endTime:
          description: end of discount available utc time, 0-invalid
          format: int64
          properties: {}
          type: integer
        id:
          description: Id
          format: int64
          properties: {}
          type: integer
        isDeleted:
          description: 0-UnDeleted，> 0, Deleted, the deleted utc time
          format: int
          properties: {}
          type: integer
        merchantId:
          description: merchantId
          format: int64
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          format: map[string]interface {}
          properties: {}
          type: object
        name:
          description: name
          format: string
          properties: {}
          type: string
        planApplyGroup:
          $ref: '#/components/schemas/unibee.api.bean.GroupPlanSelector'
        planApplyType:
          description: >-
            plan apply type, 0-apply for all, 1-apply for plans specified,
            2-exclude for plans specified, 3-Apply to Plans by Groups(Billing
            Period Included), 4-Apply to Plans except by Groups(Billing Period
            Included)
          format: int
          properties: {}
          type: integer
        planIds:
          description: >-
            Ids of plan which discount code can effect, default effect all plans
            if not set
          format: '[]int64'
          items:
            format: int64
            properties: {}
            type: integer
          properties: {}
          type: array
        quantity:
          description: quantity of code, 0-no limit
          format: int64
          properties: {}
          type: integer
        startTime:
          description: start of discount available utc time
          format: int64
          properties: {}
          type: integer
        status:
          description: status, 1-editable, 2-active, 3-deactivate, 4-expire, 10-archive
          format: int
          properties: {}
          type: integer
        type:
          description: type, 1-external discount code, 2-batch code template, 3-batch code
          format: int
          properties: {}
          type: integer
        upgradeLongerOnly:
          description: >-
            AdvanceConfig, 0-false,1-true, will forbid for all except upgrade to
            longer plan if set true
          format: bool
          properties: {}
          type: boolean
        upgradeOnly:
          description: >-
            AdvanceConfig, 0-false,1-true, will forbid for all except same
            interval upgrade action if set true
          format: bool
          properties: {}
          type: boolean
        usedChildCodeCount:
          description: Number of used child codes
          format: int64
          properties: {}
          type: integer
        userLimit:
          description: >-
            AdvanceConfig, The limit of every customer can apply, the recurring
            apply not involved, 0-unlimited
          format: int
          properties: {}
          type: integer
        userScope:
          description: >-
            AdvanceConfig, Apply user scope,0-for all, 1-for only new user,
            2-for only renewals, renewals is upgrade&downgrade&renew
          format: int
          properties: {}
          type: integer
      type: object
    interface:
      properties: {}
      type: object
    unibee.api.bean.GroupPlanSelector:
      properties:
        currency:
          format: '[]string'
          items:
            format: string
            properties: {}
            type: string
          properties: {}
          type: array
        groupPlanIntervalSelector:
          format: '[]*bean.GroupPlanIntervalSelector'
          items:
            $ref: '#/components/schemas/unibee.api.bean.GroupPlanIntervalSelector'
          properties: {}
          type: array
        type:
          description: 1-main plan，2-addon plan,3-onetime
          format: '[]int'
          items:
            format: int
            properties: {}
            type: integer
          properties: {}
          type: array
      type: object
    unibee.api.bean.GroupPlanIntervalSelector:
      properties:
        intervalCount:
          description: 'Number Of IntervalUnit，em: day|month|year|week'
          format: int
          properties: {}
          type: integer
        intervalUnit:
          description: 'Plan Interval Unit，em: day|month|year|week'
          format: string
          properties: {}
          type: string
      type: object
  securitySchemes:
    Authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````