Authentication
One API key decides everything: which project you are acting on, whether messages are real, and what you are allowed to do.
Sending the key
curl https://api.pigeon.dev/v1/whoami \
-H "Authorization: Bearer pgn_live_2e05cdb6_dfd13c1f..."X-API-Key is accepted too, for tools that only offer a custom header:
curl https://api.pigeon.dev/v1/whoami \
-H "X-API-Key: pgn_live_2e05cdb6_dfd13c1f..."What a key looks like
pgn_live_2e05cdb6_dfd13c1f... — the prefix says which environment it belongs to, so a key pasted into the wrong place is visibly wrong rather than quietly wrong.
The environment is part of what is signed, not a label on the side. Editing pgn_test_ to pgn_live_ does not promote a key; it breaks it.
Roles
| Role | Can |
|---|---|
send | Send messages and upload media. Cannot read the message log. |
read | Read messages back. Cannot send. |
admin | Both. |
The split is the point. A credential that leaks from a server which only ever sends should not also expose every message the project has exchanged. Give each service the narrowest key that does its job.
These are not the console's owner / developer / viewer roles. Those govern people; these govern machines, and the two are deliberately separate vocabularies.
Live and test
A pgn_test_ key writes a real message row, fires every validation rule, and sends nothing to WhatsApp. Suppression, consent, pacing and the 24-hour window all apply exactly as on live, because a test mode that skipped them would teach you nothing.
There is no environment flag in your code. Swap the key and that is the whole change.
Checking a key
{
"data": {
"project_id": "proj_01h9",
"environment": "live",
"key_role": "send",
"key_id": "key_01h9"
}
}The first call worth making. Before sending anything, it tells you which project and which environment you are about to act on.
Rate limits
Counted per key, not per IP, so one service cannot exhaust another service's budget and revoking a leaked key takes its budget with it. Sends, media uploads and reads have separate allowances, so polling cannot starve sending.
Every response carries X-RateLimit-Limit and X-RateLimit-Remaining; a 429 carries Retry-After. Pace yourself with those rather than finding out by being stopped.
Messages
Send text, files and templates.
Error codes
Including every way a key can be refused.