This is the complete reference for the PitchButler API, version 1. If you have not made a call yet, start with the getting-started guide.
Basics
- Base URL
https://pitchbutler.io/api/v1 - Authentication a bearer API key on every request:
Authorization: Bearer pb_live_…. Keys are created in the app under Settings, then API. Session cookies never authenticate the API. - Format JSON request and response bodies, UTF-8. Timestamps are ISO 8601 in UTC. Ids are UUIDs.
- Scopes
read(every key) andwrite(adding leads, opting a lead out). - Rate limit 120 requests per minute per key. Above it you get
429with aRetry-Afterheader. - Versioning fields are only ever added to responses, never renamed or removed. A breaking change would ship as
/api/v2.
Endpoints
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /me |
read | Your workspace and this key’s scopes |
| GET | /campaigns |
read | Campaigns with their ids |
| GET | /leads |
read | List leads, with filters and paging |
| GET | /leads/{id} |
read | One lead |
| POST | /leads |
write | Add a lead |
| POST | /leads/{id}/do-not-contact |
write | Permanent opt-out |
GET /me
Returns the workspace and the key making the call. Use it to test a key.
{
"tenant": {"id": "uuid", "name": "Example AB", "slug": "example"},
"api_key": {"id": "uuid", "name": "HubSpot sync", "scopes": ["read", "write"]}
}
GET /campaigns
Campaigns that have not been deleted, newest first.
{
"campaigns": [
{"id": "uuid", "name": "Spring outreach", "status": "active",
"language": "sv", "created_at": "2026-10-01T08:00:00Z"}
]
}
GET /leads
Query parameters, all optional:
| Parameter | Meaning |
|---|---|
status |
one lead status (see the list below) |
campaign_id |
a campaign id |
search |
a plain substring of email, contact name or company name; no wildcards |
limit |
1 to 500, default 50 |
offset |
default 0 |
{
"leads": [ …lead objects… ],
"total": 212,
"limit": 50,
"offset": 0
}
Ordered newest first. total is the count of everything that matches the filters, not the page.
GET /leads/{id}
One lead object, or 404 if it is not in your workspace.
POST /leads
Body:
| Field | Required | Notes |
|---|---|---|
email |
yes | normalised to lower case; must be a valid address |
contact_name |
no | up to 255 characters |
company_name |
no | up to 255 characters |
campaign_id |
no | must be one of your campaigns; without it the lead is parked after research until you assign it in the app |
timezone |
no | an IANA name such as Europe/Stockholm; send windows follow it |
custom_fields |
no | an object, up to 50 keys and 16 KB; keys are lowercased; website helps research |
Responses:
201with{"lead": {…}, "created": true}when the address was new.200with{"lead": {…}, "created": false}when your workspace already had the address. Nothing changes on the existing lead.
A new lead starts in status enriching, with source recorded as the API and an import batch named after your key and the day. It is researched, scored against the campaign’s profile and then queued for the campaign’s first email and follow-ups, exactly like a CSV row. An address that was erased under GDPR in your workspace is created already marked do_not_contact and is never emailed.
The keys research, intel, discovery_audit, research_signals, person_upgrade, domain_mismatch, domain_mismatch_reason and franchise_brand are written by the pipeline itself and are refused in custom_fields.
POST /leads/{id}/do-not-contact
Permanent opt-out, the same path an “unsubscribe” reply takes. Sets do_not_contact, cancels every pending email and action for the lead, moves it to unsubscribed (or dead if it had never been contacted), writes an audit entry and adds the address to the workspace’s suppression list so a re-import can never revive it.
{"id": "uuid", "do_not_contact": true, "status": "unsubscribed", "already": false}
already is true when the lead was opted out before this call. Idempotent; no undo.
The lead object
Every endpoint that returns a lead returns this shape.
| Field | Type | Meaning |
|---|---|---|
id |
uuid | |
email |
string or null | lower-cased |
contact_name |
string or null | |
company_name |
string or null | |
campaign_id |
uuid or null | null until assigned |
status |
string | see below |
status_changed_at |
timestamp or null | when status last changed |
score |
integer or null | 1 to 10 fit against the campaign’s profile, set by research |
do_not_contact |
boolean | permanent opt-out |
timezone |
string or null | IANA name |
custom_fields |
object | yours, plus what research added |
created_at |
timestamp | |
updated_at |
timestamp or null |
Lead statuses
The ones you will meet most, in the order a lead usually moves:
| Status | Meaning |
|---|---|
enriching |
being researched |
queued |
researched, waiting for a slot in the campaign |
assigned |
a mailbox has it; the first email is scheduled |
contacted |
at least one email sent, no reply yet |
engaged |
they replied; the AI is handling the conversation |
hot |
interested; a human should act |
handed_off |
a human has taken over |
converted |
won |
bounced |
the address bounced |
unsubscribed |
they opted out (or you did it for them) |
dead |
closed without a result |
The status filter also accepts the intermediate states the pipeline uses: awaiting_approval, bounce_pending, closed, deferred, discovering, discovery_needs_review, queued_for_discovery, stuck, validating. An unknown value is a 400 whose detail lists every valid one.
Errors
| Code | When | Body |
|---|---|---|
| 400 | well-formed but wrong: unknown status, invalid email, unknown campaign, non-IANA timezone, too many keys | detail string |
| 401 | no key, unknown, revoked or expired key; carries WWW-Authenticate: Bearer |
detail string |
| 403 | the key lacks the scope | detail string |
| 404 | not in your workspace or does not exist | detail string |
| 422 | body does not match the schema | detail string plus error.fields naming each field |
| 429 | over the rate limit; carries Retry-After |
detail string |
| 503 | briefly unavailable; carries Retry-After; your key is fine |
detail string |
Every error body is {"success": false, "detail": "…", "error": {"code": "…", "message": "…"}, "request_id": "…"}. Quote request_id when you contact support.
Keys and security
- Keys are 32 random bytes behind a
pb_live_prefix. We store only a hash; a leaked database cannot reproduce a key. - The first twelve characters are shown in the app so you can tell keys apart. The full key is shown once, at creation.
- Give one key per integration and name it so. Revoking one does not touch the others.
- A key can expire. An expired key answers
401; create a new one. - Only workspace admins can create or revoke keys. Every create and revoke is written to the workspace audit log.
- A key belongs to the workspace, not to the person who created it. Revoke keys when people leave.