curl --request GET \
--url https://api.salesbricks.com/api/v2/discount-coupons/{code} \
--header 'X-SALESBRICKS-KEY: <api-key>'import requests
url = "https://api.salesbricks.com/api/v2/discount-coupons/{code}"
headers = {"X-SALESBRICKS-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-SALESBRICKS-KEY': '<api-key>'}};
fetch('https://api.salesbricks.com/api/v2/discount-coupons/{code}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.salesbricks.com/api/v2/discount-coupons/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-SALESBRICKS-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.salesbricks.com/api/v2/discount-coupons/{code}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-SALESBRICKS-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.salesbricks.com/api/v2/discount-coupons/{code}")
.header("X-SALESBRICKS-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/discount-coupons/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "<string>",
"name": "<string>",
"description": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"discount_type": "<string>",
"discount_rate": "<string>",
"duration_months": 123,
"active": true,
"is_expired": true,
"eligible_brick_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Not found — the resource you are looking for does not exist."
}
}Retrieve a discount coupon
Returns the details of a specific discount coupon by its code. The code lookup is case-insensitive. The response includes the coupon’s current status (active, is_valid, is_expired) so the caller can determine how to handle it. Use this endpoint to validate and display coupon details during checkout.
curl --request GET \
--url https://api.salesbricks.com/api/v2/discount-coupons/{code} \
--header 'X-SALESBRICKS-KEY: <api-key>'import requests
url = "https://api.salesbricks.com/api/v2/discount-coupons/{code}"
headers = {"X-SALESBRICKS-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-SALESBRICKS-KEY': '<api-key>'}};
fetch('https://api.salesbricks.com/api/v2/discount-coupons/{code}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.salesbricks.com/api/v2/discount-coupons/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-SALESBRICKS-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.salesbricks.com/api/v2/discount-coupons/{code}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-SALESBRICKS-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.salesbricks.com/api/v2/discount-coupons/{code}")
.header("X-SALESBRICKS-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/discount-coupons/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "<string>",
"name": "<string>",
"description": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"discount_type": "<string>",
"discount_rate": "<string>",
"duration_months": 123,
"active": true,
"is_expired": true,
"eligible_brick_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Not found — the resource you are looking for does not exist."
}
}Authorizations
API key for authentication
Path Parameters
The coupon code to retrieve (case-insensitive)
Response
Serializer for discount coupon information.
Unique coupon code used to redeem this discount
Display name for the coupon
Description of what this coupon provides
When this coupon expires (null means no expiration)
The type of discount this coupon provides. Only duration discount is supported for now.
Percentage discount rate applied for the duration period
^-?\d{0,14}(?:\.\d{0,6})?$Number of months the duration discount applies (999 means forever)
Whether this coupon is currently active and can be used
Whether this coupon has expired
Brick IDs this coupon's discount applies to. Empty means all bricks. Only present for duration coupons.