List Promo Codes
curl --request GET \
--url https://api.withflex.com/v1/promo_codes \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.withflex.com/v1/promo_codes"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.withflex.com/v1/promo_codes', 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.withflex.com/v1/promo_codes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.withflex.com/v1/promo_codes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.withflex.com/v1/promo_codes")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/promo_codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"promo_codes": [
{
"promo_code_id": "fpromo_01HACM7FZ1084XB1GB6053VM0E",
"code": "SUMMER2016",
"coupon": {
"coupon_id": "fcoup_1234567890",
"amount_off": 100,
"applies_to": null,
"duration": "once",
"duration_in_months": null,
"metadata": {
"key": "value"
},
"name": "Coupon",
"percent_off": 10,
"max_redemptions": 100,
"times_redeemed": 0,
"valid": true,
"created_at": "2024-05-17T14:59:21Z",
"test_mode": true
},
"max_redemptions": 100,
"times_redeemed": 0,
"created_at": "2024-05-17T14:59:21Z",
"customer": "fcus_01HACM7FZ1084XB1GB6053VM0D",
"active": true,
"metadata": {
"key": "value"
},
"test_mode": false
}
]
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}List Promo Codes
Returns a list of your promotion codes. Optionally filter by active.
GET
/
v1
/
promo_codes
List Promo Codes
curl --request GET \
--url https://api.withflex.com/v1/promo_codes \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.withflex.com/v1/promo_codes"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.withflex.com/v1/promo_codes', 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.withflex.com/v1/promo_codes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.withflex.com/v1/promo_codes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.withflex.com/v1/promo_codes")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/promo_codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"promo_codes": [
{
"promo_code_id": "fpromo_01HACM7FZ1084XB1GB6053VM0E",
"code": "SUMMER2016",
"coupon": {
"coupon_id": "fcoup_1234567890",
"amount_off": 100,
"applies_to": null,
"duration": "once",
"duration_in_months": null,
"metadata": {
"key": "value"
},
"name": "Coupon",
"percent_off": 10,
"max_redemptions": 100,
"times_redeemed": 0,
"valid": true,
"created_at": "2024-05-17T14:59:21Z",
"test_mode": true
},
"max_redemptions": 100,
"times_redeemed": 0,
"created_at": "2024-05-17T14:59:21Z",
"customer": "fcus_01HACM7FZ1084XB1GB6053VM0D",
"active": true,
"metadata": {
"key": "value"
},
"test_mode": false
}
]
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}Authorizations
Use a Bearer token to access this API.
Query Parameters
Specifies whether the promo code is currently active.
Example:
false
Response
Success
An envelope wrapping a list of promotion code objects.
The list of promotion codes.
Show child attributes
Show child attributes
⌘I