Bonbon Rewards API (1.0.0)

Download OpenAPI specification:Download

The Bonbon Rewards API allows you to create rewarded experiences for users on the Open Internet. Our offer database is made publicly avaialable here & us refreshed nightly: https://cdn.bonbon.tech/offers

/earn/otp

Initiate a request for an earn token using the email OTP code flow. Dispatches an email with an OTP code the end user will later enter into your form to complete authentication & generate an earn token. The email will be branded per the clientId provided.

header Parameters
x-bonbon-clientid
string
Examples:
  • ZcE2tPCuUMvRAkFiDkHyKQ1k4zR3kmda - The Client ID
Request Body schema: application/json
required

The payload to begin an OTP code authentication.

email
string

The user's email address

Responses

Request samples

Content type
application/json
{
  • "email": "test-user@bonbon.tech"
}

Response samples

Content type
application/json
{
  • "message": "Email sent to test-user@bonbon.tech"
}

/earn/otp-token

Exchange an email address / OTP code pair for an earn token. To be called after a successful call to /earn/otp, this method will return an earn token if the email and OTP code provided match expectations.

header Parameters
x-bonbon-clientid
string
Examples:
  • ZcE2tPCuUMvRAkFiDkHyKQ1k4zR3kmda - The Client ID
Request Body schema: application/json
required

The payload to exchange an email / OTP code pair for an earn token

email
string

The user's email address

otp
string

The OTP code for the given email address

reward
string

The ID of the reward from

preferences
object

An object set of key/value pairs representing the user's preferences must at least include the keys pAds and newsletter with boolean values representing the user's personalized ads and newsletter preferences, respectively.

lastLoginUrl
string

The URL where the user is logging in from

bonbons
integer

The number of Bonbons to reward the user for logging in

Responses

Request samples

Content type
application/json
{
  • "email": "test-user@bonbon.tech",
  • "otp": "123456",
  • "reward": "airpods_v1",
  • "preferences": {
    },
  • "lastLoginUrl": "https://bonbon.tech",
  • "bonbons": 10
}

Response samples

Content type
application/json
{
  • "earnToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
  • "signUp": true
}

/earn/oidc-token

Exchange an OIDC ID Token for an earn token. Used to perform an immediate exchange of an OIDC ID Token for an earn token. Ensure your JWKS is configured for your client ID to use this method.

header Parameters
x-bonbon-clientid
string
Examples:
  • ZcE2tPCuUMvRAkFiDkHyKQ1k4zR3kmda - The Client ID
Request Body schema: application/json
required

The payload to exchange an OIDC token for an earn token

token
string

The user's OIDC ID token.

provider
string

One of googlegsi, openpass, bonbonsso.

reward
string

The ID of a reward from our reward catalog.

preferences
string

An flat object of key/value pairs of preferences.

lastLoginUrl
string

The URL where the user is signing in.

bonbons
integer

The number of Bonbons to reward the user for signing in.

Responses

Request samples

Content type
application/json
{
  • "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imkwd25uIn0.eyJzdWIiOiJqb2UiLCJhdWQiOiJpbV9vaWNfY2xpZW50IiwianRpIjoidWY5MFNLNHdzY0ZoY3RVVDZEdHZiMiIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTAzMSIsImlhdCI6MTM5NDA2MDg1MywiZXhwIjoxMzk0MDYxMTUzLCJub25jZSI6ImU5NTdmZmJhLTlhNzgtNGVhOS04ZWNhLWFlOGM0ZWY5Yzg1NiIsImF0X2hhc2giOiJ3Zmd2bUU5VnhqQXVkc2w5bGM2VHFBIn0",
  • "provider": "bonbonsso",
  • "reward": "airpods_v1",
  • "preferences": {
    },
  • "lastLoginUrl": "https://bonbon.tech",
  • "bonbons": 10
}

Response samples

Content type
application/json
{
  • "earnToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
  • "signUp": true
}

/earn

Called to log an earn action and credit the user associated with the earn token. Credits a user for a site activity.

header Parameters
x-bonbon-clientid
string
Examples:
  • ZcE2tPCuUMvRAkFiDkHyKQ1k4zR3kmda - The Client ID
Authorization
string
Examples:
  • Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Imkwd25uIn0.eyJzdWIiOiJqb2UiLCJhdWQiOiJpbV9vaWNfY2xpZW50IiwianRpIjoidWY5MFNLNHdzY0ZoY3RVVDZEdHZiMiIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTAzMSIsImlhdCI6MTM5NDA2MDg1MywiZXhwIjoxMzk0MDYxMTUzLCJub25jZSI6ImU5NTdmZmJhLTlhNzgtNGVhOS04ZWNhLWFlOGM0ZWY5Yzg1NiIsImF0X2hhc2giOiJ3Zmd2bUU5VnhqQXVkc2w5bGM2VHFBIn0 - The earn bearer token

Responses

Response samples

Content type
application/json
{
  • "message": "ok"
}

/user

Called to fetch how many bonbons the user has accumulated and the latest reward they've expressed interest in winning.

header Parameters
x-bonbon-clientid
string
Examples:
  • ZcE2tPCuUMvRAkFiDkHyKQ1k4zR3kmda - The Client ID
Authorization
string
Examples:
  • Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Imkwd25uIn0.eyJzdWIiOiJqb2UiLCJhdWQiOiJpbV9vaWNfY2xpZW50IiwianRpIjoidWY5MFNLNHdzY0ZoY3RVVDZEdHZiMiIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTAzMSIsImlhdCI6MTM5NDA2MDg1MywiZXhwIjoxMzk0MDYxMTUzLCJub25jZSI6ImU5NTdmZmJhLTlhNzgtNGVhOS04ZWNhLWFlOGM0ZWY5Yzg1NiIsImF0X2hhc2giOiJ3Zmd2bUU5VnhqQXVkc2w5bGM2VHFBIn0 - The earn bearer token

Responses

Response samples

Content type
application/json
{
  • "auth": {
    },
  • "user_id": "email|64641ae9fcc2eef15f95a412",
  • "user_metadata": {
    }
}

/jwt

Generates a signed and encrypted JWT Bonbon ID Token for your user.

header Parameters
x-bonbon-clientid
string
Examples:
  • ZcE2tPCuUMvRAkFiDkHyKQ1k4zR3kmda - The Client ID
x-bonbon-api-key
string
Examples:
  • ff63ea8a09b4b8c2c0902e6469a36fc2f381558af40ece270a5681bfbca777a2 - Your Bonbon API Client Secret
Request Body schema: application/json
required

The payload to begin an OTP code authentication.

email
string

The user's email address

emailVerified
boolean

A boolean flag indicating whether the user has verified their email address in your system.

Responses

Request samples

Content type
application/json
{
  • "email": "test-user@bonbon.tech",
  • "emailVerified": true
}

Response samples

Content type
application/json
{
  • "message": "eyJhbGciOiJIUzI1NiJ9.eyJSb2xlIjoiQWRtaW4iLCJJc3N1ZXIiOiJJc3N1ZXIiLCJVc2VybmFtZSI6IkphdmFJblVzZSIsImV4cCI6MTcxNDA1MDUzNiwiaWF0IjoxNzE0MDUwNTM2fQ.lfhqUGBexVpL1HABA34lhwK35UvXfPbUcN6f_xWDK1s"
}