Capture API
Send events to My Journey Analytics from your servers, apps and other systems over plain HTTP.
The capture API receives events. It is what the JavaScript library uses behind the scenes, and you can call it directly from any server, script or system that can make an HTTP request.
Capture requests are authenticated with your public project token, not a personal API key. Find the token under Settings → Project → General → Project token & ID.
Where to send events
| Endpoint | Use it for |
|---|---|
POST /i/v0/e/ | One event, or an array of events |
POST /batch/ | Many events in one request |
The older paths /e/ and /capture/ are accepted too, and behave like /i/v0/e/.
Send them to https://app.myjourneyanalytics.com, or to your custom tracking domain if you have one.
Send one event
curl -X POST https://app.myjourneyanalytics.com/i/v0/e/ \
-H "Content-Type: application/json" \
-d '{
"api_key": "<project token>",
"event": "order completed",
"distinct_id": "user_123",
"properties": {
"order_id": "A-1001",
"total": 129.5,
"currency": "AUD"
}
}'await fetch("https://app.myjourneyanalytics.com/i/v0/e/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
api_key: process.env.MJ_PROJECT_TOKEN,
event: "order completed",
distinct_id: "user_123",
properties: { order_id: "A-1001", total: 129.5, currency: "AUD" },
}),
});In a browser, use the library instead of calling the API yourself:
myjourney.capture("order completed", { order_id: "A-1001", total: 129.5 });Event fields
| Field | Required | Description |
|---|---|---|
api_key | Yes | Your project token. token is accepted as another name for it |
event | Yes | The event name, such as order completed or $pageview |
distinct_id | Yes | The ID of the person who did it. It can also be sent as properties.distinct_id |
properties | No | Any properties to store with the event |
timestamp | No | When the event happened, as an ISO 8601 date and time. Defaults to the time it is received |
uuid | No | A UUID for the event. One is generated if you leave it out |
Use the same distinct_id your website or app uses for that person, usually the ID you pass to myjourney.identify(), so server and browser events join up on one person. A distinct_id longer than 200 characters is cut to 200.
Send many events at once
The batch endpoint takes the token once, then a batch array of events:
curl -X POST https://app.myjourneyanalytics.com/batch/ \
-H "Content-Type: application/json" \
-d '{
"api_key": "<project token>",
"batch": [
{
"event": "subscription renewed",
"distinct_id": "user_123",
"properties": { "plan": "growth" },
"timestamp": "2026-10-01T09:30:00Z"
},
{
"event": "invoice paid",
"distinct_id": "user_456",
"properties": { "amount": 49 }
}
]
}'Every event in a batch must belong to the same project. Bodies compressed with gzip are accepted; they are detected automatically.
Set person properties
To store properties on the person rather than the event, add $set or $set_once inside properties:
{
"api_key": "<project token>",
"event": "plan changed",
"distinct_id": "user_123",
"properties": {
"$set": { "plan": "enterprise" },
"$set_once": { "first_plan": "starter" }
}
}$set overwrites the value each time. $set_once only sets it if the person does not have it yet. See person properties for more.
Responses
| Status | Meaning |
|---|---|
200 | Accepted |
400 | The body could not be read, or an event has no name or no distinct_id |
401 | The project token is missing or not valid |
413 | An event or the request is too large |
429 | Too many events right now: retry later |
503 | A temporary problem: retry with a delay |
A 200 response means the request was accepted, not that each event has been stored yet. To check that events arrive, look for them in the app under Activity.
Good practice
- Keep the project token in configuration, not hard-coded, so you can change it easily.
- Retry on
429and503with an increasing delay. - Never send personal API keys to the capture API; it only needs the project token.
- Avoid sending sensitive data you do not need, such as full card numbers or passwords.
Can't find what you need? Contact support