# Call Bullet Developer API (v1: read APIs plus SMS, draft agents and click-to-call)

> One API for UK numbers, call tracking (Inbound), outbound business lines, SMS with delivery proof and AI voice agents. Read call logs, caller numbers, date/time, answered/missed status, attribution/source, tracking numbers, recordings, transcripts and leads. Signed webhooks for call events.

## Instructions for AI agents
You are connecting to the Call Bullet call tracking API (read-only).
Documentation: https://callbullet.com/developers/api.md
1. Ask me for a Call Bullet API key (starts with cb_live_). I create it at https://callbullet.com/integrations → Developer API.
2. Store it server-side only. Send it as: Authorization: Bearer <key>
3. Base URL: https://callbullet.com/api/public/v1. Call GET /workspaces first, then GET /workspaces/{id}/calls and /numbers.
4. Times are UTC ISO-8601; report in Europe/London. Numbers are E.164. Money is GBP pence.
5. answered=false means missed. Use updated_since for incremental sync. Respect Retry-After on 429.

## Integrate everything in one prompt
You are integrating Call Bullet (UK numbers, call tracking, outbound calling, SMS and AI voice agents) into my app.
Docs (markdown): https://callbullet.com/developers/api.md · OpenAPI: https://callbullet.com/openapi.json
1. Ask me for a Call Bullet API key (cb_live_…). I create it at https://callbullet.com/integrations → Developer API and pick scopes per product. Store it server-side only as CALL_BULLET_API_KEY.
2. GET /account to learn the key's workspace_ids and permissions. Only build features the key has scopes for.
3. Calls (Inbound + Outbound): sync GET /workspaces/{id}/calls?updated_since=… every few minutes; store call id as external ID; match from_number (E.164) to my contacts; show answered/missed, source and recording links.
4. SMS: follow https://callbullet.com/developers/api/sms — one server function sendSms with Idempotency-Key, delivery badge from GET /sms/messages/{id}, handle 402/422 errors.
5. AI Agents: GET /workspaces/{id}/agent-calls to show what each agent handled (caller_request, outcome, summary) and create follow-up tasks in my app.
6. Usage: GET /workspaces/{id}/usage for a small usage widget.
7. Times are UTC ISO-8601 (display Europe/London), money in GBP pence, respect 429 Retry-After, never log the key.

## Products and scopes
### Workspace
Who the key belongs to and what it can reach.
- `workspaces:read` (Workspaces, read): List workspaces and account details.
- `usage:read` (Usage & billing, read): Numbers, minutes, texts and credits this billing period.

### Inbound
Call tracking: numbers, calls and where callers came from.
- `numbers:read` (Tracking numbers, read): Numbers, placements, locations, views and call counts.
- `calls:read` (Calls, read): Call log: caller, time, answered/missed, duration, source.
- `attribution:read` (Attribution, read): Visit, UTM, click ID and confidence per call.
- `recordings:read` (Recordings, read): Signed listen links for recorded calls.
- `transcripts:read` (Transcripts, read): Transcripts and AI summaries.
- `leads:read` (Leads & outcomes, read): Lead status, value and next action.

### Outbound
Outbound lines and outbound calls.
- `phone_lines:read` (Phone lines, read): Outbound lines used for calling out.
- `outbound_calls:read` (Outbound calls, read): Outbound call history (direction=outbound).
- `calls:place` (Outbound calls, write): Click-to-call: ring your own staff line, then connect a customer who asked to be called. Pre-checked and capped.

### SMS
Business texting with delivery proof.
- `sms:read` (Messages, read): Messages, delivery timelines, senders, templates, balance.
- `sms:send` (Messages, write): Send texts (uses credits), including free test-mode sends.
- `sms:read` (Senders, read): Sender names and numbers with approval status.
- `sms:senders:write` (Senders, write): Request sender names (approval stays with Call Bullet).
- `sms:read` (Templates, read): Templates and their fields.
- `sms:templates:write` (Templates, write): Create, update and delete templates.
- `sms:read` (Delivery webhooks, read): List SMS webhooks for these workspaces.
- `sms:webhooks:write` (Delivery webhooks, write): Register or disable webhooks for SMS delivery, click and sender events.

