For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Help CenterAPI KeysStatusSign In
GuidesAPI ReferenceChangelog
GuidesAPI ReferenceChangelog
  • Introduction
    • Getting started
  • Email API
  • Transactional SMS
  • Transactional WhatsApp
  • Marketing Campaigns
  • Contact Management
  • Events
    • GETGet events
    • POSTCreate an event
    • POSTCreate events in batch
  • Object Management
  • Accounts and Settings
  • Sales CRM
  • Conversations
  • Ecommerce
  • Loyalty
      • GETGet code count
      • GETGet voucher for a contact
      • GETGet Reward Page API
      • POSTCreate a reward
      • GETGet reward information
      • POSTCreate a voucher
      • POSTCreate redeem voucher request
      • POSTComplete redeem voucher request
      • DELRevoke vouchers
      • POSTValidate a reward
LogoLogo
Help CenterAPI KeysStatusSign In
LoyaltyReward

Create a voucher

POST
https://api.brevo.com/v3/loyalty/offer/programs/:pid/rewards/attribute
POST
/v3/loyalty/offer/programs/:pid/rewards/attribute
1import { BrevoClient } from "@getbrevo/brevo";
2
3async function main() {
4 const client = new BrevoClient({
5 apiKey: "YOUR_API_KEY_HERE",
6 });
7 await client.reward.createVoucher("pid", {
8 rewardId: "string",
9 });
10}
11main();
1{
2 "code": "string",
3 "consumedAt": "string",
4 "contactId": 1,
5 "createdAt": "2024-01-15T09:30:00Z",
6 "expirationDate": "2024-01-15T09:30:00Z",
7 "id": "string",
8 "loyaltyProgramId": "string",
9 "meta": {},
10 "rewardId": "string",
11 "updatedAt": "2024-01-15T09:30:00Z",
12 "value": 1.1,
13 "validFrom": "2024-01-15T09:30:00Z"
14}
Create a voucher and attribute it to a specific membership.
Was this page helpful?
Previous

Create redeem voucher request

Next
Built with

Authentication

api-keystring

The API key should be passed in the request headers as api-key for authentication.

Path parameters

pidstringRequiredformat: "uuid"
Loyalty Program ID

Request

This endpoint expects an object.
rewardIdstringRequiredformat: "uuid"
Reward id
codestringOptional<=128 characters
Code generated to attribute reward to a contact
contactIdlongOptional>=1
Contact to attribute the reward
expirationDatestringOptional
Reward expiration date
loyaltySubscriptionIdstringOptional
One of contactId or loyaltySubscriptionId is required
metamap from strings to anyOptional

Offer meta information (key/value object)

valuedoubleOptional0.01-99999999.99
Value of the selected reward config
validFromstringOptional

Date from which the voucher becomes valid. Accepts RFC 3339 or DD/MM/YYYY HH:MM AM/PM format. Converted to UTC using the organization’s timezone.

Response

Voucher successfully created
codestring
Generated code
consumedAtstring
Timestamp for when this reward was consumed
contactIdlong
Id of the contact that attributed the reward
createdAtdatetime
Timestamp for when this reward was created
expirationDatedatetime
Expiration date of the reward
idstringformat: "uuid"
Unique identifier
loyaltyProgramIdstring
Loyalty Program Id to which attributed reward belongs
metamap from strings to any
Additional data to define the reward
rewardIdstring
Unique identifier for the reward
updatedAtdatetime
Timestamp for when this reward was updated
valuedouble
Value of the selected reward config
validFromdatetime
Date from which the voucher becomes valid

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
500
Internal Server Error