Product Discounts
Discounts and promotions.
Get promotion by code
/discounts/promotions/promo-code/{promoCode}Look up a promotion by its promotional code to check availability and details.
Path parameters
promo CodestringrequiredThe promotional code to look up.
Responses
200Promotion details including associated discount information.
application/json
Promotion details including associated discount information.
Promotion details including associated discount information.
objectPromotion
A promotion that applies a discount when the promotional code is used.
promotion IdstringrequiredThe unique identifier for the promotion.
promo CodestringrequiredThe promotional code that customers can use to activate this promotion.
discount Period MonthsintegerrequiredThe number of months the discount will be applied.
valid FromstringdateWhen the promotion becomes valid and can be used.
If not provided, the promotion is valid immediately.
valid TostringdateWhen the promotion expires and can no longer be used.
If not provided, the promotion does not expire.
discount IdstringrequiredThe unique identifier for the discount that this promotion applies to.
discountobjectrequiredEssential discount information without sensitive details.
Show child attributes
discount IdstringrequiredThe unique identifier for the discount.
descriptionstringrequiredA description of what the discount provides.
tagstringA short label or category for the discount.
created Atstringdate-timeWhen the discount was created.
updated Atstringdate-timeWhen the discount was last updated.
400The request was malformed or invalid.
application/json
The request was malformed or invalid.
The request was malformed or invalid.
objectError
The error body returned by every endpoint when a request fails. Use internalCode for programmatic
handling, show message to a human, and check details for field-level problems when the request
was invalid.
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the error. It is the code the failing system answered with — one of
ours where the endpoint publishes one, an operator's own code where the failure came from an
operator, and otherwise the request status. Prefer internalCode for branching.
internal CodestringNames the condition that failed, from our own registry, independently of which system reported it and of the HTTP status. Stable across releases and the code to branch on in client code.
detailsarray of objectAdditional details about the error, typically one entry per invalid field on validation failures.
Show child attributes
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the specific detail.
propertystringThe property or field related to the error. May be nested using dot notation (e.g., "billing.email").
suggestionone ofA suggested value for the particular property.
For example, this may be set when validating an address with an alias, suggesting the expected value by the operator.
A string, number, boolean, object, or array value. The concrete type depends on the field the value is returned for.
Show child attributes
hintstringA hint to help resolve the error.
trace IdstringIdentifies the trace this request produced. Quote it when reporting a failure — it is what lets us find the request among everything else the platform served.
span IdstringThe span within the trace that failed.
401Authentication is required to access this resource.
application/json
Authentication is required to access this resource.
Authentication is required to access this resource.
objectError
The error body returned by every endpoint when a request fails. Use internalCode for programmatic
handling, show message to a human, and check details for field-level problems when the request
was invalid.
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the error. It is the code the failing system answered with — one of
ours where the endpoint publishes one, an operator's own code where the failure came from an
operator, and otherwise the request status. Prefer internalCode for branching.
internal CodestringNames the condition that failed, from our own registry, independently of which system reported it and of the HTTP status. Stable across releases and the code to branch on in client code.
detailsarray of objectAdditional details about the error, typically one entry per invalid field on validation failures.
Show child attributes
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the specific detail.
propertystringThe property or field related to the error. May be nested using dot notation (e.g., "billing.email").
suggestionone ofA suggested value for the particular property.
For example, this may be set when validating an address with an alias, suggesting the expected value by the operator.
A string, number, boolean, object, or array value. The concrete type depends on the field the value is returned for.
Show child attributes
hintstringA hint to help resolve the error.
trace IdstringIdentifies the trace this request produced. Quote it when reporting a failure — it is what lets us find the request among everything else the platform served.
span IdstringThe span within the trace that failed.
403Access to this resource is forbidden.
application/json
Access to this resource is forbidden.
Access to this resource is forbidden.
objectError
The error body returned by every endpoint when a request fails. Use internalCode for programmatic
handling, show message to a human, and check details for field-level problems when the request
was invalid.
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the error. It is the code the failing system answered with — one of
ours where the endpoint publishes one, an operator's own code where the failure came from an
operator, and otherwise the request status. Prefer internalCode for branching.
internal CodestringNames the condition that failed, from our own registry, independently of which system reported it and of the HTTP status. Stable across releases and the code to branch on in client code.
detailsarray of objectAdditional details about the error, typically one entry per invalid field on validation failures.
Show child attributes
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the specific detail.
propertystringThe property or field related to the error. May be nested using dot notation (e.g., "billing.email").
suggestionone ofA suggested value for the particular property.
For example, this may be set when validating an address with an alias, suggesting the expected value by the operator.
A string, number, boolean, object, or array value. The concrete type depends on the field the value is returned for.
Show child attributes
hintstringA hint to help resolve the error.
trace IdstringIdentifies the trace this request produced. Quote it when reporting a failure — it is what lets us find the request among everything else the platform served.
span IdstringThe span within the trace that failed.
404The requested resource was not found.
application/json
The requested resource was not found.
The requested resource was not found.
objectError
The error body returned by every endpoint when a request fails. Use internalCode for programmatic
handling, show message to a human, and check details for field-level problems when the request
was invalid.
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the error. It is the code the failing system answered with — one of
ours where the endpoint publishes one, an operator's own code where the failure came from an
operator, and otherwise the request status. Prefer internalCode for branching.
internal CodestringNames the condition that failed, from our own registry, independently of which system reported it and of the HTTP status. Stable across releases and the code to branch on in client code.
detailsarray of objectAdditional details about the error, typically one entry per invalid field on validation failures.
Show child attributes
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the specific detail.
propertystringThe property or field related to the error. May be nested using dot notation (e.g., "billing.email").
suggestionone ofA suggested value for the particular property.
For example, this may be set when validating an address with an alias, suggesting the expected value by the operator.
A string, number, boolean, object, or array value. The concrete type depends on the field the value is returned for.
Show child attributes
hintstringA hint to help resolve the error.
trace IdstringIdentifies the trace this request produced. Quote it when reporting a failure — it is what lets us find the request among everything else the platform served.
span IdstringThe span within the trace that failed.
500An unexpected error occurred on the server.
application/json
An unexpected error occurred on the server.
An unexpected error occurred on the server.
objectError
The error body returned by every endpoint when a request fails. Use internalCode for programmatic
handling, show message to a human, and check details for field-level problems when the request
was invalid.
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the error. It is the code the failing system answered with — one of
ours where the endpoint publishes one, an operator's own code where the failure came from an
operator, and otherwise the request status. Prefer internalCode for branching.
internal CodestringNames the condition that failed, from our own registry, independently of which system reported it and of the HTTP status. Stable across releases and the code to branch on in client code.
detailsarray of objectAdditional details about the error, typically one entry per invalid field on validation failures.
Show child attributes
messagestringrequiredA human-readable message providing more details about the error.
codestringrequiredA machine-readable code for the specific detail.
propertystringThe property or field related to the error. May be nested using dot notation (e.g., "billing.email").
suggestionone ofA suggested value for the particular property.
For example, this may be set when validating an address with an alias, suggesting the expected value by the operator.
A string, number, boolean, object, or array value. The concrete type depends on the field the value is returned for.
Show child attributes
hintstringA hint to help resolve the error.
trace IdstringIdentifies the trace this request produced. Quote it when reporting a failure — it is what lets us find the request among everything else the platform served.
span IdstringThe span within the trace that failed.
Auth required
Send one of
X-Api-KeyBearer JWT+X-Api-Key
The API key is always required; the bearer token is optional.
curl https://apiv2.example.com/api/v2/discounts/promotions/promo-code/SUMMER25 \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'X-Api-Key: YOUR_API_KEY'fetch('https://apiv2.example.com/api/v2/discounts/promotions/promo-code/SUMMER25', {
headers: {
Authorization: 'Bearer YOUR_ACCESS_TOKEN',
'X-Api-Key': 'YOUR_API_KEY'
}
})requests.get(
"https://apiv2.example.com/api/v2/discounts/promotions/promo-code/SUMMER25",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"X-Api-Key": "YOUR_API_KEY"
}
)package main
import (
"fmt"
"io"
"net/http"
)
func main() {
requestUrl := "https://apiv2.example.com/api/v2/discounts/promotions/promo-code/SUMMER25"
req, _ := http.NewRequest("GET", requestUrl, nil)
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Add("X-Api-Key", "YOUR_API_KEY")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}{
"promotionId": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"promoCode": "SUMMER25",
"discountPeriodMonths": 12,
"validFrom": "2024-02-01",
"validTo": "2024-02-01",
"discountId": "80df6fdf-c450-406e-948b-f77d4ac1cdb8",
"discount": {
"discountId": "80df6fdf-c450-406e-948b-f77d4ac1cdb8",
"description": "25% Off Summer Promo",
"tag": "SUMMER25",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:45:00Z"
}
}{
"message": "The request body is invalid.",
"code": "bad_request",
"details": [
{
"message": "Email format is invalid.",
"code": "invalid_email",
"property": "contact.email"
}
],
"hint": "Check the request payload and correct the highlighted fields."
}{
"message": "Authentication is required to access this resource.",
"code": "unauthorized",
"hint": "Provide a valid API key in the X-Api-Key header."
}{
"message": "You do not have permission to perform this action.",
"code": "forbidden",
"hint": "Ensure your API key or user has the required permissions."
}{
"message": "The requested customer could not be found.",
"code": "not_found",
"hint": "Verify the customerId and try again."
}{
"message": "An unexpected error occurred on the server.",
"code": "internal_server_error",
"hint": "Retry the request later. If the problem persists, contact support."
}