### AI Agents
Your AI voice agents and the work they do.
- `agents:read` (Agents, read): Agents, roles, status, live version and numbers.
- `agents:write` (Agents, write): Create and edit draft agents and attach numbers. Going live stays in Call Bullet.
- `agent_calls:read` (Agent calls, read): Calls handled by agents: summary, outcome, caller request.
- `campaigns:read` (Campaigns, read): Campaigns and contact status (consent, screening).
- `agent_tasks:read` (Tasks & reports, read): Tasks, routines and their results.

### Integrations
Proof of delivery to marketing platforms.
- `delivery:read` (Google Ads / GA4 delivery, read): Conversion and event delivery evidence.

## Quick start
```bash
curl https://callbullet.com/api/public/v1/workspaces -H "Authorization: Bearer $CALL_BULLET_API_KEY"
curl "https://callbullet.com/api/public/v1/workspaces/WORKSPACE_ID/calls?from=2026-10-01T00:00:00Z&per_page=500&include=attribution" -H "Authorization: Bearer $CALL_BULLET_API_KEY"
```

## Data model
Agency → Workspaces (one per client business) → Tracking numbers → Calls → Attribution / Recording / Transcript / Lead.

## Call fields
- `id`: Stable call ID (UUID). Use as your external ID.
- `started_at`: When the call began, ISO-8601 UTC. Convert to Europe/London for UK reporting.
- `from_number`: The caller's number in E.164 (+44…). Match this to CRM contacts.
- `to_number`: The Call Bullet number that was dialled.
- `answered`: true if a person or agent answered; false means missed.
- `call_status`: completed | missed | voicemail | failed | in_progress.
- `duration_seconds`: Talk time in seconds.
- `is_first_time_caller`: true the first time this caller rang this workspace.
- `source / medium`: Where the caller came from, e.g. google / cpc, google / organic, direct.
- `campaign / keywords`: Ad campaign and keyword when captured.
- `landing_page_url / referrer_url`: Website page the visitor arrived on and the page that sent them.
- `value_pence`: Call or lead value in GBP pence (25000 = £250).
- `has_recording / has_transcript`: Only then call the recording or transcript endpoint.
- `lead_status`: new | qualified | quoted | booked | won | lost | spam.
- `tracking_number_id / client_id`: Links the call to a number and workspace.
- `origin`: call_bullet (tracked by us) or callrail_import (imported history).
- `callrail_id`: Original ID of an imported call, for de-duplication.

## Endpoints
### GET /account
Key ID, scope read time, permissions, workspace IDs and number scope. A restricted scope lists permitted number IDs within those workspaces; unrestricted scope uses null (all numbers in permitted workspaces).
Permission: `workspaces:read`

Example response:
```json
{"data":{"agency_id":"8f0c…","workspace_ids":["2b1d…"],"permissions":["calls:read","numbers:read"],"number_scope":{"restricted":true,"permitted_number_ids":["9a2e…"]},"access":"read_only"}}
```

### GET /workspaces
Client workspaces (one per business) this key may read, with a migration block.
Permission: `workspaces:read`

Example response:
```json
{"data":[{"id":"2b1d…","name":"Acme Plumbing","website_url":"https://acme.co.uk","migration":{"has_callrail_import":false}}]}
```

### GET /workspaces/{workspace_id}
One workspace.
Permission: `workspaces:read`

Example response:
```json
{"data":{"id":"2b1d…","name":"Acme Plumbing"}}
```

### GET /workspaces/{workspace_id}/numbers
Tracking numbers with placement (website pool, Google profile, offline), location, rings_to, views and call counts.
Permission: `numbers:read`
- `from / to`: ISO-8601 range for call counts (default last 30 days)
- `origin`: all | call_bullet | callrail_import
- `include_released`: true to include released numbers
- `page / per_page`: per_page max 500

