Skip to main content
GET
/
discounts
List Discounts
curl --request GET \
  --url https://staging-api.puppetvendors.com/discounts \
  --header 'x-access-token: <api-key>'
import requests

url = "https://staging-api.puppetvendors.com/discounts"

headers = {"x-access-token": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'x-access-token': '<api-key>'}};

fetch('https://staging-api.puppetvendors.com/discounts', 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://staging-api.puppetvendors.com/discounts",
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-access-token: <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://staging-api.puppetvendors.com/discounts"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-access-token", "<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://staging-api.puppetvendors.com/discounts")
.header("x-access-token", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://staging-api.puppetvendors.com/discounts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-access-token"] = '<api-key>'

response = http.request(request)
puts response.read_body
V2 Alpha — This endpoint is part of the V2 API preview. Breaking changes may occur.

Overview

Retrieve discount codes created by or assigned to the authenticated vendor.

Use Cases

  • Manage promotions in a vendor self-service portal
  • Monitor discount usage and effectiveness

Query Parameters

status
string
Filter by status. One of: active, expired, disabled.
Search in discount title and code.
first
integer
Forward pagination count (1–100).
after
string
Forward pagination cursor.
last
integer
Backward pagination count (1–100).
before
string
Backward pagination cursor.

Response

200
{
  "success": true,
  "data": {
    "edges": [
      {
        "node": {
          "_id": "507f1f77bcf86cd799439011",
          "code": "VENDOR20",
          "title": "Vendor Special 20% Off",
          "status": "active",
          "startsAt": "2024-06-01T00:00:00.000Z",
          "endsAt": "2024-08-31T23:59:59.000Z",
          "usageCount": 12,
          "usageLimit": 50
        },
        "cursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9"
      }
    ],
    "pageInfo": {
      "hasNextPage": false,
      "hasPreviousPage": false,
      "startCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9",
      "endCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9"
    }
  }
}

Example

curl -X GET "https://staging-api.puppetvendors.com/discounts?status=active&first=20" \
  -H "x-access-token: YOUR_VENDOR_JWT_TOKEN"

More Examples

Search active discounts sorted by usage
curl -X GET "https://staging-api.puppetvendors.com/discounts?first=20&status=active&search=SUMMER&sortBy=usageCount&sortOrder=desc" \
  -H "x-access-token: YOUR_VENDOR_JWT_TOKEN"