This reference documents the LoyaltySurf REST API, including all available public methods and examples of each.
Open in Postman
Easily test these API methods dynamically by using our Postman Collection. Just change the Token in the Authorizations tab, and the campaign_id variable to the campaign you're working on.
Campaigns
Get Campaign
GEThttps://api.loyaltysurf.io/v1/campaign/:id
Retrieves a campaign for the given ID.
Path Parameters
{"id": "abc123","name": "Pied Piper Advocate Program","loyaltyActionCount": 121,"participantCount": 199,"winnerCount": 1,"status": "IN_PROGRESS","rewards": [ {"id":"xyz789","description":"Make a LinkedIn post mentioning Pied Piper","subdescription":"Post must be less than 1 week old from date of submission", "instructions": "<div><p><strong>Helpful tips:</strong></p><ul><li>Talk about how you used to do things before using Pied Piper</li><li>Mention specific ROIs (e.g, time saved, revenue generated)</li></ul></div>",
"cta":"Get $25","submissionType":"URL", "submissionExampleUrl": "https://linkedin.com/posts/sarah_s-my-review-of-pied-piper-8195769799870726145-Sr9b",
"submissionFormUrl":"https://linkedin.com/shareArticle","submissionFormFields": [ {"key":"linkedinPostUrl","label":"Your LinkedIn Post URL","placeholder":"Enter your LinkedIn Post URL here","type":"text","isRequired":true,"isVisible":true } ],"submissionFormButtonText":"Submit","submissionFormMessages": {"required":"is required","reCaptchaRequired":"You must pass the reCAPTCHA verification.","success":"Thanks! We have received your response.","error":"There was an error. Please try submitting again.","alreadySubmitted":"You already submitted this form." },"isUnlimited":false,"limit":1,"conversionsRequired":1, "imageUrl": "http://res.cloudinary.com/loyaltysurf/image/upload/v1552764861/development/hxdcjrayfhksvxu5u6oz.png"
} ]}
Get Campaigns
GEThttps://api.loyaltysurf.io/v1/campaigns
Retrieves a list of your campaigns. Campaigns that have been deleted will not be returned in this response.
{"campaigns": [ {"id":"abc123","name":"Pied Piper Advocate Program","loyaltyActionCount":20500,"participantCount":40000,"winnerCount":1500,"status":"IN_PROGRESS","rewards": [ {"id":"xyz789","description":"Make a LinkedIn post mentioning Pied Piper","subdescription":"Post must be less than 1 week old from date of submission", "instructions": "<div><p><strong>Helpful tips:</strong></p><ul><li>Talk about how you used to do things before using Pied Piper</li><li>Mention specific ROIs (e.g, time saved, revenue generated)</li></ul></div>",
"cta":"Get $25","submissionType":"URL", "submissionExampleUrl": "https://linkedin.com/posts/sarah_s-my-review-of-pied-piper-8195769799870726145-Sr9b",
"submissionFormUrl":"https://linkedin.com/shareArticle","submissionFormFields": [ {"key":"linkedinPostUrl","label":"Your LinkedIn Post URL","placeholder":"Enter your LinkedIn Post URL here","type":"text","isRequired":true,"isVisible":true } ],"submissionFormButtonText":"Submit","submissionFormMessages": {"required":"is required","reCaptchaRequired":"You must pass the reCAPTCHA verification.","success":"Thanks! We have received your response.","error":"There was an error. Please try submitting again.","alreadySubmitted":"You already submitted this form." },"isUnlimited":false,"limit":1,"conversionsRequired":1, "imageUrl": "http://res.cloudinary.com/loyaltysurf/image/upload/v1552764861/development/hxdcjrayfhksvxu5u6oz.png"
} ] }, {"id":"ljtqn5","name":"Pied Piper Advocate Program #2","loyaltyActionCount":30500,"participantCount":60000,"winnerCount":750,"status":"IN_PROGRESS","rewards": [ {"id":"qiar1r","description":"Make an X (Twitter) post about Pied Piper","subdescription":"Post must be less than 1 week old from date of submission", "instructions": "<div><p><strong>Helpful tips:</strong></p><ul><li>Talk about how you used to do things before using Pied Piper</li><li>Mention specific ROIs (e.g, time saved, revenue generated)</li></ul></div>",
"cta":"Get $15","submissionType":"URL","submissionExampleUrl":"https://x.com/Sarah_S/status/2307836134014308344","submissionFormUrl":"https://x.com/compose/post","submissionFormFields": [ { key:"twitterPostUrl", label:"Your Twitter Post URL", placeholder:"Enter your Twitter Post URL here", isRequired:true, isVisible:true } ],"submissionFormButtonText":"Submit","submissionFormMessages": {"required":"is required","reCaptchaRequired":"You must pass the reCAPTCHA verification.","success":"Thanks! We have received your response.","error":"There was an error. Please try submitting again.","alreadySubmitted":"You already submitted this form." },"isUnlimited":false,"limit":1,"conversionsRequired":1, "imageUrl": "http://res.cloudinary.com/loyaltysurf/image/upload/v1552764861/development/hxdcjrayfhksvxu5u6oz.png"
} ] } ]}
Triggers a loyalty action for a person, awarding loyalty action credit to them and adds them to the campaign as a participant if they do not already exist.
If the required number of loyalty actions of the campaign reward is reached, then the reward will be unlocked.
Retrieves a list of participants in the campaign ordered by loyalty action count in ascending order.
Monthly Loyalty Action Count Leaderboard
You can retrieve the campaign leaderboard ordered by the monthly loyalty action count by providing a query parameter leaderboardType with a value of CURRENT_MONTH. This will retrieve a list of participants ordered by monthly loyalty action.
Monthly loyalty action counts are automatically reset at the end of each month for each participant within your campaign, therefore results of the monthly loyalty action count may vary.
Previous Monthly Loyalty Action Count Leaderboard
Similar to the monthly campaign leaderboard, providing a query parameter of leaderboardType with a value of PREV_MONTH will retrieve a list of participants ordered by the previous monthly loyalty action count.
Participants that did not exist within the campaign during the previous month will not be returned within the previous monthly leaderboard response.
{"name": "BadRequestError","code": "BAD_REQUEST_ERROR","message": "Invalid request. Request params are missing or are invalid","status": 400,"supportUrl": "https://loyaltysurf.io/settings#contact_support","errors": [ {"location":"query","param":"limit","value":"20","msg":"Limit cannot be more than 10." } ],"level": "error","timestamp": "2019-12-31T22:07:49.957Z"}
Retrieves a list of rewards earned by a participant.
Paging this response
Each response will contain a nextId, that value is the id of the next participant and not the email therefore, you must use this endpoint in conjunction of our Get Participant Rewards by ID endpoint if you wish to page results starting with this endpoint. To page you would provide the nextId as the participantId path parameter within the Get Participant Rewards by ID request.
Approve a reward that was earned by a participant.
You should only use this endpoint if your reward automation level is set to Manually approve rewards (learn more here). This means ParticipantRewards will be generated with status: "PENDING", approved: false, and isFulfilled: false.
Calling this endpoint to approve a reward will cause New Participant Reward emails to be sent out and automations/integrations to be triggered. If you are using Webhooks to automate rewards, a new PARTICIPANT_REACHED_A_GOAL event will be emitted with data.reward.approved as false.
Path Parameters
Request Body
{"success": true}
{"name": "InvalidRewardState","code": "INVALID_REWARD_STATE","message": "Invalid reward state. Reward has already been approved.","status": 406,"supportUrl": "https://loyaltysurf.io/settings#contact_support","level": "error","timestamp": "2019-10-13T16:43:05.902Z"}
Fulfill a reward that was earned by a participant (this can only be done if the reward is already approved). When you call this endpoint, the ParticipantReward should have the following key-values: status: "PENDING", approved: true, and isFulfilled: false.
Fulfilling a reward does not trigger any emails or automations. It helps you stay organized when managing rewards from your LoyaltySurf admin dashboard.
Path Parameters
{"success": true}
{"name": "InvalidRewardState","code": "INVALID_REWARD_STATE","message": "Invalid reward state. Reward has already been fulfilled.","status": 406,"supportUrl": "https://loyaltysurf.io/settings#contact_support","level": "error","timestamp": "2019-10-13T16:43:05.902Z"}
Remove a reward that was earned by a participant.
This only applies if your campaign was configured with manual reward approval and if the provided participant reward has not been approved.
Path Parameters
{"success": true}
{"name": "InvalidRewardState","code": "INVALID_REWARD_STATE","message": "Invalid reward state. This reward has already been approved and cannot be removed.","status": 406,"supportUrl": "https://loyaltysurf.io/settings#contact_support","level": "error","timestamp": "2019-10-17T16:43:05.902Z"}