Example response:
```json
{"data":[{"id":"9a2e…","number":"+441614450005","placement":"website_pool","pool_name":"Manchester","location":"Didsbury","rings_to":"+441612345678","views":{"kind":"website_impressions","count":1840},"calls":{"total":42,"answered":37,"missed":5,"first_time_callers":31,"last_call_at":"2026-10-03T15:12:00Z"}}]}
```

### GET /workspaces/{workspace_id}/calls
Call log: caller number, date/time, answered/missed, duration, source, campaign and more.
Permission: `calls:read`
- `from / to`: ISO-8601 start time range
- `updated_since`: ISO-8601; use for incremental sync
- `answered`: true | false
- `source`: e.g. google, facebook, direct
- `caller`: first | repeat
- `number_id`: only calls to one tracking number
- `origin`: call_bullet | callrail_import
- `include`: attribution — embed attribution in each call
- `sort / order`: started_at (default) / desc
- `page / per_page`: per_page max 500

Example response:
```json
{"data":[{"id":"c71f…","started_at":"2026-10-03T14:05:11Z","from_number":"+447700900123","to_number":"+441614450005","direction":"inbound","caller_name":null,"answered":true,"call_status":"completed","duration_seconds":184,"is_first_time_caller":true,"source":"google","medium":"cpc","campaign":"Boiler repair","keywords":"emergency plumber","landing_page_url":"https://acme.co.uk/boilers","has_recording":true,"has_transcript":true,"origin":"call_bullet"}],"page":1,"per_page":100,"total_records":1,"total_pages":1,"has_next_page":false}
```

### GET /calls/{call_id}
One call.
Permission: `calls:read`

Example response:
```json
{"data":{"id":"c71f…","answered":true}}
```

### GET /calls/{call_id}/attribution
Source evidence (visit, UTMs, click ID type, referrer) and confidence for one call.
Permission: `attribution:read`

Example response:
```json
{"data":{"source":"google","medium":"cpc","click_id_type":"gclid","confidence":"high","model":"last_touch"}}
```

### GET /calls/{call_id}/recording
listen_url (branded page, 7 days) and url (direct audio, 15 minutes).
Permission: `recordings:read`

Example response:
```json
{"data":{"available":true,"listen_url":"https://callbullet.com/listen/c71f…","url":"https://…","expires_at":"…"}}
```

### GET /calls/{call_id}/transcript
Transcript and AI summary when available.
Permission: `transcripts:read`

Example response:
```json
{"data":{"available":true,"summary":"Caller needs a boiler repair today…","text":"…"}}
```

### GET /workspaces/{workspace_id}/leads
Lead status, value and next action.
Permission: `leads:read`

Example response:
```json
{"data":[{"call_id":"c71f…","status":"qualified","value_pence":25000}]}
```

### GET /integrations/google-ads/status
Google Ads conversion delivery evidence.
Permission: `delivery:read`

Example response:
```json
{"data":{"accepted":12,"failed":0}}
```

### GET /integrations/ga4/status
GA4 event delivery evidence.
Permission: `delivery:read`

Example response:
```json
{"data":{"accepted":40,"failed":1}}
```

### GET /sms/messages?workspace_id={id}
Sent texts with live delivery status (queued, sent, delivered, failed, expired), segments and credits. Filters: status, to, external_ref, tag, campaign, template_id, test (false default | true | all), from, to_date, updated_since.
Permission: `sms:read`

Example response:
```json
{"data":[{"id":"5e1a…","from":"GoTints","to":"+447700900123","status":"delivered","segments":1,"credits":1,"delivered_at":"2026-10-07T09:01:04Z"}]}
```

### GET /sms/messages/{message_id}
One text with its full carrier event timeline, tracked links, clicks and SMS-influenced calls. Use to prove delivery and response.
Permission: `sms:read`

Example response:
```json
{"data":{"id":"5e1a…","status":"delivered","events":[{"event_type":"queued"},{"event_type":"submitted"},{"event_type":"message.finalized","status":"delivered"}]}}
```

