# 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.

<div className="not-prose mb-8 mt-6 flex gap-3">
  
    <>Get API Keys</>
  
  
    <>Use an SDK Instead</>
  
</div>

---

## Get Your API Keys {{ id: 'get-your-api-keys' }}

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

1. Log in to [Bento](https://app.bentonow.com)
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 {{ id: 'track-your-first-event' }}

The Events API is the most common way to interact with Bento. Let's track a simple event to make sure everything is working.

### Using cURL

Replace the placeholder values with your actual credentials:

```bash
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"
      }
    }]
  }'
```


> ⚠️ **Warning**
> **Don't forget the User-Agent header!** Requests without it will be blocked by Cloudflare.


### Quick Auth Setup

Generate your Base64 credentials:

```bash
echo -n "YOUR_PUBLISHABLE_KEY:YOUR_SECRET_KEY" | base64
```

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

```bash
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 {{ id: 'verify-it-worked' }}

Let's confirm your event was recorded:

1. Go to your [Bento Dashboard](https://app.bentonow.com)
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 {{ id: 'next-steps' }}

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

### Learn the Core APIs

| API                                  | Use Case                                |
| ------------------------------------ | --------------------------------------- |
| [Events API](/docs/events_api)       | Track user actions, trigger automations |
| [Subscribers API](/docs/subscribers) | Import/export contacts, update profiles |
| [Emails API](/docs/emails_api)       | Send transactional emails               |
| [Tags API](/docs/tags_api)           | Organize subscribers with tags          |

### Use an SDK

Skip the raw HTTP calls and use our official SDKs:

<div className="grid grid-cols-2 md:grid-cols-4 gap-2 not-prose mt-4">
  
    Node.js
  
  
    Python
  
  
    Ruby
  
  
    PHP
  
  
    Laravel
  
  
    Next.js
  
  
    Go
  
  
    Elixir
  
</div>

### 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](/docs/web_analytics) for client-side tracking
- **Transactional emails**: Send password resets, receipts, and notifications via the [Emails API](/docs/emails_api)

### Need Help?

- [Authentication Guide](/docs/authentication) - Detailed auth setup
- [Troubleshooting](/docs/troubleshooting) - Common issues and solutions
- [FAQ](/docs/faq) - Frequently asked questions
- [Discord](https://discord.com/invite/ssXXFRmt5F) - Get help from the community