API Reference
This reference documents the LoyaltySurf REST API, including all available public methods and examples of each.
Last updated
This reference documents the LoyaltySurf REST API, including all available public methods and examples of each.
Last updated
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.
GET
https://api.loyaltysurf.io/v1/campaign/:id
Retrieves a campaign for the given ID.
Name | Type | Description |
---|---|---|
GET
https://api.loyaltysurf.io/v1/campaigns
Retrieves a list of your campaigns. Campaigns that have been deleted will not be returned in this response.
POST
https://api.loyaltysurf.io/v1 /campaign/:id/loyalty-action
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.
Metadata: Please see our API Guidelines for more information about metadata.
POST
https://api.loyaltysurf.io/v1/campaign/:id/loyalty-action
Triggers a loyalty action for an existing participant.
If the required number of loyalty actions of the campaign reward is reached, then the reward will be unlocked.
GET
https://api.loyaltysurf.io/v1/campaign/:id/participant/:participantId
Retrieves a single participant from a campaign using the given participant ID.
GET
https://api.loyaltysurf.com/v1/campaign/:id/participant/:participantEmail
Retrieves a single participant from a campaign using the given participant email.
GET
https://api.loyaltysurf.io/v1/campaign/:id/participants
Retrieves a list of participants in the campaign.
GET
https://api.loyaltysurf.io/v1/campaign/:id/leaderboard
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.
POST
https://api.loyaltysurf.io/v1/campaign/:id/participant
Adds a participant to the campaign.
Metadata: Please see our API Guidelines for more information about metadata.
POST
https://api.loyaltysurf.io/v1/campaign/:id/participant/:participantId
Updates a participant within the campaign using the ID of the participant.
*Please see our API Guidelines for more information about metadata.
POST
https://api.loyaltysurf.io/v1/campaign/:id/participant/:participantEmail
Updates a participant within the campaign using the email of the participant.
*Please see our API Guidelines for more information about metadata.
DELETE
https://api.loyaltysurf.io/v1/campaign/:id/participant/:participantId
Removes a participant within the campaign using the ID of the participant.
DELETE
https://api.loyaltysurf.io/v1/campaign/:id/participant/:participantEmail
Removes a participant within the campaign using the email of the participant.
GET
https://api.loyaltysurf.io/v1/campaign/:id/participant/:participantId/rewards
Retrieves a list of rewards earned by a participant.
GET
https://api.loyaltysurf.io/v1/campaign/:id/participant/:participantEmail/rewards
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.
POST
https://api.loyaltysurf.io/v2/campaign/:id/reward/:rewardId/approve
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
.
POST
https://api.loyatysurf.io/v1/campaign/:id/reward/:rewardId/fulfill
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.
DELETE
https://api.loyaltysurf.io/v1/campaign/:id/reward/:rewardId
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.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
id*
string
The ID of the campaign
participantEmail*
string
The email of the person that performed the loyalty action. If the person already exists as a participant, then their loyalty action count will be incremented.
rewardId*
string
The campaign reward ID that the participant will earn upon completing the required number of loyalty actions.
addParticipantIfNoneExists
boolean
Adds the person to the campaign as a participant if they do not already exist. Defaults to true
.
metadata
object
A shallow Object containing custom key/values to include with the participant data.
id*
string
The ID of the campaign
participantId*
string
The ID of the participant that performed the loyalty action.
rewardId*
String
The campaign reward ID that the participant will earn upon completing the required number of loyalty actions.
id*
string
The ID of the campaign to retrieve the participant from
participantId*
string
The ID of the participant to retrieve
id*
string
The ID of the campaign to retrieve the participant from
participantEmail*
string
The email of the participant to retrieve
id*
string
The ID of the campaign
nextId
string
The ID of the participant to start the next result set with. This can be used to skip through the list or to page the list results. Each response will provide a nextId
value if there are more participants otherwise the nextId
value will be null
.
limit
integer
The number of participants to return. Must be a value less than or equal to 100 which is currently the maximum we allow with this request.
id*
string
The ID of the campaign
nextId
string
The ID of the participant to start the next result set with. This can be used to skip through the list or to page the list of results. Each response will provide a nextId
value if there are more participants otherwise, nextId
will be null
.
limit
string
The number of participants to return. Must be a value less than or equal to 100 and greater than 1. 100 is currently the maximum limit per reach request.
leaderboardType
string
Returns the leaderboard for the specified type if provided.
Options
ALL_TIME
- Returns the all-time leaderboard, based on all-time loyalty action counts. Default
CURRENT_MONTH
- Returns the current month's leaderboard, based on the current month's loyalty action counts.
PREV_MONTH
- Returns the previous month's leaderboard, based on the previous month's loyalty action counts (With this option, participants that did not exist within the campaign during the previous month will not be returned).
id*
string
The ID of the campaign to add the new participant to
email*
string
The email of the new participant
firstName
string
The first name of the new participant
lastName
string
The last name of the new participant
ipAddress
string
The IP address of the new participant (if provided, this property will be used for anti-fraud purposes)
metadata
object
A shallow Object containing custom key/values to include with the participant data.
id*
string
The ID of the campaign
participantId*
string
The ID of the participant
string
The new email to assign to this participant. If the given email is already assigned to another participant within the campaign, an error response will be returned.
firstName
string
The first name of the participant.
lastName
string
The last name of the participant
metadata
object
A shallow Object containing custom values to include in the participant data.
If any existing metadata exists for the participant, any new values provided will be appended to the existing metadata, any existing values provided will overwrite and replace the existing metadata.*
To remove any existing metadata set its value to null
.
unsubscribed
boolean
The participant's unsubscribed status. If true
, they will not receive any campaign emails.
id*
string
The campaign ID
participantEmail*
string
The participant email
string
The new email to assign to the participant. If the given email is already assigned to another participant within the campaign, an error response will be returned.
firstName
string
The first name of the participant
lastName
string
The last name of the participant
metadata
object
A shallow Object containing custom values to include in the participant data.
If any existing metadata exists for the participant, any new values provided will be appended to the existing participant metadata, any existing values provided will overwrite and replace the existing metadata.*
To remove existing metadata set its value to null
.
unsubscribed
boolean
The participant's unsubscribed status. If true
, they will not receive any campaign emails.
id*
string
The ID of the campaign
participantId*
string
The ID of the participant
id*
string
The campaign ID
participantEmail*
string
The participant email
id*
string
The campaign ID
participantId*
string
The participant's unique ID or email
nextId
string
The id of the participant reward to start the next result set with. This can be used to skip through the list or to page the list of results. Each response will provide a nextId
value if there are more rewards otherwise the nextId
will be null
.
limit
string
The number of rewards to return. Must be a value less than or equal to 100, which is currently the maximum allowed per request.
id*
string
The id of the campaign.
participantEmail*
string
The participant email
nextId
string
The id of the participant reward to start the next result set with. This can be used to skip through the list or to page the list of results. Each response will provide a nextId
value if there are more rewards otherwise the nextId
will be null
.
limit
string
The number of rewards to return. Must be a value less than or equal to 100, which is currently the maximum allowed per request.
id*
string
The campaign ID
rewardId*
string
The ID of the participant reward to approve
fulfill
boolean
Set true
to mark the reward as fulfilled.
Fulfilling a reward does not trigger any emails or automations. It helps you stay organized when managing rewards from your LoyaltySurf admin dashboard.
id*
string
The campaign ID
rewardId*
string
The ID of the participant reward to fulfill
id*
string
The campaign ID
rewardId*
string
The ID of the participant reward to remove
id*
string
The ID of the campaign to retrieve