Skip to main content
POST
/
coupons
Criar Cupom
curl --request POST \
  --url https://api.example.com/coupons \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>",
  "name": "<string>",
  "type": "<string>",
  "amount": 123,
  "duration": "<string>",
  "durationInMonths": 123,
  "maxRedemptions": 123,
  "redeemBy": "<string>",
  "currency": "<string>"
}
'
{
  "couponId": "019525fd-d3a4-7baf-a7c3-9d1e3f5b7c9f",
  "externalRef": null,
  "code": "SAVE20",
  "name": "Save 20%",
  "type": "PERCENTAGE",
  "amount": 20,
  "currency": "BRL",
  "duration": "ONCE",
  "durationInMonths": null,
  "maxRedemptions": null,
  "redeemBy": null,
  "timesRedeemed": 0,
  "amountRedeemed": 0,
  "status": "ACTIVE",
  "createdBy": "019525fd-56a8-7db4-8c3e-2a1b4d6f8e0c",
  "createdAt": "2026-03-25T14:00:00.000Z",
  "updatedBy": "019525fd-56a8-7db4-8c3e-2a1b4d6f8e0c",
  "updatedAt": "2026-03-25T14:00:00.000Z",
  "deletedBy": null,
  "deletedAt": null
}
Requer permissao coupon:write.

Headers

Authorization
string
required
Bearer token.

Corpo da Requisicao

code
string
required
Codigo unico. Max 40 caracteres.
name
string
required
Nome de exibicao. Max 255 caracteres.
type
string
required
Tipo de desconto. One of: FIXED, PERCENTAGE.
amount
integer
required
Valor do desconto. Para FIXED: centavos. Para PERCENTAGE: valor percentual.
duration
string
required
Um de: ONCE (fatura unica), REPEATING (multiplos ciclos).
durationInMonths
integer
Obrigatorio se a duracao for REPEATING.
maxRedemptions
integer
Maximo de resgates totais.
redeemBy
string
Data ISO 8601 apos a qual o cupom expira.
currency
string
required
Um de: USD, BRL, EUR.

Resposta

couponId
string
UUID do cupom.
externalRef
string
Referencia externa.
code
string
Codigo do cupom.
name
string
Nome do cupom.
type
string
Tipo de desconto.
amount
integer
Discount amount.
currency
string
Codigo da moeda.
duration
string
Duration type.
durationInMonths
integer
Duration in months.
maxRedemptions
integer
Maximum redemptions.
redeemBy
string
Data de expiracao.
timesRedeemed
integer
Times redeemed.
amountRedeemed
integer
Total amount redeemed.
status
string
Status do cupom.
createdBy
string
Identificador do criador.
createdAt
string
Timestamp de criacao.
updatedBy
string
Identificador do ultimo atualizador.
updatedAt
string
Timestamp da ultima atualizacao.
deletedBy
string
Deleter identifier.
deletedAt
string
Deletion timestamp.
{
  "couponId": "019525fd-d3a4-7baf-a7c3-9d1e3f5b7c9f",
  "externalRef": null,
  "code": "SAVE20",
  "name": "Save 20%",
  "type": "PERCENTAGE",
  "amount": 20,
  "currency": "BRL",
  "duration": "ONCE",
  "durationInMonths": null,
  "maxRedemptions": null,
  "redeemBy": null,
  "timesRedeemed": 0,
  "amountRedeemed": 0,
  "status": "ACTIVE",
  "createdBy": "019525fd-56a8-7db4-8c3e-2a1b4d6f8e0c",
  "createdAt": "2026-03-25T14:00:00.000Z",
  "updatedBy": "019525fd-56a8-7db4-8c3e-2a1b4d6f8e0c",
  "updatedAt": "2026-03-25T14:00:00.000Z",
  "deletedBy": null,
  "deletedAt": null
}

Exemplos de Codigo

curl -X POST https://api.awsales.io/admin/coupons \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "WELCOME20",
  "name": "Welcome Discount",
  "type": "PERCENTAGE",
  "amount": 20,
  "duration": "REPEATING",
  "durationInMonths": 3,
  "currency": "BRL"
}'

Codigos de Erro

StatusCodigoDescricao
400validation_errorEntrada invalida ou campos obrigatorios ausentes
401unauthorizedAutenticacao ausente ou invalida
403forbiddenPermissoes insuficientes
409coupon.code_already_existsCoupon code is already in use
500internal_server_errorOcorreu um erro inesperado