Skip to Content
🚀 Finally launched — the long-awaited @incenta/sdk is live on npm. Get it →
DocsAPI Reference

API Reference

Base URL: https://incenta.dev/api/v1

All endpoints require a Bearer token in the Authorization header.


Referrals

Create a referral code

POST /referrals

Generate a unique referral code for a campaign.

curl -X POST https://incenta.dev/api/v1/referrals \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "campaignId": "camp_abc123", "referrerId": "user_456" }'

Request body:

FieldTypeRequiredDescription
campaignIdstringYesCampaign identifier
referrerIdstringYesID of the user creating the referral
refereeIdstringNoID of the referred user (if known)
referrerUsernamestringNoDisplay name for the referrer
referrerEmailstringNoEmail of the referrer

Response 201:

{ "referralCode": "ABC123", "referralId": "ref_789", "status": "PENDING", "warning": null, "reasons": null, "riskScore": null }

The response may include warning, reasons, and riskScore if the fraud detection system flagged the referral.

Lookup a referral

GET /referrals/{referralCode}

Get details about a specific referral code.

curl https://incenta.dev/api/v1/referrals/ABC123 \ -H "Authorization: Bearer rk_xxxxx"

Response 200:

{ "referral": { "id": "ref_789", "referralCode": "ABC123", "referrerId": "user_456", "refereeId": "user_789", "status": "PENDING", "level": 1, "rewardAmount": 5.00, "isFlagged": false, "createdAt": "2026-06-18T12:00:00.000Z", "Campaign": { "id": "camp_001", "name": "Summer Campaign", "status": "ACTIVE" } } }

Clicks

Track a click

POST /clicks

Record when a user clicks a referral link.

curl -X POST https://incenta.dev/api/v1/clicks \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "referralCode": "ABC123", "refereeId": "user_789" }'

Request body:

FieldTypeRequiredDescription
referralCodestringYesThe referral code that was clicked
refereeIdstringNoID of the user who clicked

Response 200:

{ "success": true, "clickId": "click_123", "referralCode": "ABC123", "clickedAt": "2026-06-18T12:00:00.000Z" }

Conversions

Record a conversion

POST /conversions

Record that a referred user completed a desired action.

curl -X POST https://incenta.dev/api/v1/conversions \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "referralCode": "ABC123", "refereeId": "user_789", "amount": 49.99, "metadata": { "orderId": "order_xyz" } }'

Request body:

FieldTypeRequiredDescription
referralCodestringYesThe referral code
refereeIdstringYesID of the user who converted
amountnumberNoMonetary value of the conversion
metadataobjectNoArbitrary key-value data

Response 201:

{ "success": true, "referralId": "ref_789", "conversionId": "conv_456", "rewardAmount": 5.00, "rewardCreated": true, "status": "COMPLETED", "refereeId": "user_789", "referrerId": "user_456" }

Fraud detection runs automatically. If the referral is flagged, the response includes warning and reasons fields.

List conversions

GET /conversions

Query parameters: ?campaignId&referralCode&status&page&limit

ParamTypeDescription
campaignIdstringFilter by campaign
referralCodestringFilter by original referral code
statusstringPENDING, CLICKED, CONVERTED, FLAGGED
pagenumberPage number (default: 1)
limitnumberItems per page (default: 25, max: 100)

Response 200:

{ "conversions": [ { "id": "conv_456", "referralCode": "XYZ789", "referrerId": "user_456", "refereeId": "user_789", "status": "CONVERTED", "rewardAmount": 5.00, "level": 1, "originalReferralCode": "ABC123", "convertedAt": "2026-06-20T12:00:00.000Z", "Campaign": { "id": "camp_001", "name": "Summer Campaign" } } ], "pagination": { "page": 1, "limit": 25, "totalItems": 1, "totalPages": 1 } }

Stats

Get referral stats

GET /stats

Aggregated statistics for a campaign.

curl "https://incenta.dev/api/v1/stats?campaignId=camp_abc123" \ -H "Authorization: Bearer rk_xxxxx"

Query parameters:

ParamTypeRequiredDescription
campaignIdstringYesCampaign to get stats for

Response 200:

{ "totalReferrals": 142, "totalClicks": 89, "totalConversions": 34, "conversionRate": 38.2, "totalRewardValue": 169.99 }

Rewards

List rewards

GET /rewards

Query parameters: ?userId&status&fulfillmentType&page&limit

ParamValues
statusPENDING, APPROVED, PAID, CANCELLED
fulfillmentTypeDISCOUNT_CODE, COUPON_CODE, MANUAL, AUTOMATED, GIFT_CARD, CUSTOM

Get a reward

GET /rewards/{rewardId}

Claim a reward

POST /rewards/{rewardId}/claim

Claims a reward and returns a discount code or coupon.

curl -X POST https://incenta.dev/api/v1/rewards/rew_xyz/claim \ -H "Authorization: Bearer rk_xxxxx"

Response 200:

{ "success": true, "discountCode": "SAVE20", "expiresAt": "2026-07-06T12:00:00.000Z" }

Validate a code

GET /rewards/validate

Query: ?code=DISCOUNT123

Returns whether the discount or coupon code is valid and its details.

curl "https://incenta.dev/api/v1/rewards/validate?code=DISCOUNT123" \ -H "Authorization: Bearer rk_xxxxx"

Response 200:

{ "valid": true, "code": "DISCOUNT123", "type": "PERCENTAGE", "discount": 20, "expiresAt": "2026-08-06T12:00:00.000Z" }

Redeem a reward

POST /rewards/redeem

Marks a reward as fulfilled/redeemed.

curl -X POST https://incenta.dev/api/v1/rewards/redeem \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "rewardId": "reward_xyz", "userId": "user_456" }'

Request body:

FieldTypeRequiredDescription
rewardIdstringYesID of the reward to redeem
userIdstringYesID of the user redeeming the reward

List user rewards

GET /users/{userId}/rewards

Incentive Engine

The incentive engine powers gamification: actions, XP, levels, badges, coins, tokens, and leaderboards.

Actions

GET /incentives/actions POST /incentives/actions PATCH /incentives/actions/{key}

Define actions that users can perform to earn coins, XP, and tokens. Each action has a cooldown, max repeats, and configurable rewards.

curl -X POST https://incenta.dev/api/v1/incentives/actions \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "key": "complete_profile", "name": "Complete Profile", "type": "STANDARD", "coins": 50, "xp": 100, "maxRepeats": 1 }'

POST body:

FieldTypeRequiredDescription
keystringYesUnique action key
namestringYesDisplay name
typestringYesSTANDARD, REFERRAL_CODE_GENERATE, REFERRAL_CLICK, or REFERRAL_REFEREE_ACTION
coinsnumberNoCoins awarded
xpnumberNoXP awarded
tokensnumberNoTokens awarded
cooldownnumberNoCooldown in seconds
maxRepeatsnumberNoMax times a user can earn this reward

Events

GET /incentives/events POST /incentives/events POST /incentives/events/bulk

Record a user completing an action.

curl -X POST https://incenta.dev/api/v1/incentives/events \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "userId": "user_456", "actionKey": "complete_profile", "idempotencyKey": "idem_abc123", "metadata": { "source": "web" } }'

POST /incentives/events body:

FieldTypeRequiredDescription
userIdstringYesUser identifier
actionKeystringYesKey of the action completed
idempotencyKeystringNoPrevents duplicate processing
metadataobjectNoAdditional data
curl -X POST https://incenta.dev/api/v1/incentives/events/bulk \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "events": [ { "userId": "user_456", "actionKey": "daily_login", "idempotencyKey": "user_login_1" }, { "userId": "user_456", "actionKey": "share_product", "idempotencyKey": "user_share_1" } ] }'

POST /incentives/events/bulk body:

FieldTypeRequiredDescription
eventsarrayYesArray of event objects

Each event object supports the same fields as a single event:

FieldTypeRequiredDescription
userIdstringYesUser identifier
actionKeystringYesKey of the action completed
idempotencyKeystringNoPrevents duplicate processing
metadataobjectNoAdditional data