### GET /sms/senders?workspace_id={id}
Approved sender names and numbers (sender_id needed to send).
Permission: `sms:read`

Example response:
```json
{"data":[{"id":"a9…","kind":"alphanumeric","value":"GoTints","status":"approved","replies_allowed":false}]}
```

### GET /sms/readiness?workspace_id={id}
Start here. Senders and approval, templates, credits, webhooks, live_ready/test_ready and the exact next step.
Permission: `sms:read`

Example response:
```json
{"data":{"live_ready":false,"test_ready":true,"next_step":"Sender is waiting for Call Bullet review. Use test:true sends meanwhile.","credits":0}}
```

### GET /sms/workspaces
Every workspace (brand) this key can text for, with credits, senders, templates, live_ready and suggested sender names.
Permission: `sms:read`

Example response:
```json
{"data":[{"workspace_id":"b6…","name":"Car Specialist Customs","credits":0,"senders":[],"live_ready":false,"suggested_sender_names":["CSC"]}]}
```

### GET /sms/test-mobiles?workspace_id={id}
Verified test mobiles. POST /sms/test-mobiles texts a code; POST /sms/test-mobiles/verify confirms it (sms:send).
Permission: `sms:read`

Example response:
```json
{"data":[{"phone":"+447700900123","verified":true}]}
```

### GET /sms/webhooks
SMS webhooks for this key's workspaces. POST registers one (sms:webhooks:write) and returns its signing secret once; DELETE /sms/webhooks/{id} disables it.
Permission: `sms:read`

Example response:
```json
{"data":[{"id":"w1…","endpoint_url":"https://app.example.com/api/call-bullet","events":["sms.delivered"],"enabled":true}]}
```

### GET /sms/senders/{sender_id}
One sender with approval status and reason.
Permission: `sms:read`

Example response:
```json
{"data":{"id":"a9…","kind":"alphanumeric","value":"CSC","status":"pending","replies_allowed":false}}
```

### GET /sms/templates?workspace_id={id}
Saved templates with {{variables}}, estimated segments and encoding.
Permission: `sms:read`

Example response:
```json
{"data":[{"id":"t1…","name":"Booking confirmed","body":"Hi {{customer_name}}, job {{job_ref}} is booked for {{date}}.","variables":["customer_name","job_ref","date"],"estimated_segments":1}]}
```

### GET /workspaces/{workspace_id}/phone-lines
Outbound: business phone lines (label, caller-ID capable, recording).
Permission: `phone_lines:read`

Example response:
```json
{"data":[{"id":"7c…","phone_number":"+441706612832","label":"Outbound","can_call_out":true}]}
```

### GET /workspaces/{workspace_id}/outbound-calls
Outbound: call history from your lines. Filters: from, to, updated_since.
Permission: `outbound_calls:read`

Example response:
```json
{"data":[{"id":"c9…","to_number":"+447700900123","answered":true,"duration_seconds":212}]}
```

### GET /workspaces/{workspace_id}/agents
AI Agents: every agent with role, status, live version and is_live.
Permission: `agents:read`

Example response:
```json
{"data":[{"id":"a1…","name":"Sam","role":"Accounts","status":"active","is_live":true}]}
```

### GET /agents/{agent_id}
AI Agents: one agent with its number assignments.
Permission: `agents:read`

Example response:
```json
{"data":{"id":"a1…","name":"Sam","number_assignments":[]}}
```

### GET /workspaces/{workspace_id}/agent-calls
AI Agents: calls an agent handled, with caller request, summary, outcome and urgency. Filters: agent_id, from, to.
Permission: `agent_calls:read`

Example response:
```json
{"data":[{"id":"ac…","agent_id":"a1…","caller_name":"Jo","caller_request":"Quote for 4 tyres","outcome":"lead","urgency":"normal","summary":"…"}]}
```

### GET /workspaces/{workspace_id}/campaigns
AI Agents: campaigns; add campaign_id=… for contacts with consent and TPS status.
Permission: `campaigns:read`

