Skip to content

Record Campaign Event

POST /v1/campaigns/{slug}/events

Records a user event in the campaign. The campaign engine evaluates the event against configured mechanics and returns the result, including points earned, milestone progress, and instant-win outcomes.

HeaderRequiredValue
X-API-SecretYesYour secret key
Content-TypeYesapplication/json
FieldTypeRequiredDescription
userIdstringYesThe user’s ID in your system
eventTypestringYesEvent type (e.g., purchase, signup, daily_login)
metadataobjectNoArbitrary key-value data stored with the event
Terminal window
curl -X POST https://api.gamifyhost.com/v1/campaigns/summer-promo/events \
-H "X-API-Secret: sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"userId": "user_12345",
"eventType": "purchase",
"metadata": {
"amount": 49.99,
"product": "premium_plan"
}
}'

Status: 200 OK

{
"status": "success",
"data": {
"pointsEarned": 100,
"totalPoints": 750,
"instantWin": {
"won": true,
"prizeTier": "Gold",
"pointsEarned": 500,
"winCode": "SUMM-AX7K9M2P",
"message": "Congratulations! You won the Gold prize!"
},
"message": "Event recorded successfully"
}
}
FieldTypeDescription
pointsEarnedintegerPoints earned from the event
totalPointsintegerParticipant’s total points in this campaign
instantWinobjectPresent if instant-win mechanic is enabled
instantWin.wonbooleanWhether the user won
instantWin.prizeTierstringName of the prize tier (if won)
instantWin.winCodestringUnique redemption code (if won)
messagestringHuman-readable status message
CodeMessage
400Invalid request body
404Campaign not found or not active
409User has exceeded maximum plays