Balances

GET /incentives/balances GET /incentives/balances/{userId}

Get user coin, token, and XP balances.

Levels

GET /incentives/levels POST /incentives/levels PATCH /incentives/levels/{level} DELETE /incentives/levels/{level}

Define XP thresholds for levels. Each level can grant coins, a badge, and perks.

Badges

GET /incentives/badges POST /incentives/badges PATCH /incentives/badges/{key} GET /incentives/badges/user/{userId}

Define and award badges to users.

Catalog

GET /incentives/catalog POST /incentives/catalog GET /incentives/catalog/{itemId} PATCH /incentives/catalog/{itemId} DELETE /incentives/catalog/{itemId}

Create redeemable items that users can buy with coins or tokens.

Response 200:

{ "items": [ { "id": "item_xyz", "name": "10% Discount Code", "description": "Get 10% off your next order", "coinCost": 500, "tokenCost": 0, "inventory": -1, "published": true } ], "pagination": { "page": 1, "limit": 25, "totalItems": 1, "totalPages": 1 } }
curl -X POST https://incenta.dev/api/v1/incentives/catalog \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "10% Discount Code", "description": "Get 10% off your next order", "coinCost": 500, "inventory": -1, "published": true }'

POST body:

FieldTypeRequiredDescription
namestringYesDisplay name of the item
descriptionstringNoDescription of the item
coinCostnumberYesCost in coins
tokenCostnumberNoCost in tokens (default: 0)
inventorynumberNoStock count (-1 for unlimited)
publishedbooleanNoWhether the item is visible to users

Redemptions

POST /incentives/redeem GET /incentives/redemptions PATCH /incentives/redemptions/{id}

Users redeem catalog items. Statuses: PENDING, FULFILLED, CANCELLED.

Response 200:

{ "redemptions": [ { "id": "redemption_xyz", "userId": "user_456", "itemId": "item_xyz", "status": "PENDING", "redeemedAt": "2026-07-06T12:00:00.000Z" } ], "pagination": { "page": 1, "limit": 25, "totalItems": 1, "totalPages": 1 } }
curl -X POST https://incenta.dev/api/v1/incentives/redeem \ -H "Authorization: Bearer rk_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "userId": "user_456", "itemId": "item_xyz" }'

POST /incentives/redeem body:

FieldTypeRequiredDescription
userIdstringYesID of the user redeeming
itemIdstringYesID of the catalog item to redeem

PATCH /incentives/redemptions/{id} body:

FieldTypeRequiredDescription
statusstringYesNew status: FULFILLED or CANCELLED

Leaderboard

GET /incentives/leaderboard POST /incentives/leaderboard GET /incentives/leaderboard/{userId} POST /incentives/leaderboard/refresh

Real-time leaderboard ranked by XP, with periodic snapshots.

curl https://incenta.dev/api/v1/incentives/leaderboard?limit=10 \ -H "Authorization: Bearer rk_xxxxx"

POST /incentives/leaderboard body:

FieldTypeRequiredDescription
userIdstringYesUser identifier
xpnumberYesXP score
coinsnumberNoCoin balance

Milestones

GET /incentives/milestones

List milestones achieved by users (e.g., “1000 XP reached”).


Marketplace

The rewards marketplace lets businesses list rewards that users from other apps can redeem with coins or tokens.

List public listings

GET /incentives/marketplace/public/listings GET /incentives/marketplace/public/listings/{id}

Browse available marketplace listings and get details on a specific listing.

Verify a redemption

GET /incentives/marketplace/verify/{id}

Verify the validity of a marketplace redemption code.


User Endpoints

Get user stats

GET /users/{userId}/stats
curl "https://incenta.dev/api/v1/users/user_456/stats?campaignId=camp_abc123" \ -H "Authorization: Bearer rk_xxxxx"

Get aggregated referral statistics for a specific user.

List user rewards

GET /users/{userId}/rewards
curl "https://incenta.dev/api/v1/users/user_456/rewards?limit=10" \ -H "Authorization: Bearer rk_xxxxx"

List all rewards earned by a specific user.

Last updated on