Skip to main content

Get Promotion Codes

GET 

/v2/promotions/:promotionID/codes

You can use this endpoint to retrieve promotion codes.

note
  • The codes.max_uses attribute represents the maximum usage of the codes.
  • The codes.uses attribute represents the remaining number of times the codes can be used for the promotion.
  • Codes created before April 27, 2023 will only have codes.uses attribute in the response body.

Request

Path Parameters

    promotionID stringrequired

    The unique identifier of the promotion.

Header Parameters

    Authorization Bearerrequired

    The Bearer token required to get access to the API.

Responses

Response Headers
    Schema
      data object[]
    • Array [
    • data object
      codes object[]
    • Array [
    • code string

      Specifies the name of the code.

      consume_unit string

      Specifies whether the code is applied to a line item or cart. The options are per_item or per_cart. The default setting is per_cart, which is applied at cart level. The per_item setting specifies how many times a buyer can use a promotion code on promotion items in a cart. For example, in a store that offers 50% off on SKU1, but limits the maximum usage of the promotion code to two, buyer can apply the promotion to SKU1 up to 2 times if cart has two quantities of SKU1. The third SKU1 is sold for regular price. The code usage is applied at checkout. You must set the automatic setting to false and create a code for this promotion to work.

      user string

      Specifies a string that specifies the users who can use the code. You can use the customer object ID or an array of customer object IDs. For more information, see the Create a customer section. Additionally, you could pass any identifying string to the promotions service that identifies a user.

      uses number

      Specifies the number of times the code can be used. If no value is set, the shopper can use the code any number of times.

      created_by string

      Specifies by whom it was created.

      meta object
      timestamps object
      created_at string

      Specifies the date the code was created.

    • ]
    • ]
    • links object
      current string

      Always the current page.

      first string

      Always the first page.

      last string

      If there is only one page, it returns null.

      next string

      If there is only one page, it returns null.

      prev string

      If the user is on the first page, it returns null.

      meta object
      page object
      current integer

      The current page.

      limit integer

      The maximum number of records per page for this response. You can set this value up to 100.

      offset integer

      The current offset by number of records, not pages. Offset is zero-based.

      total integer

      The total page count.

      results object
      total integer

      The total number of results.

    Loading...