mailjunky-ai Events API
Track user behavior and custom events
Track user behavior and custom events
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/mailjunky-ai:mailjunky-ai-events-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: MailJunky Events API
version: 1.0.0
description: 'The MailJunky API lets you send transactional emails, track user events, manage contacts, and build intelligent email workflows. All endpoints require API key authentication unless noted otherwise.
## SDK
Install the official SDK for the easiest integration:
```bash
npm install @mailjunky/sdk
```
```typescript
import { MailJunky } from ''@mailjunky/sdk''
const mailjunky = new MailJunky({ apiKey: ''mj_live_xxx'' })
```
For browser-side event tracking:
```typescript
import { initMailJunky } from ''@mailjunky/sdk/browser''
const mj = initMailJunky({ apiKey: ''mj_pub_xxx'' })
```
## Authentication
Authenticate by including your API key in the `Authorization` header:
```
Authorization: Bearer mj_live_your_api_key
```
You can also use the `X-API-Key` header. Public keys (`mj_pub_*`) are restricted to event tracking only.
## Rate Limits
All responses include rate limit headers:
- `X-RateLimit-Limit` - Requests allowed per window
- `X-RateLimit-Remaining` - Requests remaining
- `X-RateLimit-Reset` - Window reset time (unix timestamp)
- `Retry-After` - Seconds to wait (when rate limited)
## Base URL
```
https://www.mailjunky.ai/api/v1
```'
contact:
name: MailJunky Support
url: https://www.mailjunky.ai
email: support@mailjunky.ai
servers:
- url: https://www.mailjunky.ai/api/v1
description: Production
security:
- bearerAuth: []
tags:
- name: Events
description: Track user behavior and custom events
paths:
/events/track:
post:
operationId: trackEvent
summary: Track an event
description: 'Track a custom user event. Events are queued for async processing. Supports both private (`mj_live_*`) and public (`mj_pub_*`) API keys.
Public keys can also be passed via `X-API-Key` header or `?key=` query param (for `sendBeacon`).
CORS is enabled for browser-based tracking.
**Permissions required:** `events:track`
**Monthly quotas:** Free: 2,000 | Hobby: 5,000 | Starter: 50,000 | Pro: 250,000'
tags:
- Events
x-codeSamples:
- lang: JavaScript
label: MailJunky SDK
source: "import { MailJunky } from '@mailjunky/sdk'\n\nconst mailjunky = new MailJunky({ apiKey: 'mj_live_xxx' })\n\nawait mailjunky.events.track({\n event: 'purchase_completed',\n user: 'user@example.com',\n properties: {\n orderId: 'order_456',\n total: 99.99,\n items: 3\n }\n})"
- lang: JavaScript
label: Browser SDK
source: "import { initMailJunky } from '@mailjunky/sdk/browser'\n\nconst mj = initMailJunky({\n apiKey: 'mj_pub_your_public_key',\n autoTrack: { pageViews: true, buttonClicks: true }\n})\n\nmj.identify('user@example.com')\n\nmj.track({\n event: 'purchase_completed',\n properties: { orderId: 'order_456', total: 99.99 }\n})"
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TrackEventRequest'
example:
event: purchase_completed
user: user@example.com
properties:
orderId: order_456
total: 99.99
items: 3
responses:
'200':
description: Event queued for processing
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
queued:
type: boolean
const: true
example:
success: true
queued: true
'400':
$ref: '#/components/responses/ValidationError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
/events/stats:
get:
operationId: getEventStats
summary: Get event statistics
description: 'Retrieve aggregate statistics about your tracked events including totals, unique users, and event type breakdowns.
**Rate limit:** 100 requests/minute'
tags:
- Events
responses:
'200':
description: Event statistics
content:
application/json:
schema:
type: object
properties:
total:
type: integer
description: Total events tracked
last_24_hours:
type: integer
description: Events in the last 24 hours
last_7_days:
type: integer
description: Events in the last 7 days
unique_users:
type: integer
description: Number of unique users tracked
event_types:
type: array
items:
type: object
properties:
name:
type: string
count:
type: integer
description: Breakdown by event type
example:
total: 15420
last_24_hours: 523
last_7_days: 3847
unique_users: 892
event_types:
- name: page_view
count: 8230
- name: purchase_completed
count: 1245
- name: cart_added
count: 3102
'401':
$ref: '#/components/responses/Unauthorized'
components:
schemas:
Error:
type: object
properties:
statusCode:
type: integer
statusMessage:
type: string
message:
type: string
data:
type: object
description: Additional error details (e.g. validation errors)
properties:
fieldErrors:
type: object
additionalProperties:
type: array
items:
type: string
formErrors:
type: array
items:
type: string
TrackEventRequest:
type: object
required:
- event
properties:
event:
type: string
minLength: 1
maxLength: 255
description: Event name (e.g. 'purchase_completed', 'page_viewed')
user:
type: string
description: User identifier (email, user ID, etc.)
properties:
type: object
additionalProperties: true
description: Custom event properties
session_id:
type: string
description: Session identifier for grouping events
timestamp:
type: string
format: date-time
description: Event timestamp (defaults to now)
context:
type: object
additionalProperties: true
description: Browser/device context (url, user_agent, etc.)
responses:
RateLimited:
description: Rate limit or quota exceeded
headers:
Retry-After:
schema:
type: integer
description: Seconds to wait before retrying
X-RateLimit-Limit:
schema:
type: integer
X-RateLimit-Remaining:
schema:
type: integer
X-RateLimit-Reset:
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 429
message: Rate limit exceeded. Please slow down.
Unauthorized:
description: Invalid or missing API key
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 401
statusMessage: Unauthorized
message: Invalid or missing API key
Forbidden:
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 403
statusMessage: Forbidden
message: This API key does not have the required permission
ValidationError:
description: Request validation failed
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 400
message: Validation failed
data:
fieldErrors:
to:
- Invalid email
formErrors: []
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: API key authentication. Use your `mj_live_*` or `mj_pub_*` key as the bearer token.
apiKeyHeader:
type: apiKey
in: header
name: X-API-Key
description: 'Alternative: pass your API key via the X-API-Key header.'
x-scalar-sdk-installation:
- lang: Node
label: MailJunky SDK
description: 'Install the official **MailJunky SDK** from npm:'
source: npm install @mailjunky/sdk
- lang: JavaScript
label: Browser SDK
description: 'For browser-side event tracking:'
source: npm install @mailjunky/sdk