Recurly Unique Coupon Code API

Unique coupon codes are generated from bulk coupons.

Business capability
Discount & Promotion Management BC-440.30

Operations 6

POST /coupons/{coupon_id}/generate Generate unique coupon codes #
POST /coupons/{coupon_id}/generate_sync Generate unique coupon codes synchronously #
GET /coupons/{coupon_id}/unique_coupon_codes List unique coupon codes associated with a bulk coupon #
GET /unique_coupon_codes/{unique_coupon_code_id} Fetch a unique coupon code #
DELETE /unique_coupon_codes/{unique_coupon_code_id} Deactivate a unique coupon code #
PUT /unique_coupon_codes/{unique_coupon_code_id}/restore Restore a unique coupon code #

Documentation

Specifications

Schemas & Data

📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-line-item-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-subscription-create-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-invoice-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-subscription-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-add-on-create-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-purchase-create-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-subscription-dto-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-billing-attempt-dto-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-subscription-create-request-dto-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-subscription-line-dto-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-subscription-offer-dto-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-subscriber-dto-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-transaction-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-recovery-invoice-create-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-dunning-campaign-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-invoice-collection-schema.json
📊
JSONSchema
https://artifacts.apis.io/recurly/json-schema/recurly-dunning-campaign-list-schema.json

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/recurly:recurly-unique-coupon-code-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

recurly-unique-coupon-code-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Recurly Unique Coupon Code API
  version: v2021-02-25
  description: 'Operations tagged Unique Coupon Code across 2 of this provider''s published API definitions: recurly-v3-v2021-02-25-api.yaml, recurly-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://v3.recurly.com
- url: https://v3.eu.recurly.com
security:
- api_key: []
tags:
- name: Unique Coupon Code
  description: Unique coupon codes are generated from bulk coupons.
paths:
  /coupons/{coupon_id}/generate:
    post:
      tags:
      - Unique Coupon Code
      operationId: generate_unique_coupon_codes
      summary: Generate unique coupon codes
      parameters:
      - $ref: '#/components/parameters/accept_header'
      - $ref: '#/components/parameters/coupon_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CouponBulkCreate'
        required: true
      responses:
        '201':
          description: 'A set of parameters that can be passed to the `list_unique_coupon_codes`

            endpoint to obtain only the newly generated `UniqueCouponCodes`.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UniqueCouponCodeParams'
        '400':
          description: Invalid or unpermitted parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Incorrect site or coupon ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Unexpected error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples: []
    servers:
    - url: https://v3.recurly.com
    - url: https://v3.eu.recurly.com
  /coupons/{coupon_id}/generate_sync:
    post:
      tags:
      - Unique Coupon Code
      operationId: generate_unique_coupon_codes_sync
      summary: Generate unique coupon codes synchronously
      description: Generates up to 200 unique coupon codes for a bulk coupon and returns them directly in the response. For larger batches, use the asynchronous generate endpoint instead.
      parameters:
      - $ref: '#/components/parameters/accept_header'
      - $ref: '#/components/parameters/coupon_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CouponBulkCreateSync'
        required: true
      responses:
        '200':
          description: The newly generated unique coupon codes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UniqueCouponCodeGenerationResponse'
        '400':
          description: Invalid or unpermitted parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Incorrect site or coupon ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unprocessable entity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Unexpected error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples: []
    servers:
    - url: https://v3.recurly.com
    - url: https://v3.eu.recurly.com
  /coupons/{coupon_id}/unique_coupon_codes:
    get:
      tags:
      - Unique Coupon Code
      operationId: list_unique_coupon_codes
      summary: List unique coupon codes associated with a bulk coupon
      description: See the Pagination Guide to learn how to use pagination in the API and Client Libraries.
      parameters:
      - $ref: '#/components/parameters/accept_header'
      - $ref: '#/components/parameters/coupon_id'
      - $ref: '#/components/parameters/ids'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/order'
      - $ref: '#/components/parameters/sort_dates'
      - $ref: '#/components/parameters/filter_begin_time'
      - $ref: '#/components/parameters/filter_end_time'
      - $ref: '#/components/parameters/filter_redeemed'
      responses:
        '200':
          description: A list of unique coupon codes that were generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UniqueCouponCodeList'
        '404':
          description: Incorrect site or coupon ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Unexpected error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples: []
    servers:
    - url: https://v3.recurly.com
    - url: https://v3.eu.recurly.com
  /unique_coupon_codes/{unique_coupon_code_id}:
    parameters:
    - $ref: '#/components/parameters/unique_coupon_code_id'
    get:
      tags:
      - Unique Coupon Code
      operationId: get_unique_coupon_code
      summary: Fetch a unique coupon code
      parameters:
      - $ref: '#/components/parameters/accept_header'
      responses:
        '200':
          description: A unique coupon code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UniqueCouponCode'
        '400':
          description: Bad request; perhaps missing or invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Unexpected error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples: []
    delete:
      tags:
      - Unique Coupon Code
      operationId: deactivate_unique_coupon_code
      summary: Deactivate a unique coupon code
      description: Expire a unique code, making that specific code no longer redeemable. The parent bulk coupon will not be affected.
      parameters:
      - $ref: '#/components/parameters/accept_header'
      responses:
        '200':
          description: A unique coupon code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UniqueCouponCode'
        '400':
          description: Bad request; perhaps missing or invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unique coupon code cannot be deactivated for the provided reason.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Unexpected error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples: []
    servers:
    - url: https://v3.recurly.com
    - url: https://v3.eu.recurly.com
  /unique_coupon_codes/{unique_coupon_code_id}/restore:
    parameters:
    - $ref: '#/components/parameters/unique_coupon_code_id'
    put:
      tags:
      - Unique Coupon Code
      operationId: reactivate_unique_coupon_code
      summary: Restore a unique coupon code
      parameters:
      - $ref: '#/components/parameters/accept_header'
      responses:
        '200':
          description: A unique coupon code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UniqueCouponCode'
        '400':
          description: Bad request; perhaps missing or invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unique coupon code cannot be restored for the provided reason.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Unexpected error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples: []
    servers:
    - url: https://v3.recurly.com
    - url: https://v3.eu.recurly.com