Example response:
```json
{"data":[{"id":"cp…","name":"Win-back","status":"draft"}]}
```

### GET /workspaces/{workspace_id}/agent-tasks
AI Agents: tasks and routines with status and results.
Permission: `agent_tasks:read`

Example response:
```json
{"data":[{"id":"t…","title":"Chase overdue invoices","status":"completed","result":{}}]}
```

### GET /workspaces/{workspace_id}/usage
Usage this month: numbers, inbound/outbound/AI minutes, texts and credits left.
Permission: `usage:read`

Example response:
```json
{"data":{"minutes":{"inbound_answered":840,"outbound":120,"ai_agents":64},"sms":{"sent":310,"credits_left":1690}}}
```

### GET /sms/balance?workspace_id={id}
SMS credits left.
Permission: `sms:read`

Example response:
```json
{"data":{"credits":1840}}
```

### GET /sms/usage?workspace_id={id}&from=…&to_date=…&group_by=day
SMS usage: texts, delivered, failed, delivery rate and credits used, grouped by day|template|campaign|status|tag|sender. Tests excluded unless test=all.
Permission: `sms:read`

Example response:
```json
{"data":{"credits_balance":24,"totals":{"texts":120,"delivered":117,"failed":2,"pending":1,"segments":131,"credits_used":131,"delivery_rate_pct":98.3},"rows":[{"key":"2026-10-07","texts":12,"credits_used":13}]}}
```

### GET /sms/credits/ledger?workspace_id={id}&page=1
Credit history: every starter grant, purchase, subscription, send and refund with running balance and linked message_id.
Permission: `sms:read`

Example response:
```json
{"data":[{"created_at":"2026-10-07T08:29:00Z","reason":"send","credits":-1,"balance_after":24,"message_id":"…","external_ref":"job-1042"}],"credits_balance":24}
```

## Write endpoints (agents and click-to-call)
### POST /agents (agents:write)
Create a draft AI voice agent. Body: workspace_id, name, greeting, instructions?, business_info?, task?, persona_id?, fallback_number?. Returns status "draft", live:false and go_live_url — testing, certification and billing are finished in Call Bullet. API-made agents never go live by themselves.
### PATCH /agents/{agent_id} (agents:write)
Edit a draft agent. 409 agent_not_draft once it is live.
### POST /agents/{agent_id}/numbers (agents:write)
Attach a number from the same workspace: {tracking_number_id, is_primary?}. Calls reach the agent only once it is live.
### POST /agents/{agent_id}/review-request (agents:write)
Tell the workspace owner the draft is ready. Returns 202 {review_requested:true}. The owner runs the in-app test call and approves certification; the API can never take an agent live. Read status any time with GET /agents/{agent_id} (agents:read).
### Typical agent flow for an AI coding assistant
1) Ask the user for a key with agents:read + agents:write. 2) GET /workspaces and /workspaces/{id}/numbers. 3) POST /agents. 4) POST /agents/{id}/numbers. 5) POST /agents/{id}/review-request. 6) Tell the user to open go_live_url to test and approve. 7) Poll GET /agents/{id} until status is live.
### POST /calls/click-to-call (calls:place)
For customers who asked to be called back. Body: workspace_id, phone_line_id (an active outbound line with a staff phone), to (UK number), consent_ref (your record of the request, e.g. "callback-form-8812"). Header Idempotency-Key. Rings the staff phone first, then connects the customer from the line's number. A person always speaks. Returns 202 {id, status:"ringing_staff", call_id}. Blocked with 422 outside_hours (Mon–Sat 8am–9pm UK), suppressed, tps_listed, spend_cap, daily_cap (50 per key per day), line_not_owned, line_has_no_phone, invalid_number; 503 tps_unavailable or calling_unavailable. The call then appears in GET /workspaces/{id}/outbound-calls and fires the normal call.* webhooks.
### GET /calls/click-to-call/{id} (calls:place)
Status lookup. status: ringing_staff → connecting (staff answered, customer ringing) → connected → ended; or staff_missed, blocked (with blocked_reason), failed. Repeating a POST with the same Idempotency-Key returns the original request with duplicate:true and never dials twice.
Example: {"data":{"id":"…","status":"connected","workspace_id":"…","phone_line_id":"…","to":"+447700900123","call_id":"…","blocked_reason":null,"created_at":"2026-10-08T10:00:00Z","updated_at":"2026-10-08T10:00:21Z"}}

