API Quickstart

View markdown

API Quickstart

Get up and running with the Bento API in under 5 minutes. By the end of this guide, you'll have tracked your first event and verified it appears in your Bento dashboard.


Get Your API Keys

Before making API calls, you'll need three credentials:

  1. Log in to Bento
  2. Go to Settings → API Keys
  3. Copy these values:
    • Publishable Key (starts with pk_)
    • Secret Key (starts with sk_)
    • Site UUID
Keep your Secret Key private. Never expose it in client-side code or commit it to version control.

Track Your First Event

The Events API is the most common way to interact with Bento. Track a simple event to confirm everything is working.

Using cURL

Replace the placeholder values with your actual credentials:

Shell
curl -X POST 'https://app.bentonow.com/api/v1/batch/events?site_uuid=YOUR_SITE_UUID' \
  -H 'Authorization: Basic YOUR_BASE64_CREDENTIALS' \
  -H 'User-Agent: MyApp/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "events": [{
      "type": "$custom.quickstart_test",
      "email": "test@example.com",
      "fields": {
        "first_name": "Test",
        "source": "api_quickstart"
      }
    }]
  }'
Don't forget the User-Agent header! Requests without it will be blocked by Cloudflare.

Quick Auth Setup

Generate your Base64 credentials:

Shell
echo -n "YOUR_PUBLISHABLE_KEY:YOUR_SECRET_KEY" | base64

Or use the URL shortcut (credentials in the URL):

Shell
curl -X POST 'https://YOUR_PUBLISHABLE_KEY:YOUR_SECRET_KEY@app.bentonow.com/api/v1/batch/events?site_uuid=YOUR_SITE_UUID' \
  -H 'User-Agent: MyApp/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "events": [{
      "type": "$custom.quickstart_test",
      "email": "YOUR_EMAIL@example.com"
    }]
  }'

Expected Response

A successful request returns:

JSON
{
  "results": 1,
  "failed": 0
}

Verify It Worked

Confirm your event was recorded:

  1. Go to your Bento Dashboard
  2. Click Search in the top navigation
  3. Search for test@example.com (or whatever email you used)
  4. Click on the subscriber profile
  5. Look for the $custom.quickstart_test event in their activity timeline

You should see:

  • The event type you sent
  • Any fields you included (like first_name)
  • The timestamp of when it was received
Events typically appear within seconds, but can take up to 30 seconds during high-traffic periods.

Next Steps

Now that you've made your first API call, here's what to explore next:

Learn the Core APIs

APIUse Case
Events APITrack user actions, trigger automations
Subscribers APIImport/export contacts, update profiles
Emails APISend transactional emails
Tags APIOrganize subscribers with tags

Use an SDK

Skip the raw HTTP calls and use our official SDKs:

Common Patterns

  • User signups: Track $signed_up events when users create accounts
  • Purchases: Track $purchase events with value and product details
  • Page views: Use Bento.js for client-side tracking
  • Transactional emails: Send password resets, receipts, and notifications via the Emails API
  • Safe testing: Use seed contacts and test flows before production traffic triggers automations

Need Help?