components:
  parameters:
    filter_begin_time:
      name: begin_time
      in: query
      description: 'Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`.

        **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

        '
      schema:
        type: string
        format: date-time
    ids:
      name: ids
      in: query
      description: "Filter results by their IDs. Up to 200 IDs can be passed at once using\ncommas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`.\n\n**Important notes:**\n\n* The `ids` parameter cannot be used with any other ordering or filtering\n  parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc)\n* Invalid or unknown IDs will be ignored, so you should check that the\n  results correspond to your request.\n* Records are returned in an arbitrary order. Since results are all\n  returned at once you can sort the records yourself.\n"
      style: form
      explode: false
      schema:
        type: array
        items:
          type: string
    order:
      name: order
      in: query
      description: Sort order.
      schema:
        default: desc
        $ref: '#/components/schemas/AlphanumericSortEnum'
    filter_end_time:
      name: end_time
      in: query
      description: 'Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`.

        **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

        '
      schema:
        type: string
        format: date-time
    filter_redeemed:
      name: redeemed
      in: query
      description: Filter unique coupon codes by redemption status. `true` for redeemed, `false` for not redeemed.
      schema:
        $ref: '#/components/schemas/FilterRedeemedEnum'
    coupon_id:
      name: coupon_id
      in: path
      description: Coupon ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-10off`.
      required: true
      schema:
        type: string
    limit:
      name: limit
      in: query
      description: Limit number of records 1-200.
      schema:
        type: integer
        minimum: 1
        maximum: 200
        default: 20
    accept_header:
      name: Accept
      in: header
      description: The API version to use for this request, e.g. `application/vnd.recurly.v2021-02-25`. Requests without a versioned `Accept` header return a 406 response.
      required: true
      schema:
        default: application/vnd.recurly.v2021-02-25
        $ref: '#/components/schemas/AcceptHeaderEnum'
    unique_coupon_code_id:
      name: unique_coupon_code_id
      in: path
      description: Unique Coupon Code ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-abc-8dh2-def`.
      required: true
      schema:
        type: string
    sort_dates:
      name: sort
      in: query
      description: 'Sort field. You *really* only want to sort by `updated_at` in ascending

        order. In descending order updated records will move behind the cursor and could

        prevent some records from being returned.

        '
      schema:
        default: created_at
        $ref: '#/components/schemas/TimestampSortEnum'
  schemas:
    CouponBulkCreate:
      type: object
      properties:
        number_of_unique_codes:
          type: integer
          title: Number of unique codes
          description: The quantity of unique coupon codes to generate. A bulk coupon can have up to 100,000 unique codes (or your site's configured limit).
          minimum: 1
    UniqueCouponCodeGenerationResponse:
      type: object
      properties:
        object:
          type: string
          title: Object type
          readOnly: true
        unique_coupon_codes:
          type: array
          title: Unique coupon codes
          description: An array containing the newly generated unique coupon codes.
          maxItems: 200
          items:
            $ref: '#/components/schemas/UniqueCouponCode'
    AlphanumericSortEnum:
      type: string
      enum:
      - asc
      - desc
    CouponBulkCreateSync:
      type: object
      properties:
        number_of_unique_codes:
          type: integer
          title: Number of unique codes
          description: The quantity of unique coupon codes to generate. A bulk coupon can have up to 100,000 unique codes (or your site's configured limit).
          minimum: 1
          maximum: 200
      required:
      - number_of_unique_codes
    ErrorTypeEnum:
      type: string
      enum:
      - bad_request
      - immutable_subscription
      - internal_server_error
      - invalid_api_key
      - invalid_api_version
      - invalid_content_type
      - invalid_permissions
      - invalid_token
      - missing_feature
      - not_found
      - rate_limited
      - service_not_available
      - simultaneous_request
      - tax_service_error
      - transaction
      - unauthorized
      - unavailable_in_api_version
      - unknown_api_version
      - validation
    AcceptHeaderEnum:
      type: string
      enum:
      - application/vnd.recurly.v2021-02-25
      - application/vnd.recurly.v2021-02-25+json
    UniqueCouponCode:
      type: object
      description: A unique coupon code for a bulk coupon.
      properties:
        id:
          type: string
          title: Unique Coupon Code ID
          readOnly: true
        object:
          type: string
          title: Object type
          readOnly: true
        code:
          type: string
          title: Coupon code
          description: The code the customer enters to redeem the coupon.
        state:
          title: State
          description: Indicates if the unique coupon code is redeemable or why not.
          $ref: '#/components/schemas/CouponCodeStateEnum'
        bulk_coupon_id:
          type: string
          title: Bulk Coupon ID
          description: The Coupon ID of the parent Bulk Coupon
          readOnly: true
        bulk_coupon_code:
          type: string
          title: Bulk Coupon code
          description: The Coupon code of the parent Bulk Coupon
        created_at:
          type: string
          title: Created at
          format: date-time
          readOnly: true
        updated_at:
          type: string
          title: Updated at
          format: date-time
          readOnly: true
        redeemed_at:
          type: string
          title: Redeemed at
          description: The date and time the unique coupon code was redeemed.
          format: date-time
          readOnly: true
        expired_at:
          type: string
          title: Expired at
          description: The date and time the coupon was expired early or reached its `max_redemptions`.
          format: date-time
        redeem_by_date:
          type: string
          title: Redeem by
          description: Absolute expiry computed and stored at code-generation time. Set only for Window (relative redeem-by) coupons. Null for Anytime coupons and Specific Date coupons — those resolve expiry from the parent coupon's redeem_by at redemption time, not at code-generation time.
          format: date-time
          readOnly: true
    TimestampSortEnum:
      type: string
      enum:
      - created_at
      - updated_at
    FilterRedeemedEnum:
      type: string
      enum:
      - true
      - false
    Error:
      type: object
      properties:
        type:
          title: Type
          $ref: '#/components/schemas/ErrorTypeEnum'
        message:
          type: string
          title: Message
        params:
          type: array
          title: Parameter specific errors
          items:
            type: object
            properties:
              param:
                type: string
    UniqueCouponCodeList:
      type: object
      properties:
        object:
          type: string
          title: Object type
          description: Will always be List.
        has_more:
          type: boolean
          description: Indicates there are more results on subsequent pages.
        next:
          type: string
          description: Path to subsequent page of results.
        data:
          type: array
          items:
            $ref: '#/components/schemas/UniqueCouponCode'
    CouponCodeStateEnum:
      type: string
      enum:
      - expired
      - inactive
      - maxed_out
      - redeemable
    UniqueCouponCodeParams:
      type: object
      description: Parameters to be passed to the `list_unique_coupon_codes` endpoint to obtain the newly generated codes.
      properties:
        limit:
          type: integer
          title: The number of UniqueCouponCodes that will be generated
        order:
          type: string
          title: Sort order to list newly generated UniqueCouponCodes (should always be `asc`)
        sort:
          type: string
          title: Sort field to list newly generated UniqueCouponCodes (should always be `created_at`)
        begin_time:
          type: string
          title: Begin time query parameter
          description: The date-time to be included when listing UniqueCouponCodes
          format: date-time
  securitySchemes:
    api_key:
      type: http
      description: Enter the API key as the username and set the password to an empty string. You can locate and manage your API keys from the [API Credentials](https://app.recurly.com/go/developer/api_keys) page.
      scheme: basic
x-refined-from:
- recurly-v3-v2021-02-25-api.yaml
- recurly-openapi.yml
x-readme:
  explorer-enabled: false