Get Discount Code Details

🔒

Requires price_rules access scope. More access scope

The Create Discount Code API allows you to create a unique discount code associated with a specific price rule.

This API is especially useful for:

  1. Generating custom discount codes for promotional campaigns.
  2. Associating discount codes with predefined price rules.
  3. Managing discount-specific details like usage and restrictions.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Path Parameters

FieldTypeRequiredExampleDescription
price_rule_idstringYes588fea0b-f15d-4c1d-9390-23661f0194faID of the price rule associated with the discount code.
discount_code_idstringYesf819c126-a581-4d66-a909-08282dd35916ID of the discount code to retrieve details for.

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Successful Response

FieldTypeExampleDescription
discount_code.idstringf819c126-a581-4d66-a909-08282dd35916ID of the created discount code.
discount_code.price_rule_idstring588fea0b-f15d-4c1d-9390-23661f0194faID of the associated price rule.
discount_code.codestringVIJK8GB0The generated discount code.
discount_code.created_atstring2022-06-17 07:48:29Timestamp of when the discount code was created.
discount_code.updated_atstring2022-06-17 07:48:29Timestamp of the last update.
discount_code.use_with_otherstring1Indicates whether the discount code can be used with other promotions.
discount_code.usage_countstring0Number of times the discount code has been used.

Error Response

Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.

FieldTypeExampleDescription
errorsArray[ "invalid line_item id"]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorString "store is not active"Indicates an error encountered during the process

Error Detail

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
404Not FoundThe ID provided is not existed.Not Found

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!