Baker API reference
Send conversions, revenue and pipeline stages from your CRM, store or backend to Baker. Guides, the full reference and a Test request button on every endpoint.
Machine-readable: OpenAPI 3.1, JSON Schema of the body, llms.txt, llms-full.txt, and this page as Markdown.
Baker API: the complete reference
Every page of https://withbaker.com/docs in one file, in reading order. Build from this; you should not need to look anything else up. Test every payload against the real API with the public test key bk_test_public: it is judged exactly like a company's request and nothing is stored. Read the company's own key from the BAKER_EVENTS_KEY environment variable and ask the person for its value: never put it in source or paste it into a chat.
Baker API
Baker's API takes what happens after the click, a deal won, an order paid, a lead qualified, from your own server and puts it in the same reports as your Baker pages and ads, joined to the same person. You send JSON to
https://api.withbaker.com/v1/eventswith a sending key. Field names follow Meta's Conversions API, so an existing integration maps over field for field.
Source: https://withbaker.com/docs · Updated 2026-11-23
Baker measures what happens on the pages it publishes and, with its pixel, on your own website. Everything that happens away from them, a deal closing in your CRM, a subscription starting in your billing system, an order shipping from your store, reaches Baker through this API. Once it arrives it is joined to the visit and the campaign that brought the person, so Baker optimizes for sales rather than clicks.
What you can build
- Revenue from your CRM. Send
deal_wonwith the money on it, the moment it is won. Campaigns are then judged on what they sold. - The whole pipeline. Send
qualified_lead,opportunityanddeal_lostas well, so a campaign that brings leads sales never keeps stops looking cheap. - Orders with their products. Send
purchaseandrefundwith one line per product. - Your history. Backfill last year's deals and orders: nothing is refused for being old.
API at a glance
| Base URL | https://api.withbaker.com |
| Endpoint | POST /v1/events: reference |
| Authentication | Authorization: Bearer \<sending key>: how to get one |
| Format | JSON in, JSON out, UTF-8 |
| Try it, no account | The public test key bk_test_public: the real API's answers, nothing stored |
| Test mode | X-Baker-Mode: test: validated and answered like live, stores nothing |
| Batch | Up to 500 events and 8 MB per request |
| Rate limit | 600 requests and 30,000 events a minute per company: limits |
| Machine-readable | OpenAPI 3.1, JSON Schema, llms.txt, every page as Markdown: for agents |
Start here
- Send your first event in five minutes, in test mode.
- Match events to people: the part that decides whether an event is worth anything.
- Handle errors and retries, then go live.
Building with Cursor, Claude Code, Codex or Copilot? Start at Build with an AI agent: one prompt, and your agent can test every request against the real API before you hand it a key.
Tip: Building with a coding assistant? Give it /docs/llms-full.txt: this whole reference in one file. Or press Copy for AI in Baker under Measure → Sources → API, which includes your own address.
Not a developer?
You may not need this API. Baker connects to HubSpot, ActiveCampaign and Shopify on its own, its pixel reads your website, and a tool that can only call a webhook can post to a source address with nothing to write. See Send sales from your own systems and Connect your platforms in the Help Center, or ask Baker in a chat which way fits.
Versioning
The version is in the path: /v1. Within it, changes only add: a new optional field, a new standard event name, a new rejection code appended to the list. Nothing you already send changes meaning, and no code you already handle is renamed. Treat a rejection code you do not know as a refusal and log it. What changed, and when: Changelog.
Send your first event
Create a key under Settings → API Keys in Baker, choosing Sending events only. Post an event to
https://api.withbaker.com/v1/eventswith the headerX-Baker-Mode: test: it is checked and answered exactly like a real one and stores nothing. Readrejectedin the answer, then remove the header to go live.
Source: https://withbaker.com/docs/quickstart · Updated 2026-11-23
1. Set your key
To try it now, use the public test key. It needs no account: every request is checked by the real API, exactly like yours, and nothing is stored.
export BAKER_EVENTS_KEY=bk_test_public
To send your own events, create your company's key:
- In Baker, open the company the events belong to, then Settings → API Keys.
- Give the key a label you will recognise later, such as the system that will hold it.
- Under What this key can do, choose Sending events only, and press Create.
- Put it in your server's environment as
BAKER_EVENTS_KEY.
Or press Sign in to use your key at the top of withbaker.com/docs: every code sample and Test Request then carry your company's key, in that browser tab only.
Heads-up: A sending key can post events and nothing else, but anybody holding it can post events as your company. Keep it on your server, never in a browser, an app or a repository.
2. Send a test event
The smallest event that counts names what happened and who it happened to. The X-Baker-Mode: test header makes this a rehearsal: authenticated, validated and answered exactly like a live request, and nothing is stored.
cURL
curl -X POST https://api.withbaker.com/v1/events \
-H "Authorization: Bearer $BAKER_EVENTS_KEY" \
-H "Content-Type: application/json" \
-H "X-Baker-Mode: test" \
-d '{
"events": [
{
"event_name": "lead",
"user_data": {
"email": "laura@example.com"
}
}
]
}'
Node.js
const response = await fetch("https://api.withbaker.com/v1/events", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BAKER_EVENTS_KEY}`,
"Content-Type": "application/json",
"X-Baker-Mode": "test",
},
body: JSON.stringify({
"events": [
{
"event_name": "lead",
"user_data": {
"email": "laura@example.com"
}
}
]
}),
});
const { ok, data, error } = await response.json();
if (!ok) throw new Error(`Baker refused the request: ${error.code}`);
// A 200 can still refuse single events: log every one.
for (const refused of data.rejected) console.warn("Baker refused event", refused.index, refused.code, refused.message);
Python
import os
import requests
response = requests.post(
"https://api.withbaker.com/v1/events",
headers={
"Authorization": f"Bearer {os.environ['BAKER_EVENTS_KEY']}",
"X-Baker-Mode": "test",
},
json={
"events": [
{
"event_name": "lead",
"user_data": {
"email": "laura@example.com",
},
},
],
},
timeout=10,
)
answer = response.json()
if not answer["ok"]:
raise RuntimeError(f"Baker refused the request: {answer['error']['code']}")
# A 200 can still refuse single events: log every one.
for refused in answer["data"]["rejected"]:
print("Baker refused event", refused["index"], refused["code"], refused["message"])
PHP
<?php
$body = <<<'JSON'
{
"events": [
{
"event_name": "lead",
"user_data": {
"email": "laura@example.com"
}
}
]
}
JSON;
$curl = curl_init('https://api.withbaker.com/v1/events');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('BAKER_EVENTS_KEY'),
'Content-Type: application/json',
'X-Baker-Mode: test',
],
CURLOPT_POSTFIELDS => $body,
]);
$answer = json_decode(curl_exec($curl), true);
if (!$answer['ok']) {
throw new RuntimeException('Baker refused the request: ' . $answer['error']['code']);
}
// A 200 can still refuse single events: log every one.
foreach ($answer['data']['rejected'] as $refused) {
error_log("Baker refused event {$refused['index']}: {$refused['code']}");
}
Go
package main
import (
"log"
"net/http"
"os"
"strings"
)
const body = `{
"events": [
{
"event_name": "lead",
"user_data": {
"email": "laura@example.com"
}
}
]
}`
func main() {
request, _ := http.NewRequest("POST", "https://api.withbaker.com/v1/events", strings.NewReader(body))
request.Header.Set("Authorization", "Bearer "+os.Getenv("BAKER_EVENTS_KEY"))
request.Header.Set("Content-Type", "application/json")
request.Header.Set("X-Baker-Mode", "test")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err) // it may have arrived: retry with the same event_ids, which then count once
}
defer response.Body.Close()
// Decode the answer and log every entry of data.rejected: a 200 can still refuse single events.
log.Println("Baker answered", response.Status)
}
Try it. Send this to the real API with the public test key, bk_test_public: it is checked exactly like a company's request, answered the same way with "mode": "test", and nothing is stored.
curl -X POST https://api.withbaker.com/v1/events \
-H "Authorization: Bearer bk_test_public" \
-H "Content-Type: application/json" \
-d '{"events":[{"event_name":"lead","user_data":{"email":"laura@example.com"}}]}'
3. Read the answer
{
"ok": true,
"data": {
"mode": "test",
"received": 1,
"accepted": 1,
"rejected": []
}
}
mode says this was a rehearsal. accepted says how many events would have counted, and rejected lists every one that would not, with a code to branch on. A 200 is not the same as everything counting: always read rejected.
4. Go live
Remove the X-Baker-Mode header. The key, the address and the body stay the same, so nothing else about your integration changes. The answer now says "mode": "live".
5. See it in Baker
Accepted events appear in Baker under Measure → Events, within seconds. Test sends and refused events are listed there too, under All events → Test sends / Not counted, with what you sent, so you can see what arrived without reading your own logs.
An event counts as a conversion once someone marks its name under Conversions in Baker. That applies to every event already sent under that name, so you can send first and decide later.
Next steps
- The full reference for POST /v1/events
- Match events to the right person
- Retry safely with event_id
- Ready-made bodies for common events
Authenticate your requests
Every request carries a sending key as
Authorization: Bearer <key>. Create one in Baker under Settings → API Keys, choosing Sending events only: it can post events for that one company and do nothing else. The key decides the company, so the body never names one. Keep it on your server and rotate it by creating a new one before revoking the old.
Source: https://withbaker.com/docs/authentication · Updated 2026-11-23
API keys
A sending key belongs to one company in Baker and can do one thing: post events for it. It cannot publish pages, change ads, spend money or read anything back. That makes it safe to keep in another system's environment file, such as your CRM's middleware or your store's backend.
Anyone in the company who can edit in Baker can create one: open Settings → API Keys, add a label, choose Sending events only and press Create.
| Field | What it takes | |
|---|---|---|
Authorization |
required | Bearer <your sending key> |
Content-Type |
required | application/json |
X-Baker-Mode |
optional | live (the default) or test. A test send is authenticated and validated identically and stores nothing. An unrecognised value is refused rather than assumed. |
One key, one company
The key is the only thing that says which company an event belongs to. The body has no company field, and one is refused, so a key cannot write into another company's reports by mistake. An agency sending for several clients creates one key in each client's company and keeps them apart.
Keep it on your server
Read the key from an environment variable (the samples use BAKER_EVENTS_KEY) and never ship it in a browser, a mobile app or a repository. For events that happen in the browser, use Baker's pixel and window.baker.track(name) instead: it needs no key.
Tip: Rotate a key without losing an event: create the new one, deploy it, then press Revoke on the old one under Settings → API Keys. Both work in between.
The public test key
bk_test_public is published so anybody, and any coding agent, can call the real API before having a key. A request with it is parsed and judged by exactly the rules your company's requests are, and answered in the same shape with "mode": "test". It belongs to no company, so nothing is stored, nothing shows in Baker, and asking it to go live is refused with a 403. It has its own rate limit and never spends yours.
export BAKER_EVENTS_KEY=bk_test_public
Test mode
Send X-Baker-Mode: test while you build. The request is authenticated, parsed, validated and answered exactly as a live one, and nothing is stored: no report moves. There is no separate test key or test endpoint, so going live is removing one header. Any value other than live or test is refused with a 400, so a typo can never send a rehearsal into your real numbers. The answer always says which mode it used.
Source addresses, for tools that cannot set a header
Some tools can call a webhook URL and set nothing else. For those, Baker gives a source address, https://api.withbaker.com/v1/sources/<token>, where the address itself is the credential. Get it in Baker under Measure → Sources → API, with Get the address.
It takes the same body and gives the same answers as /v1/events, with no Authorization header. A wrong or removed address answers 404 not_found. Treat the address like a password.
Authentication errors: 401 and 403
| Status | Code | Means |
|---|---|---|
401 |
invalid_api_key |
The key is missing, mistyped or revoked. Check the Authorization header and the key in Baker. |
403 |
forbidden |
The key is valid but may not send events, the company's Baker account is closed, or the public test key was asked to go live. Use a key created as Sending events only. The public test key only rehearses. |
404 |
not_found |
Nothing is listening at this source address: it is wrong, or the source was removed. Copy the address again from Baker. |
{
"ok": false,
"error": {
"code": "invalid_api_key",
"message": "Missing or invalid Authorization header"
}
}
Build with an AI agent
Paste the prompt below into your coding agent. It reads the whole contract from
/docs/llms-full.txt, checks every payload against the real API with the public test keybk_test_publicbefore it has yours, and reads your key fromBAKER_EVENTS_KEY, never from source. You decide which events matter and hand over the key; the agent does the rest.
Source: https://withbaker.com/docs/agents · Updated 2026-11-23
The prompt
Paste it into Cursor, Claude Code, Codex, Copilot, Windsurf or any agent that can read a URL and run a command:
Send our server-side events to Baker's API.
1. Read https://withbaker.com/docs/llms-full.txt first: it is the complete contract. Build from it.
2. Ask me which moments to send (for example a qualified lead, a deal won with its amount, a deal lost, an order paid, a refund) and where each person's email, phone or contact id lives in our code. If you cannot ask, choose, write the assumption in a code comment, and carry on.
3. Read the key from the BAKER_EVENTS_KEY environment variable. Never hardcode it, never print it, never commit it.
4. While building, run every payload against the real API with the public test key: BAKER_EVENTS_KEY=bk_test_public. It is checked exactly like ours and nothing is stored. Fix every entry in data.rejected until there are none.
5. Batch up to 500 events per request, give each event a stable event_id from our own records, retry 429 and 5xx with the same event_ids, and log data.rejected on every response.
6. Keep the header X-Baker-Mode: test until I say we are live.
What your agent can do on its own
- Read the contract: every page is Markdown, and /docs/llms-full.txt is all of them in one file.
- Validate a payload offline against the JSON Schema of the request body.
- Test against the real API with
bk_test_public: the same parse, the same per-event rules and the same answer your key gets, with nothing stored. - Fix what was refused: every refusal has a closed
code, and each code's fix is in Errors and retries. - Generate a client: the OpenAPI 3.1 description works with any OpenAPI generator.
Try it. Send this to the real API with the public test key, bk_test_public: it is checked exactly like a company's request, answered the same way with "mode": "test", and nothing is stored.
curl -X POST https://api.withbaker.com/v1/events \
-H "Authorization: Bearer bk_test_public" \
-H "Content-Type: application/json" \
-d '{"events":[{"event_name":"lead","user_data":{"email":"laura@example.com"}}]}'
What only a person does
- Create the key in Baker under Settings → API Keys (Sending events only), and put it in
BAKER_EVENTS_KEYwhere the code runs. Never paste it into the agent's chat: a chat is a log somebody else keeps. - Decide what counts: an event becomes a conversion when someone marks its name under Conversions in Baker. Nothing in a request can do it.
- Go live: remove
X-Baker-Mode: testonce the rehearsals come back clean.
Add it to your repository
So every agent that works in your code later knows the rules, add this to your AGENTS.md, CLAUDE.md or .cursorrules:
## Baker events API
- Contract: https://withbaker.com/docs/llms-full.txt (OpenAPI: https://withbaker.com/docs/openapi.json).
- POST https://api.withbaker.com/v1/events with Authorization: Bearer $BAKER_EVENTS_KEY. Never hardcode the key.
- Test with BAKER_EVENTS_KEY=bk_test_public and X-Baker-Mode: test; nothing is stored.
- A 200 can still refuse events: always read and log data.rejected.
- Every event carries a stable event_id from our own records, so retries count once.
Every machine-readable file
| File | What it is |
|---|---|
| /docs/llms.txt | The index of these docs, in the llmstxt.org format. |
| /docs/llms-full.txt | Every page whole, in one file: hand this to an agent. |
| /docs/openapi.json | OpenAPI 3.1, generated from the schemas the API parses with. |
| /docs/event-batch.schema.json | The request body as JSON Schema (draft 2020-12). |
/docs/\<page>.md |
Any page as Markdown. Asking a page for Accept: text/markdown gets the same. |
| /.well-known/api-catalog | Where the API and its description are (RFC 9727). |
Postman, Insomnia and Bruno
Import https://withbaker.com/docs/openapi.json as an OpenAPI file: every request, field and example arrives ready to send. Set the bearer token to bk_test_public to try it, or to your own key.
POST /v1/events
POST /v1/eventstakes{ "events": [...] }, 1 to 500 events per request. Each event needs anevent_nameand auser_datathat names the person. Every event is judged on its own: the answer is a200that counts what was accepted and lists each refused event inrejected, with a code to branch on.
Source: https://withbaker.com/docs/events · Updated 2026-11-23
POST https://api.withbaker.com/v1/events
Sends one or more events about people: a lead, a deal, an order. The field names are Meta's Conversions API's (event_name, event_time, event_id, user_data, value, currency), so an integration you have written against Meta or Google Ads' offline conversions maps over field for field.
cURL
curl -X POST https://api.withbaker.com/v1/events \
-H "Authorization: Bearer $BAKER_EVENTS_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
{
"event_name": "deal_won",
"event_id": "deal-48213-won",
"event_time": "2026-11-20T14:03:00Z",
"user_data": {
"email": "laura@example.com",
"external_id": "crm-contact-9921"
},
"value": "1200.00",
"currency": "EUR",
"properties": {
"pipeline": "Enterprise",
"owner": "Marta"
}
}
]
}'
Node.js
const response = await fetch("https://api.withbaker.com/v1/events", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BAKER_EVENTS_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"events": [
{
"event_name": "deal_won",
"event_id": "deal-48213-won",
"event_time": "2026-11-20T14:03:00Z",
"user_data": {
"email": "laura@example.com",
"external_id": "crm-contact-9921"
},
"value": "1200.00",
"currency": "EUR",
"properties": {
"pipeline": "Enterprise",
"owner": "Marta"
}
}
]
}),
});
const { ok, data, error } = await response.json();
if (!ok) throw new Error(`Baker refused the request: ${error.code}`);
// A 200 can still refuse single events: log every one.
for (const refused of data.rejected) console.warn("Baker refused event", refused.index, refused.code, refused.message);
Python
import os
import requests
response = requests.post(
"https://api.withbaker.com/v1/events",
headers={
"Authorization": f"Bearer {os.environ['BAKER_EVENTS_KEY']}",
},
json={
"events": [
{
"event_name": "deal_won",
"event_id": "deal-48213-won",
"event_time": "2026-11-20T14:03:00Z",
"user_data": {
"email": "laura@example.com",
"external_id": "crm-contact-9921",
},
"value": "1200.00",
"currency": "EUR",
"properties": {
"pipeline": "Enterprise",
"owner": "Marta",
},
},
],
},
timeout=10,
)
answer = response.json()
if not answer["ok"]:
raise RuntimeError(f"Baker refused the request: {answer['error']['code']}")
# A 200 can still refuse single events: log every one.
for refused in answer["data"]["rejected"]:
print("Baker refused event", refused["index"], refused["code"], refused["message"])
PHP
<?php
$body = <<<'JSON'
{
"events": [
{
"event_name": "deal_won",
"event_id": "deal-48213-won",
"event_time": "2026-11-20T14:03:00Z",
"user_data": {
"email": "laura@example.com",
"external_id": "crm-contact-9921"
},
"value": "1200.00",
"currency": "EUR",
"properties": {
"pipeline": "Enterprise",
"owner": "Marta"
}
}
]
}
JSON;
$curl = curl_init('https://api.withbaker.com/v1/events');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('BAKER_EVENTS_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$answer = json_decode(curl_exec($curl), true);
if (!$answer['ok']) {
throw new RuntimeException('Baker refused the request: ' . $answer['error']['code']);
}
// A 200 can still refuse single events: log every one.
foreach ($answer['data']['rejected'] as $refused) {
error_log("Baker refused event {$refused['index']}: {$refused['code']}");
}
Go
package main
import (
"log"
"net/http"
"os"
"strings"
)
const body = `{
"events": [
{
"event_name": "deal_won",
"event_id": "deal-48213-won",
"event_time": "2026-11-20T14:03:00Z",
"user_data": {
"email": "laura@example.com",
"external_id": "crm-contact-9921"
},
"value": "1200.00",
"currency": "EUR",
"properties": {
"pipeline": "Enterprise",
"owner": "Marta"
}
}
]
}`
func main() {
request, _ := http.NewRequest("POST", "https://api.withbaker.com/v1/events", strings.NewReader(body))
request.Header.Set("Authorization", "Bearer "+os.Getenv("BAKER_EVENTS_KEY"))
request.Header.Set("Content-Type", "application/json")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err) // it may have arrived: retry with the same event_ids, which then count once
}
defer response.Body.Close()
// Decode the answer and log every entry of data.rejected: a 200 can still refuse single events.
log.Println("Baker answered", response.Status)
}
Try it
Press Test Request on withbaker.com/docs to send any example to the real API. With the public test key, bk_test_public, it is checked exactly like yours and nothing is stored. Sign in at the top of the page to send with your company's key instead.
Try it. Send this to the real API with the public test key, bk_test_public: it is checked exactly like a company's request, answered the same way with "mode": "test", and nothing is stored.
curl -X POST https://api.withbaker.com/v1/events \
-H "Authorization: Bearer bk_test_public" \
-H "Content-Type: application/json" \
-d '{"events":[{"event_name":"deal_won","event_id":"deal-48213-won","event_time":"2026-11-20T14:03:00Z","user_data":{"email":"laura@example.com","external_id":"crm-contact-9921"},"value":"1200.00","currency":"EUR","properties":{"pipeline":"Enterprise","owner":"Marta"}}]}'
Headers
| Field | What it takes | |
|---|---|---|
Authorization |
required | Bearer <your sending key> |
Content-Type |
required | application/json |
X-Baker-Mode |
optional | live (the default) or test. A test send is authenticated and validated identically and stores nothing. An unrecognised value is refused rather than assumed. |
Body
A JSON object with one field, events: an array of 1 to 500 events, 8 MB at most. Any other top-level field is refused with a 400, and so is any field an event does not define: a field you misspell is reported rather than silently dropped.
| Field | What it takes | |
|---|---|---|
event_name |
required | What happened. Up to 80 characters of letters, digits, spaces, . _ and -, starting with a letter or a digit The only required field. Use one of the standard names below wherever one fits; anything else is yours to invent, in whatever language you name things in: a letter is a letter in any script, and "Matrícula Realizada" is a name. |
event_time |
optional | ISO-8601 with an offset (2026-09-08T13:23:41Z), or Unix seconds (1757337821). Left out, it is the moment we received it. Nothing is refused for being old: a backfill of last year's history is what this is for. More than 5 minutes in the future is refused. |
event_id |
optional | Your own id for this event: 1–128 characters of letters, digits, and . _ : - Send one only if you want it deduplicated: the same id twice is counted once. Send none and every post is its own event. |
user_data |
required | Who it was about. At least one field below: this is the whole of how a server event finds the person who visited a Baker page or your website. No field is required on its own and the block is: an event naming nobody is refused with missing_identity. The one exception is a page_view carrying a url, because a page serve is a fact about a page. |
↳ email |
optional | The address, or its SHA-256 digest if you already hash. Either works: we tell them apart. Send this one if you can. It is the road that cannot silently fail: we normalise and hash it here, so it lands on exactly the person a Baker page or the pixel already recorded. |
↳ phone |
optional | The number with its country code, or its digest. Same treatment as email. |
↳ external_id |
optional | Your own id for the person, such as a CRM contact key. Kept exactly as you send it, and hashed alongside so it joins: your own events to each other, and to a browser once one event carries it beside an email or a baker_id. |
↳ baker_id |
optional | The Baker ID one of our pages already gave this browser, if you kept it. The strongest of all of them: it names the visit, so the event lands on that person's timeline rather than beside it. |
↳ the ad click ids |
optional | The click id that brought them, if you kept it, under the name the platform stamps on the link: gclid, wbraid, gbraid, dclid, fbclid, ttclid, twclid, li_fat_id, msclkid, rdt_cid, epik, sccid (Snapchat's ScCid, in any case), oppref (ChatGPT Ads). A click id names a person too: it is enough on its own, and it attributes the event to the campaign that earned it. |
↳ fbp, fbc |
optional | Meta's own browser cookies (_fbp, _fbc), exactly as your site stored them. Enough on their own, and worth sending: they are what Meta matches a server event on. We read the click id out of an fbc for you. |
↳ the matching fields |
optional | first_name, last_name, date_of_birth, gender, street, city, region, postal_code, country: Meta's advanced matching and Google's enhanced conversions, in one block. Plain or already hashed. They name nobody here, so they never satisfy user_data on their own. They are kept so this event can be sent on to Meta or Google later without asking you for it all again. |
url |
optional | The full page URL this happened on. Its query string is where campaign parameters and ad click ids are read from. Without it the event counts, and belongs to no page. |
value |
optional | What it was worth: a decimal string or a JSON number. No thousands separator, no sign, no exponent. Rounded to what the currency holds: 1200.999 EUR is stored as 1201.00. "1,200" is refused. |
currency |
conditional | An ISO-4217 code, e.g. EUR. Required whenever value is present, and refused on its own. |
properties |
optional | A flat object of strings: anything you want to break the event down by later. |
items |
optional | What was bought, one entry per product line, for a purchase, a cart or a refund. Each line names its product by at least one of the ids below. value still carries the whole event's money. An order with more than 250 lines keeps the first 250. |
↳ product_id, variant_id, feed_id |
conditional | Your store's product id, its variant id, or the id the product has in your ads catalog. At least one per line, up to 255 characters each. |
↳ quantity |
optional | How many: a whole number from 1 to 1,000,000. |
↳ price |
optional | The price of one unit, in the event's currency, so it needs currency. A decimal like value. |
consent |
optional | What the person allowed, if your site asked them. Send it whenever you know it. A person who said no to marketing is still counted in your reports, and is never matched or sent to an ad platform. |
↳ analytics |
optional | granted or denied: whether they allowed being measured. Denied keeps the event and forgets who it was. |
↳ marketing |
optional | granted or denied: whether they allowed their visit to be used for advertising. |
Limits inside an event: event_name up to 80 characters; event_id 1 to 128 characters; up to 250 items, each id up to 255 characters and quantity up to 1,000,000.
Heads-up: What refuses the whole request. The shape is checked for the batch as a whole: an unknown field, a field of the wrong JSON type (a number in
properties, an object invalue) or an event with noevent_nameat all refuses every event with a400, and the message names the path, such asevents.3.event_name. Everything else about an event, a missing person, a bad amount, a future time, refuses that event alone, inside a200. Validate the shape before you send with the JSON Schema.
Tip: Send money as a string. In JavaScript,
JSON.stringifywrites a very small or very large number with an exponent (1e-7), which is refused.amount.toFixed(2)(or the currency's own decimals) always works. Currency codes are uppercase:EUR, noteur.
required means the event is refused without it: with no event_name the request is a 400; with a user_data that names nobody, that event is missing_identity. X-Baker-Mode is read without regard to case or spaces.
Response
Every request that could be read answers 200 with this shape, whatever happened to each event:
{
"ok": true,
"data": {
"mode": "live",
"received": 2,
"accepted": 1,
"rejected": [
{
"index": 1,
"event_id": "",
"code": "invalid_value",
"message": "value and currency go together: a non-negative decimal and an ISO-4217 code"
}
]
}
}
| Field | What it takes | |
|---|---|---|
mode |
required | live or test, echoed back, so a forgotten header is visible in the reply rather than in a report next week. |
received |
required | How many events we read, so you can detect a truncated body. |
accepted |
required | How many were counted. |
rejected |
required | One entry per refused event: index, event_id, code, message. index is the position in your own array, and is the one to branch on: event_id is empty for an event that sent none. |
The counts never say which person matched or whether an address is already known to Baker. That is deliberate: a leaked key must not be able to ask who is in your data.
Rejection codes
rejected[].code is a closed set. Branch on it, never on message, which is written for people and may change.
| Code | Means | Fix |
|---|---|---|
invalid_event_id |
event_id, when sent, must be 1-128 characters of A-Z a-z 0-9 . _ : - | Send an id of 1 to 128 letters, digits and . _ : -, or leave event_id out. |
invalid_name |
event_name is required: up to 80 characters of letters (any language), digits, spaces, . _ and -, starting with a letter or a digit | Send a name of up to 80 characters that starts with a letter or a digit. |
missing_identity |
user_data named nobody, and no url named a page | Add at least one way to name the person in user_data: an email, a phone, your own external_id, a baker_id, a click id, fbp or fbc. A value that is not one (an email with no @) names nobody. |
invalid_timestamp |
event_time must be an ISO-8601 instant with an offset or Unix seconds, and not in the future | Send ISO-8601 with an offset (2026-11-20T14:03:00Z) or Unix seconds (not milliseconds: Math.floor(Date.now() / 1000)), no more than 5 minutes ahead. |
invalid_value |
value and currency go together: a non-negative decimal and an ISO-4217 code | Send value as a plain non-negative decimal (1200.50, no thousands separator, no exponent) with an uppercase ISO-4217 currency (EUR, not eur). |
batch_too_large |
a request carries at most 500 events and 8 MB | Never in rejected: it is the 413 for the whole request. Split it: at most 500 events and 8 MB each. |
invalid_items |
each item names a product_id, variant_id or feed_id; quantity is a whole number from 1 to 1000000; price is a non-negative decimal sent with a currency | Name each line by product_id, variant_id or feed_id; send quantity from 1 to 1,000,000 and price with a currency. |
invalid_consent |
consent.analytics and consent.marketing, when sent, are granted or denied | Send granted or denied, or leave the field out. |
HTTP statuses
| Status | Code | Means | Retry |
|---|---|---|---|
200 |
ok: true |
The request was read. Single events may still be refused: read data.rejected. |
No |
400 |
invalid_request |
The body is not the documented shape, anywhere in the batch: not JSON, an unknown field, a field of the wrong JSON type, an event with no event_name, or an X-Baker-Mode that is neither live nor test. Fix the request. The message names the first field that is wrong by its path, such as events.3.event_name. | No |
401 |
invalid_api_key |
The key is missing, mistyped or revoked. Check the Authorization header and the key in Baker. | No |
403 |
forbidden |
The key is valid but may not send events, the company's Baker account is closed, or the public test key was asked to go live. Use a key created as Sending events only. The public test key only rehearses. | No |
413 |
batch_too_large |
More events, or more bytes, than one request may carry. Split the batch and send each half. | After splitting |
429 |
rate_limited |
Over the requests-per-minute budget: the company's, or the public test key's. Wait for the seconds in Retry-After, then send the same request again. | Yes |
500 |
internal_error |
A fault on our side. Nothing was written. Retry with exponential backoff, with the same event_ids. | Yes |
How to retry, and why it is always safe with an event_id: Errors and retries.
Errors and retries
Baker refuses in two ways. A request it cannot read answers a
4xxwith{ "ok": false, "error": { "code", "message" } }. A request it can read answers200, and each event it refused is listed indata.rejected. Retry429,5xxand timeouts with the sameevent_ids; never retry another4xxunchanged.
Source: https://withbaker.com/docs/errors · Updated 2026-11-23
Request errors and rejected events
- The request. Nothing in it was read: the key is wrong, the body is not JSON, a field is unknown, the batch is too big. The status says so, and the body is the error envelope below. Nothing was stored.
- One event. The request was read, and one event in it is wrong: an amount of
"1,200", a timestamp in the future, nobody named. The answer is a200; the event is listed indata.rejectedwith itsindexin your array, and every other event in the batch still counts.
The second kind is why a batch is safe to send: a contact with no email, once a week, costs you that one event and tells you which, instead of the whole day's batch.
The error envelope
{
"ok": false,
"error": {
"code": "invalid_api_key",
"message": "Missing or invalid Authorization header"
}
}
error.code is what to branch on, error.message what to log.
| Status | Code | Means | Retry |
|---|---|---|---|
200 |
ok: true |
The request was read. Single events may still be refused: read data.rejected. |
No |
400 |
invalid_request |
The body is not the documented shape, anywhere in the batch: not JSON, an unknown field, a field of the wrong JSON type, an event with no event_name, or an X-Baker-Mode that is neither live nor test. Fix the request. The message names the first field that is wrong by its path, such as events.3.event_name. | No |
401 |
invalid_api_key |
The key is missing, mistyped or revoked. Check the Authorization header and the key in Baker. | No |
403 |
forbidden |
The key is valid but may not send events, the company's Baker account is closed, or the public test key was asked to go live. Use a key created as Sending events only. The public test key only rehearses. | No |
413 |
batch_too_large |
More events, or more bytes, than one request may carry. Split the batch and send each half. | After splitting |
429 |
rate_limited |
Over the requests-per-minute budget: the company's, or the public test key's. Wait for the seconds in Retry-After, then send the same request again. | Yes |
500 |
internal_error |
A fault on our side. Nothing was written. Retry with exponential backoff, with the same event_ids. | Yes |
On 404 not_found: only a source address answers it.
Rejection codes
| Code | Fix |
|---|---|
invalid_event_id |
Send an id of 1 to 128 letters, digits and . _ : -, or leave event_id out. |
invalid_name |
Send a name of up to 80 characters that starts with a letter or a digit. |
missing_identity |
Add at least one way to name the person in user_data: an email, a phone, your own external_id, a baker_id, a click id, fbp or fbc. A value that is not one (an email with no @) names nobody. |
invalid_timestamp |
Send ISO-8601 with an offset (2026-11-20T14:03:00Z) or Unix seconds (not milliseconds: Math.floor(Date.now() / 1000)), no more than 5 minutes ahead. |
invalid_value |
Send value as a plain non-negative decimal (1200.50, no thousands separator, no exponent) with an uppercase ISO-4217 currency (EUR, not eur). |
batch_too_large |
Never in rejected: it is the 413 for the whole request. Split it: at most 500 events and 8 MB each. |
invalid_items |
Name each line by product_id, variant_id or feed_id; send quantity from 1 to 1,000,000 and price with a currency. |
invalid_consent |
Send granted or denied, or leave the field out. |
Note: Codes are only ever appended. Handle one you do not know as a refusal: log it with its message, and do not retry it.
Retries, timeouts and idempotency
429: wait the seconds in theRetry-Afterheader, then send the same request.5xx, a timeout or a dropped connection: retry with exponential backoff and jitter (for example 1, 2, 4, 8 seconds), up to a few minutes. A request that timed out may still have arrived, which is why the retry carries the sameevent_ids. Give each request a client timeout of 10 to 30 seconds.413: split the batch in two and send each half.- Any other
4xx: do not retry. The same request will be refused the same way. Fix it, or log it for a person. - An event in
rejected: do not resend it as it is. Fix the event and send it alone.
Tip: Retries are safe when every event carries an
event_id: the same id sent twice counts once. Without one, a retry of a request that did arrive counts its events twice. See Deduplication.
Log what you send
Log the status, received, accepted and every entry of rejected for each request. Discarding the body of a 200 is the most common way an integration looks right while dropping events. In Baker, Measure → Events lists refused events with what was sent, which is the quickest way to see why.
Limits and batching
One request carries up to 500 events and 8 MB. Each company may send 600 requests and 30,000 events a minute across all its keys, and test mode has a budget of its own. Over either, the answer is
429withRetry-After. Old events are welcome; an event more than 5 minutes in the future is refused.
Source: https://withbaker.com/docs/limits · Updated 2026-11-23
Rate limits and batch size
| Limit | Value | Over it |
|---|---|---|
| Events per request | 500 | 413 batch_too_large |
| Body size | 8 MB | 413 batch_too_large |
| Requests per minute, per company | 600 | 429 rate_limited, with Retry-After |
| Events per minute, per company | 30,000 | 429 rate_limited, with Retry-After |
event_name |
80 characters | invalid_name |
event_id |
1 to 128 characters | invalid_event_id |
event_time in the future |
5 minutes | invalid_timestamp |
event_time in the past |
No limit | |
items per event |
250 | The first ones are kept |
| Item id | 255 characters | invalid_items |
quantity |
1 to 1,000,000 | invalid_items |
| Public test key | 20 requests a minute per caller and 1 MB per request, its own budget, never a company's | 429 rate_limited, with Retry-After |
Batch your requests
Two budgets refill as token buckets: 600 requests a minute, so a webhook that sends one event at a time is answered even when a bulk edit in your CRM fires hundreds at once, and 30,000 events a minute, which bounds the volume however you batch. A short burst goes through; a sustained one gets a 429 with Retry-After. For a backfill or a busy stream, collect events for a few seconds, or a few hundred at a time, and send them together.
The limits are per company, shared by every key: a second key does not double them. Requests with X-Baker-Mode: test have their own budget of the same size, so a rehearsal never slows your live events.
Backfill historical events
- Give every event its own
event_time, when it really happened, and a stableevent_id. - Send 500 events per request, one request at a time.
- On
429, wait forRetry-Afterand carry on. On a timeout, resend the same batch: the ids make it count once. - Rehearse the first batch with
X-Baker-Mode: testto read the rejections before anything is stored.
That is 30,000 events a minute, a full batch every second or so: a year of a busy CRM in minutes. Need more for a one-off load? Write to support@withbaker.com.
Match events to people
An event is worth what it can be joined to. Send every way you have to name the person in
user_data: thebaker_ida Baker page gave the browser, an email or phone (plain or SHA-256), your ownexternal_id, an ad click id, or Meta'sfbpandfbc. Baker joins the event to the visits and the campaign that person came from.
Source: https://withbaker.com/docs/identity · Updated 2026-11-23
Why it matters
A deal is only useful to Baker if it can find the campaign that earned it. That join runs through the person: the same email filled in on a landing, the same browser that clicked an ad. user_data is required for that reason, and an event that names nobody is refused with missing_identity. The one exception is a page_view with a url, because a page served is a fact about a page.
The ways to name a person, best first
baker_id: the id a Baker page already gave this browser. It names the visit itself, so the event lands on that person's timeline. Send it if your system kept it, for example from a hidden form field.emailorphone: the road that cannot silently fail. Send them plain if you can: Baker normalises and hashes them exactly as its pages and pixel do, so they land on the same person.external_id: your own id for the person, such as a CRM contact id. It joins your events to each other; sent once beside an email or abaker_id, every later event with only the contact id joins the person too, including the ones already sent.- A click id,
fbporfbc: the ad click or browser that brought them. Enough on its own, and what attributes the event to a campaign.
Tip: Send every one you have, not only the best. Each is another chance to match, and they cost nothing extra.
A value that is not what its field says names nobody: an email with no @, a phone with no digits. If it was the only one, the event is refused with missing_identity, so check what your system really holds in those fields.
Hashed emails and phones (SHA-256)
If your policy forbids sending an email or a phone in the clear, send its SHA-256 digest, as 64 lowercase hex characters, in the same field. Baker tells a digest from a plain value on its own: there is no separate email_sha256 field.
Hash exactly what Baker hashes, or the digest names nobody: for an email, trim it and lower-case it; for a phone, keep the digits with a leading + and the country code (+34600111222).
Node.js
import { createHash } from "node:crypto";
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
const email = sha256(" Laura@Example.com ".trim().toLowerCase());
const phone = sha256("+34 600 111 222".replace(/[^\d+]/g, ""));
Python
import hashlib
import re
def sha256(value):
return hashlib.sha256(value.encode()).hexdigest()
email = sha256(" Laura@Example.com ".strip().lower())
phone = sha256(re.sub(r"[^\d+]", "", "+34 600 111 222"))
The matching fields
first_name through country never name a person on their own, so they never satisfy user_data by themselves. Send them anyway when you have them: they are what Meta's advanced matching and Google's enhanced conversions match on, so Baker can pass the event on to your ad platforms without asking your CRM again.
| Field | Meta | Kept as | |
|---|---|---|---|
email |
em |
hashed_email |
SHA-256 |
phone |
ph |
hashed_phone_number |
SHA-256 |
external_id |
external_id |
Plain text | |
first_name |
fn |
hashed_first_name |
SHA-256 |
last_name |
ln |
hashed_last_name |
SHA-256 |
date_of_birth |
db |
SHA-256 | |
gender |
ge |
Plain text | |
street |
hashed_street_address |
SHA-256 | |
city |
ct |
city |
Plain text |
region |
st |
state |
Plain text |
postal_code |
zp |
postal_code |
Plain text |
country |
country |
country_code |
Plain text |
fbp |
fbp |
Plain text | |
fbc |
fbc |
Plain text |
Consent
If your site asked the person, send what they chose in consent. analytics: denied keeps the event in your counts and forgets who it was. marketing: denied keeps it in your reports and never matches it to an ad platform or sends it to one. Absent means you did not say.
Deduplicate with event_id
Give an event an
event_idand Baker counts it once, however many times it arrives: a retry, a replayed backfill or two requests racing. Use an id that comes from your own record, such asdeal-48213-won, never a random one per attempt. The same id sent from the browser aswindow.baker.track(name, { eventId })makes the two one event.
Source: https://withbaker.com/docs/deduplication · Updated 2026-11-23
How deduplication works
event_id is optional and means one thing: deduplicate me. Send the same id twice and it is one event, one conversion, its value added once. Send none and every post is its own event. A repeat is accepted like any other event, so there is nothing to branch on: in Baker both arrivals are listed, and the later one is marked Already counted.
Choose a stable event id
- Derive it from your own record and the stage:
deal-48213-won,order-100482,order-100482-refund-1. A deal that is won, reopened and won again is two ids only if you want two wins. - Never generate it per attempt. A fresh UUID on each retry defeats the purpose: each retry is a new event.
- 1 to 128 characters of letters, digits and
. _ : -. An empty string is the same as sending none: nothing is deduplicated. - Twice in one batch counts once too: the rule holds wherever the copies arrive.
- Refunds need their own id: use the refund's id from your system (
order-100482-refund-r_88). With none, number them in order,order-100482-refund-1,-2: reusing one id for two partial refunds counts only the first.
Browser and server, counted once
An important outcome is worth reporting from both sides: a browser can be blocked by an ad blocker, a server cannot. Pass one string as event_id here and as eventId in Baker's pixel, and the two are one event, whichever arrives first and whether or not the other ever does.
Browser
// On the thank-you page, with Baker's pixel installed
window.baker.track("purchase", { eventId: "order-100482" });
Server
{
"events": [
{
"event_name": "purchase",
"event_id": "order-100482",
"user_data": {
"email": "laura@example.com"
},
"value": "89.90",
"currency": "EUR"
}
]
}
Heads-up: Without a shared id, the browser event and the server event are two conversions, and nothing anywhere reports an error.
Name your events
event_nameis yours: send whatever your business calls a thing, in any language. Where one fits, use Baker's standard names, such aslead,qualified_lead,deal_won,purchaseandrefund, so reports read the same across companies. Whether an event counts as a conversion is decided in Baker, by name, never in the request.
Source: https://withbaker.com/docs/event-names · Updated 2026-11-23
Standard names
| Name | Send it when |
|---|---|
page_view |
A page was served somewhere Baker does not run. |
view_content |
Someone looked at a specific thing: a listing, a property, an article. |
lead |
Someone became a lead: they handed over a way to reach them. |
contact |
Someone got in touch: a call, a chat, an email in. |
schedule |
A meeting, viewing or call was booked. |
sign_up |
An account was created. |
start_trial |
A trial began. |
subscribe |
A subscription started. |
qualified_lead |
Sales judged the lead worth working. The first event only you can send. |
opportunity |
A deal was opened against the lead. |
deal_won |
The deal closed. Send the money on it. |
deal_lost |
The deal was lost. Send it: a campaign that only reports wins reads as free. |
purchase |
Something was paid for. Send the money on it. |
refund |
Money went back. A separate event, never a negative amount. |
Nothing is refused for being missing from this list. The list exists so that Deal won, deal-won and ClosedWon do not become three things in one report.
page_view is different
page_view is the one name with behaviour: it becomes a page view rather than a named event, and it is the only event that may arrive without a person, as long as it carries a url. Use it for pages Baker's pixel cannot see, such as pages rendered by your own server.
Conversions are decided in Baker
Nothing in the payload can make an event a conversion. Someone in the company marks a name under Conversions in Baker, and it applies to every event under that name, including the ones already sent. So send events with clear names first and decide which count later.
Tip: Keep a name once you use it. Renaming
demo_bookedtoschedulesplits its history in two.
Examples
Copy-ready bodies for the events most companies send to Baker: a deal won in a CRM, an order with its products, a refund, a lead moving through the pipeline, a historical backfill and an event named only by its ad click id. Each is checked against the live contract before it is published, so it is accepted exactly as shown.
Source: https://withbaker.com/docs/examples · Updated 2026-11-23
A deal closed in your CRM
Send it the moment the deal is marked won, with the money on it.
{
"events": [
{
"event_name": "deal_won",
"event_id": "deal-48213-won",
"event_time": "2026-11-20T14:03:00Z",
"user_data": {
"email": "laura@example.com",
"external_id": "crm-contact-9921"
},
"value": "1200.00",
"currency": "EUR",
"properties": {
"pipeline": "Enterprise",
"owner": "Marta"
}
}
]
}
An order paid in your store
One event per order, with one line per product, so reports can break revenue down by product.
{
"events": [
{
"event_name": "purchase",
"event_id": "order-100482",
"user_data": {
"email": "laura@example.com",
"phone": "+34600111222",
"fbp": "fb.1.1763650000000.1234567890"
},
"value": "89.90",
"currency": "EUR",
"items": [
{
"product_id": "SKU-TEE-01",
"variant_id": "SKU-TEE-01-M",
"quantity": 2,
"price": "29.95"
},
{
"product_id": "SKU-CAP-02",
"quantity": 1,
"price": "30.00"
}
],
"consent": {
"analytics": "granted",
"marketing": "granted"
}
}
]
}
A refund
A refund is its own event, with the amount that went back as a positive number. Give it the refund's own id, and name the order in properties so the two can be read together.
{
"events": [
{
"event_name": "refund",
"event_id": "order-100482-refund-1",
"user_data": {
"email": "laura@example.com"
},
"properties": {
"order_id": "order-100482"
},
"value": "29.95",
"currency": "EUR",
"items": [
{
"product_id": "SKU-TEE-01",
"variant_id": "SKU-TEE-01-M",
"quantity": 1,
"price": "29.95"
}
]
}
]
}
A lead moving through your pipeline
Send each stage as it happens, so campaigns are judged on the leads sales kept, not only on form fills.
{
"events": [
{
"event_name": "qualified_lead",
"event_id": "crm-contact-9921-qualified",
"user_data": {
"external_id": "crm-contact-9921",
"email": "laura@example.com"
}
},
{
"event_name": "opportunity",
"event_id": "deal-48213-opened",
"user_data": {
"external_id": "crm-contact-9921"
},
"value": "1200.00",
"currency": "EUR"
}
]
}
A backfill of last year's history
Old events are welcome: give each its own event_time and event_id, and send up to 500 per request.
{
"events": [
{
"event_name": "deal_won",
"event_id": "deal-30117-won",
"event_time": 1735725600,
"user_data": {
"email": "jordi@example.com"
},
"value": "4800",
"currency": "EUR"
},
{
"event_name": "deal_lost",
"event_id": "deal-30122-lost",
"event_time": "2025-01-14T09:30:00+01:00",
"user_data": {
"email": "ana@example.com"
}
}
]
}
A call booked from an ad click (gclid)
When all you kept is the click id the visitor arrived with, send it: it names the person and the campaign.
{
"events": [
{
"event_name": "schedule",
"url": "https://example.com/book?utm_source=google&utm_campaign=brand",
"user_data": {
"gclid": "EAIaIQobChMI8sLd0tqZjwMVf0D_AR0abc"
}
}
]
}
Changelog
What changed in Baker's API, newest first. Within
/v1changes only add: new optional fields, new standard names, new rejection codes appended to the list. Nothing you already send changes meaning.
Source: https://withbaker.com/docs/changelog · Updated 2026-11-23
23 November 2026
- The API documentation is public, with an OpenAPI 3.1 description.
429 rate_limitedanswers carry aRetry-Afterheader with the seconds to wait.- The public test key,
bk_test_public: call the real API with no account; nothing is stored. - A JSON Schema of the request body, at /docs/event-batch.schema.json, and an API catalog for crawlers (RFC 9727).
Need help?
Write to support@withbaker.com: a person answers within 24 hours.