Atualizar cupom
curl --request PATCH \
--url https://api.upag.io/v1/coupons/{couponId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": {},
"active": true,
"maxUses": {},
"expiresAt": {},
"appliesTo": "<string>",
"appliesToProducts": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: {},
active: true,
maxUses: {},
expiresAt: {},
appliesTo: '<string>',
appliesToProducts: {}
})
};
fetch('https://api.upag.io/v1/coupons/{couponId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/coupons/{couponId}';
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: {},
active: true,
maxUses: {},
expiresAt: {},
appliesTo: '<string>',
appliesToProducts: {}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Cupons
Atualizar cupom
Atualiza nome, atividade, limites ou produtos elegíveis
PATCH
https://api.upag.io
/
v1
/
coupons
/
{couponId}
Atualizar cupom
curl --request PATCH \
--url https://api.upag.io/v1/coupons/{couponId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": {},
"active": true,
"maxUses": {},
"expiresAt": {},
"appliesTo": "<string>",
"appliesToProducts": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: {},
active: true,
maxUses: {},
expiresAt: {},
appliesTo: '<string>',
appliesToProducts: {}
})
};
fetch('https://api.upag.io/v1/coupons/{couponId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/coupons/{couponId}';
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: {},
active: true,
maxUses: {},
expiresAt: {},
appliesTo: '<string>',
appliesToProducts: {}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Atualização parcial.
type, code, percentOff, amountOff e currency não podem ser alterados; para isso, crie outro cupom.
Permissão: coupon.write (chave secreta).
Endpoint
curl -X PATCH https://api.upag.dev/v1/coupons/a3c4d5e6-7f80-4912-8abc-0d1e2f3a4b5c \
-H "Authorization: Bearer sk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"active": false,
"maxUses": null
}'
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
const coupon = await upag.coupons.update('a3c4d5e6-7f80-4912-8abc-0d1e2f3a4b5c', {
active: false,
maxUses: null,
});
Em produção use
https://api.upag.io/v1 com sk_live_....Parâmetros
string (uuid)
required
ID do cupom.
string
Novo nome (mínimo 3 caracteres).
string | null
Nova descrição (mínimo 3 caracteres) ou
null para limpar.boolean
Ativa ou desativa o cupom.
integer | null
Novo limite de usos (≥ 1) ou
null para ilimitado.string (ISO 8601) | null
Nova expiração ou
null para remover.string
all ou specific. Ao enviar specific, envie também appliesToProducts não vazio.string[] | null
UUIDs de produtos elegíveis.
Resposta
200 OK
Response
{
"id": "a3c4d5e6-7f80-4912-8abc-0d1e2f3a4b5c",
"name": "Black Friday",
"description": null,
"active": false,
"type": "percentage",
"code": "BLACK20",
"currency": null,
"amountOff": null,
"percentOff": 20,
"uses": 3,
"maxUses": null,
"appliesTo": "all",
"appliesToProducts": null,
"expiresAt": "2026-12-01T00:00:00.000Z",
"createdAt": "2026-03-18T11:10:00.000Z",
"updatedAt": "2026-03-18T12:30:00.000Z"
}
404 (COUPON_NOT_FOUND) se o cupom não existir.