## SMS
Send UK business texts and prove delivery. Credits: 1 per UK segment (160 GSM / 70 Unicode chars); failed texts refunded.
```bash
curl -X POST https://callbullet.com/api/public/v1/sms/messages \
  -H "Authorization: Bearer $CALL_BULLET_API_KEY" \
  -H "Idempotency-Key: quote-48213" \
  -H "Content-Type: application/json" \
  -d '{"workspace_id":"WORKSPACE_ID","sender_id":"SENDER_ID","to":"07700900123","body":"Hi Sam, your quote is ready: https://…"}'
# 202 → {"data":{"id":"…","status":"sent","segments":1,"credits":1}}
# Template + attribution: {"workspace_id":"…","sender_id":"…","to":"07700900123","template_id":"…",
#   "variables":{"customer_name":"Sam","job_ref":"J-1042"},"external_ref":"job-1042","tags":["booking"],
#   "campaign":"MOT reminders","track_links":true}
# Test mode: add "test":true → full checks, rendered text, simulated delivery, 0 credits, nothing sent.
# Errors: 402 insufficient_credits · 422 opted_out | compliance_blocked | sender_not_ready | invalid_request
```
Statuses: queued → sent (network accepted) → delivered (handset confirmed) | failed | expired. Full guide: https://callbullet.com/developers/api/sms

### AI prompt: build SMS into my app
You are adding SMS to my app using Call Bullet (UK business texting with delivery proof).
Docs: https://callbullet.com/developers/api/sms · Spec: https://callbullet.com/openapi.json
Base URL https://callbullet.com/api/public/v1 · Auth: Authorization: Bearer <key>, server-side only (env CALL_BULLET_API_KEY). Never call it from the browser.

Ask me ONLY for: the API key (the "Full SMS app" preset covers every brand it is scoped to) and my test mobile. Everything else you discover.

1. GET /sms/workspaces → every brand this key can use, with credits, senders, templates, live_ready and suggested_sender_names. Never guess IDs.
2. For each brand: GET /sms/readiness?workspace_id=… . Follow next_step. Show me human_actions in plain words (buy credits, verify mobile, consent) with their links.
3. No sender → POST /sms/senders {workspace_id, kind:"alphanumeric", value, use_case, sample_message}. Names are 3–11 letters/numbers/spaces; on 422 invalid_sender_name use error.suggestions and tell me what you picked. New senders are "pending" until Call Bullet approves (usually one working day). Sender names can't take replies.
4. Templates → GET /sms/templates; create/update with POST /sms/templates and PATCH /sms/templates/{id} using {{customer_name}}, {{job_ref}} variables. 409 = exists → PATCH. Keep under 160 plain characters.
5. Simulated test now → POST /sms/messages with "test":true, template_id and realistic demo variables. Show me the rendered body, segments and timeline. Nothing is sent, no credits.
6. Real test to ANY number the owner chooses, free, even while the sender is pending → POST /sms/test-mobiles {workspace_id, phone}; ask for the 6-digit code that number receives; POST /sms/test-mobiles/verify {workspace_id, phone, code}. Then send with "test":"live". Pending senders arrive from "CallBullet" prefixed "[Test] <Brand>:". Max 20 a day per brand. Never send live to customers until the owner has reviewed every template.
7. Webhooks → POST /sms/webhooks {workspace_ids:[…], url:"https://<my app>/api/call-bullet", events omitted = all}. Store signing_secret (shown once); verify X-Call-Bullet-Signature = "v1=" + HMAC-SHA256(secret, X-Call-Bullet-Timestamp + "." + raw body). Handle sms.sent, sms.delivered, sms.failed, sms.clicked, sms.sender.approved (resume go-live automatically), sms.sender.rejected (tell me the reason).
8. Production sendSms({workspace, to, templateId, variables, reference, tags, campaign}) → POST /sms/messages with Idempotency-Key = stable reference ("job-1042-booked"), external_ref = my job/lead ID, metadata {job_id, lead_id, customer_id, customer_name}, tags, campaign, track_links:true when there is a link. Store the returned Call Bullet message id on my job/lead record. Normalise UK numbers to +44. Only send live once readiness.live_ready is true (every workspace includes 25 free credits; live texts need an approved sender).
9. Errors carry next_step and sometimes human_action: 402 insufficient_credits, 422 sender_not_ready | opted_out | compliance_blocked | missing_variables | invalid_phone, 429 → Retry-After. 403 forbidden with missing_permission → existing keys can be upgraded in place; do not ask for a new key. Ask me to click Edit permissions on the same key, choose Full SMS app and Save, then retry.

