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âmetro | Tipo | Default | Descrição |
|---|---|---|---|
limit | int (1–50) | 20 | Itens por página (máx. 50). |
offset | int (≥ 0) | 0 | Deslocamento. |
sort | string | — | Expressão de ordenação, ex.: -createdAt. |
dir | enum | — | ascending ou descending (alias legado; usado quando sort ausente). |
id | string | — | Filtra por publicId (dis_* ou coup_*). |
name | string (≤ 80) | — | Filtra por nome. |
code | string (≤ 50) | — | Filtra por código. |
type | enum | — | flat ou percentage. |
status | enum | — | active ou inactive. |
daterange / daterangegt / daterangegte / daterangelt / daterangelte | date ou datetime ISO | — | Filtros 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
| Atributo | Tipo | Descrição |
|---|---|---|
offset / limit / total / hasMore / page | - | Paginação padrão. |
data | array | Objetos 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?