Cria ou executa coupons
POST/api/coupons
- Auth
- Requires a token
- X-CommunityId
X-CommunityIdSend the X-CommunityId of the community the operation happens in.
Endpoint descriptions come straight from the API specification and are in Portuguese for now. The interface around them is translated.
Headers
| Name | Type | Description |
|---|---|---|
X-CommunityIdoptional | string (uuid) | ID da comunidade em que a operação acontece. Obrigatório na maioria dos endpoints com escopo de comunidade. |
Request body application/json
| Name | Type | Description |
|---|---|---|
coderequired | string | Coupon code is required |
namerequired | string | Name is required |
descriptionoptional | string | |
typerequired | PERCENTAGE | FIXED | FREE_TRIAL | Invalid coupon type |
discountValuerequired | number | Discount value must be positive |
maxDiscountoptional | number | |
trialExtensionDaysoptional | integer | |
durationrequired | ONCE | FOREVER | REPEATING | Invalid duration |
durationInMonthsoptional | integer | |
maxUsesoptional | integer | |
maxUsesPerUseroptional | integer | |
startDaterequired | string (date-time) | Valid start date required |
endDateoptional | string (date-time) | |
restrictionoptional | NONE | FIRST_PURCHASE | NEW_CUSTOMER | |
minPurchaseAmountoptional | number | |
applicableProductsoptional | —[] | |
excludedProductsoptional | —[] | |
applicableToOneTimeoptional | boolean | |
applicableToSubscriptionoptional | boolean | |
applicableToInstallmentoptional | boolean | |
isStackableoptional | boolean |
Responses
| Status | Description |
|---|---|
201 | Operação realizada com sucesso. |
400 | Requisição inválida — falha de validação. |
401 | Token ausente, inválido ou expirado. |
403 | Autenticado, mas sem permissão para esta operação. |
404 | Recurso não encontrado. |
500 | Erro interno do servidor. |
curl example
curl -X POST "https://api.memberfy.net/api/coupons" \
-H "Authorization: Bearer $TOKEN" \
-H "X-CommunityId: $COMMUNITY_ID" \
-H "Content-Type: application/json" \
-d '{"code":"string","name":"string","type":"PERCENTAGE","discountValue":10,"duration":"ONCE","startDate":"2026-01-01T12:00:00.000Z"}'