## Build an SMS accountability page in my app (single source of truth)
Make it unforgivingly simple and detailed. Plain English, no jargon, times in Europe/London.
- Workspaces: if the key covers more than one brand, group, location or workspace, add a switcher (tabs for a few, a dropdown/search for many; hide it when there is only one). Never mix workspaces' data. Adapt to how my app is structured — don't assume brands.
- Inside each workspace, sub-sections:
  a. Sender name — the name customers see, its status (pending / approved / rejected + reason) and what that means, and whether replies are possible.
  b. Templates — every template with a rendered preview using sample variables, characters, segments/credits per send, category, and a "Send test" button (any number, verified by code as in step 6).
  c. Messages log — every text, newest first, searchable by phone number, job/lead reference, customer, campaign, template, status and date (GET /sms/messages?workspace_id&to&external_ref&campaign&template_id&tag&status&from&to_date&test=all). Each row: date/time, recipient, linked job/lead/customer in my app (link to it), template, sender, status badge, credits_used. Clicking opens the timeline from GET /sms/messages/{id} (queued → sent → delivered/failed, clicks, linked callbacks) with error reasons in plain words. Label tests clearly.
  d. Usage & credits — current balance, credits used this period, texts / delivered / failed / delivery rate, breakdowns by day, template and campaign from GET /sms/usage?workspace_id&from&to_date&group_by=day|template|campaign|status|tag|sender, and the full credit history (top-ups, starter grant, sends, refunds with running balance) from GET /sms/credits/ledger?workspace_id&page. Warn when the balance is low. CSV export for the log, usage and ledger.
- On every job/lead/customer page, show the texts linked to it (filter by external_ref).
- Keep it in sync with webhooks plus a fallback sync every few minutes using updated_since.

10. Finish with a table per workspace: sender + status, templates, simulated test, live test result (delivered?), webhook id, accountability page URL, and what I still need to do.

## Webhooks
Add an HTTPS URL under Integrations → Developer API. Events:
- `call.created`: A call has started ringing a tracking number.
- `call.completed`: The call ended: answered, missed or failed. Use this for most CRMs.
- `call.updated`: Details changed after the call, e.g. attribution, transcript or lead status.
- `sms.sent`: A text was accepted by the mobile network. Payload: data.message.
- `sms.delivered`: The handset confirmed receipt — instant delivery proof, no polling.
- `sms.failed`: A text failed or expired; error_code and error_detail explain why.
- `sms.clicked`: A tracked link in a text was opened (send with track_links:true). Simulated tests never fire webhooks; live tests do.
- `sms.sender.approved`: A sender name or number was approved. Payload: data.sender. Resume go-live automatically.
- `sms.sender.rejected`: A sender was rejected; data.sender.status_reason explains why.
Headers: X-Call-Bullet-Event, X-Call-Bullet-Delivery (event UUID, use for idempotency), X-Call-Bullet-Timestamp, X-Call-Bullet-Signature: v1=HMAC-SHA256(secret, timestamp + "." + raw_body). Failed deliveries retry with backoff.

