Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.shakesco.com/llms.txt

Use this file to discover all available pages before exploring further.

For the complete documentation index, see llms.txt.

Overview

Integrating the Shakesco loyalty program takes three steps:
  1. Launch your token via the Shakesco app (guide)
  2. Configure your events by setting up what actions earn tokens (dashboard or API)
  3. Call the API from your backend to award tokens when customers take those actions
All API calls go to https://tokens.shakesco.com with your API key.

Step 1: Get Your API Key

Generate a key from users.shakesco.com/user/api-tokens and store it as an environment variable:
SHAKESCO_API_KEY=uHdONhRNd98285c4...

Step 2: Award Tokens on Customer Actions

Call /claim-tokens whenever a customer completes an event you’ve configured:
// After a customer signs up
async function onCustomerSignup(customerEmail) {
  const response = await fetch("https://tokens.shakesco.com/claim-tokens", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.SHAKESCO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      event_name: "signup",
      email: customerEmail,
    }),
  });

  const { tx_hash } = await response.json();
  console.log("Tokens credited:", tx_hash);
}
import os, requests

def on_customer_signup(customer_email: str):
    response = requests.post(
        "https://tokens.shakesco.com/claim-tokens",
        headers={
            "Authorization": f"Bearer {os.environ['SHAKESCO_API_KEY']}",
            "Content-Type": "application/json",
        },
        json={"event_name": "signup", "email": customer_email}
    )
    data = response.json()
    print("Tokens credited:", data.get("tx_hash"))

Step 3: Show Customers Their Balance

Fetch a customer’s token balance whenever they log in or view their rewards page:
async function getCustomerBalance(email) {
  const res = await fetch(
    `https://tokens.shakesco.com/balance?email=${encodeURIComponent(email)}`,
    { headers: { Authorization: `Bearer ${process.env.SHAKESCO_API_KEY}` } }
  );
  const { balance } = await res.json();
  // Convert from wei to tokens
  return Number(balance) / 1e18;
}
For a full snapshot (balance, tier, staked, vested, voting power):
const res = await fetch(
  `https://tokens.shakesco.com/user-info?email=${encodeURIComponent(email)}`,
  { headers: { Authorization: `Bearer ${process.env.SHAKESCO_API_KEY}` } }
);
const info = await res.json();

Step 4: Let Customers Redeem Tokens

When a customer redeems a reward in your app:
async function redeemTokens(email, tokenAmount) {
  const response = await fetch("https://tokens.shakesco.com/redeem-tokens", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.SHAKESCO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ email, amount: tokenAmount }),
  });
  return response.json();
}

Common Integration Patterns

Check before claiming (one-time events)

const check = await fetch(
  `https://tokens.shakesco.com/has-claimed-event?email=${email}&event_name=signup`,
  { headers: { Authorization: `Bearer ${API_KEY}` } }
);
const { has_claimed } = await check.json();

if (!has_claimed) {
  await claimTokens("signup", email);
}

Award cashback after a purchase

// Record the spending - Shakesco awards cashback automatically if threshold is met
await fetch("https://tokens.shakesco.com/process-cashback", {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    email: customerEmail,
    spent_amount: 600,
    currency: "KES",
  }),
});

Start a happy hour programmatically

// 2× tokens for the next 2 hours
await fetch("https://tokens.shakesco.com/set-happy-hour", {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ duration: "7200", multiplier: 200 }),
});

What’s Available in the API

Rewards

Claim, redeem, expire tokens

Transfer & Migration

Transfer tokens and migrate from legacy systems

Staking

Lock tokens and earn staking rewards

Vesting

Gradual token distribution schedules

Promotions

Happy hours and daily caps

Governance & Cashback

Tiers, voting, and cashback programs

Read & Query

Balances, user info, activity

Events

Manage token claim events