Cupons

Listar cupons

GET /v1/coupons

GET /v1/coupons

Lista cupons com paginação. Os itens de data são objetos completos (CouponResource); o envelope não inclui merchant nem _links.

Requisição

curl "https://api.selectwin.io/v1/coupons?limit=20&type=percentage&status=active" \
  -H "SelectKey: sk_live_aBcDeFgHiJkLmNoPqRsTuVwXyZ"

Parâmetros de query

ParâmetroTipoDefaultDescrição
limitint (1–50)20Itens por página (máx. 50).
offsetint (≥ 0)0Deslocamento.
sortstringExpressão de ordenação, ex.: -createdAt.
direnumascending ou descending (alias legado; usado quando sort ausente).
idstringFiltra por publicId (dis_* ou coup_*).
namestring (≤ 80)Filtra por nome.
codestring (≤ 50)Filtra por código.
typeenumflat ou percentage.
statusenumactive ou inactive.
daterange / daterangegt / daterangegte / daterangelt / daterangeltedate ou datetime ISOFiltros por intervalo de datas.

Resposta - 200 OK

{
  "offset": 0,
  "limit": 20,
  "total": 12,
  "page": {
    "current": 1,
    "total": 1,
    "offset": { "first": 0, "prev": 0, "next": 0, "last": 0 }
  },
  "hasMore": false,
  "data": [
    {
      "id": "dis_01hqzvabc",
      "name": "Black Friday 25%",
      "code": "BLACKFRIDAY25",
      "type": "percentage",
      "value": 25,
      "enabled": true,
      "minCartAmount": 10000,
      "maxCartAmount": null,
      "minCartItems": null,
      "maxCartItems": null,
      "usageLimit": 100,
      "usageQuantity": 0,
      "limitOneUsePerCustomer": true,
      "isCumulative": false,
      "initDate": "2026-04-01T00:00:00.000Z",
      "endDate": "2026-04-30T23:59:59.000Z",
      "allowedItemIds": null,
      "allowedCustomerIds": null,
      "scope": "firstCharge",
      "recurringCycles": null,
      "createdAt": "2026-04-12T17:56:33.000Z",
      "updatedAt": "2026-04-12T17:56:33.000Z"
    }
  ]
}

Nota: Os campos de page.offset (first/prev/next/last) são sempre inteiros (não null). O envelope e os itens não incluem merchant/_links.

Atributos da Resposta Paginada

AtributoTipoDescrição
offset / limit / total / hasMore / page-Paginação padrão.
dataarrayObjetos CouponResource completos (ver Read.md).

List All

GET /v1/coupons/listall

Retorna o conjunto completo (até 1000 cupons) como um array direto no root (sem paginação/mount), com itens em projeção leve: id, name, code, type, value, enabled, initDate, endDate, createdAt, updatedAt.

[
  {
    "id": "dis_01hqzvabc",
    "name": "Black Friday 25%",
    "code": "BLACKFRIDAY25",
    "type": "percentage",
    "value": 25,
    "enabled": true,
    "initDate": "2026-04-01T00:00:00.000Z",
    "endDate": "2026-04-30T23:59:59.000Z",
    "createdAt": "2026-04-12T17:56:33.000Z",
    "updatedAt": "2026-04-12T17:56:33.000Z"
  }
]

Melhores Práticas

  • Use os filtros (type, status, code, intervalos de data) para grandes volumes.
  • Para a lista completa sem paginação (ex.: preencher um seletor), use /listall.

How is this guide?

On this page