## Security
- Read-only except SMS writes, draft agents (agents:write) and click-to-call (calls:place). Start SMS with GET /sms/readiness. Keys are stored only as hashes and shown once.
- Every request and webhook rechecks the key's workspace and number scope. Data from other clients is unreachable.
- Permissions: workspaces:read (Workspace: List workspaces and account details.), usage:read (Workspace: Numbers, minutes, texts and credits this billing period.), numbers:read (Inbound: Numbers, placements, locations, views and call counts.), calls:read (Inbound: Call log: caller, time, answered/missed, duration, source.), attribution:read (Inbound: Visit, UTM, click ID and confidence per call.), recordings:read (Inbound: Signed listen links for recorded calls.), transcripts:read (Inbound: Transcripts and AI summaries.), leads:read (Inbound: Lead status, value and next action.), phone_lines:read (Outbound: Outbound lines used for calling out.), outbound_calls:read (Outbound: Outbound call history (direction=outbound).), calls:place (Outbound: Click-to-call: ring your own staff line, then connect a customer who asked to be called. Pre-checked and capped.), sms:read (SMS: Messages, delivery timelines, senders, templates, balance.), sms:send (SMS: Send texts (uses credits), including free test-mode sends.), sms:read (SMS: Sender names and numbers with approval status.), sms:senders:write (SMS: Request sender names (approval stays with Call Bullet).), sms:read (SMS: Templates and their fields.), sms:templates:write (SMS: Create, update and delete templates.), sms:read (SMS: List SMS webhooks for these workspaces.), sms:webhooks:write (SMS: Register or disable webhooks for SMS delivery, click and sender events.), agents:read (AI Agents: Agents, roles, status, live version and numbers.), agents:write (AI Agents: Create and edit draft agents and attach numbers. Going live stays in Call Bullet.), agent_calls:read (AI Agents: Calls handled by agents: summary, outcome, caller request.), campaigns:read (AI Agents: Campaigns and contact status (consent, screening).), agent_tasks:read (AI Agents: Tasks, routines and their results.), delivery:read (Integrations: Conversion and event delivery evidence.).
- Keep keys server-side. Rotate immediately if exposed.

## Errors and limits
JSON envelope `{"error":{"code","message"},"request_id"}`. Codes: 401 unauthorized, 403 forbidden, 403 workspace out of scope, 404 call not found or out of scope, 422 invalid_request, 429 rate_limited. Call lists 600/min, other endpoints 120/min; headers X-RateLimit-Limit/Remaining/Reset.

## FAQ
**Is the Call Bullet API read-only?** Mostly. Writes are limited to SMS (sms:send, sms:senders:write, sms:templates:write, sms:webhooks:write), draft AI agents (agents:write — they can never go live from the API) and human click-to-call (calls:place — pre-checked against hours, TPS, do-not-call and spend caps). agents:write and calls:place are off unless switched on individually. Keys can never change call history, numbers or billing.

**Can one key see another client's calls?** No. Each key is scoped to chosen workspaces and optionally numbers, and that scope is rechecked on every request and every webhook. Out-of-scope workspaces return 403 and out-of-scope calls 404.

**How do I get missed calls?** GET /workspaces/{id}/calls?answered=false&from=…

**How do I match a call to a CRM contact?** Normalise your contact phone numbers to E.164 (+44…) and match from_number.

**How do I avoid duplicates?** Store call id as your external ID and sync with updated_since. For imported history, de-duplicate on callrail_id or filter origin=call_bullet.

**What are the rate limits?** Call lists 600 requests/minute per key; other endpoints 120. A 429 includes Retry-After.

**Can I use it with ChatGPT, Claude or another AI agent?** Yes. Paste https://callbullet.com/developers/api into the agent; it will ask for an API key and can then answer questions about your calls.

OpenAPI: https://callbullet.com/openapi.json · Contact: info@callbullet.com
