Skip to main content
GET
/
v1
/
coupons
curl -X GET "https://api.affonso.io/v1/coupons?limit=10" \
  -H "Authorization: Bearer sk_live_your_api_key"
{
  "success": true,
  "data": [
    {
      "id": "cpn_abc123",
      "code": "SAVE25",
      "affiliate_id": "aff_123",
      "discount_type": "percentage",
      "discount_value": 25,
      "duration": "forever",
      "duration_in_months": null,
      "currency": null,
      "product_ids": [],
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 1,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPrevPage": false
  }
}

Query Parameters

page
integer
default:"1"
Page number for pagination. Must be a positive integer.
limit
integer
default:"50"
Number of results per page. Maximum value is 200. Default is 50.
affiliate_id
string
Filter coupons by affiliate ID.
program_id
string
Filter coupons by program ID.
Search by coupon code. Case-insensitive partial matching. Maximum 100 characters.
sort
string
Sort field and direction in the format field:direction. Valid fields: created_at, code. Valid directions: asc, desc. Example: created_at:desc.
expand
string
Comma-separated list of related data to include in the response. Valid values: affiliate.

Response

The response includes a paginated list of coupons and pagination metadata.
success
boolean
Always true for successful responses
data
array
Array of coupon objects. Each coupon object has the same structure as the single coupon response (see Get Coupon endpoint).
pagination
object
Pagination metadata object containing:
  • page (integer): Current page number
  • limit (integer): Number of results per page
  • total (integer): Total number of coupons matching the filters
  • totalPages (integer): Total number of pages
  • hasNextPage (boolean): Whether there is a next page
  • hasPrevPage (boolean): Whether there is a previous page
curl -X GET "https://api.affonso.io/v1/coupons?limit=10" \
  -H "Authorization: Bearer sk_live_your_api_key"
{
  "success": true,
  "data": [
    {
      "id": "cpn_abc123",
      "code": "SAVE25",
      "affiliate_id": "aff_123",
      "discount_type": "percentage",
      "discount_value": 25,
      "duration": "forever",
      "duration_in_months": null,
      "currency": null,
      "product_ids": [],
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 1,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPrevPage": false
  }
}