Documentation
Download as MarkdownAgencyPhone documentation
AgencyPhone gives each of your clients a business number that rings on their team's phones and works inside your software. Your client's team calls and texts from the AgencyPhone app, which shows your agency's name, logo and color. Your software sends texts from the same number through the API and receives a signed webhook for every call, text and voicemail. People and software share one conversation history.
Overview
How AgencyPhone works
- Your agency signs up and creates a subaccount for each business you serve. That's free.
- You activate the subaccount's phone: a local number, or their existing one brought over.
- Your client's team installs the AgencyPhone app and enters your activation code. From then on the app shows your brand.
- Calls ring on every teammate's phone and in the browser. Texts, voicemail and missed calls arrive with push notifications.
- Your software uses the same number through the API and webhooks.
Who uses what
| Who | Where | What they do |
|---|---|---|
| Your agency team | Agency dashboard on the web | Create subaccounts, buy numbers, file texting registration, set up the client app, manage billing, API keys and webhooks, chat with clients |
| Your client's team | Mobile app and web app | Call, text, listen to voicemail, manage contacts, chat with your agency |
| Your software | API, webhooks and MCP server | Send texts, email and notifications, place calls for a teammate, book appointments, set up subaccounts, numbers, teams and AI agents, read calls, texts and voicemail, react to events |
Coverage
AgencyPhone works with numbers in the United States and Canada. Calls and texts to other countries are blocked. Numbers are local or toll-free (800, 833, 844, 855, 866, 877 and 888); short codes are not offered. A toll-free number texts once its own verification is through, usually within 1 to 2 weeks, and calls right away.
Quickstart
- Create your agency. Sign in at agencyphone.com with Google, GitHub or your work email, then name your agency and add your website. Creating an agency costs nothing and needs no card.
- Verify your agency. Add one DNS TXT record to your website's domain, then add your logo, welcome and onboarding steps under Client apps. Client invites unlock once your agency is verified.
- Create a subaccount for the business you serve, from the switcher in the top left. It costs nothing to make.
- Verify the business. Four screens: where it is, its legal details, email and address, what its texts are for, with sample texts written for you, and the price. Calling and texting need it. Its first month is charged then from your balance (the first time, you add a card that tops the balance up). A sole proprietor gives the owner's mobile number and we text the owner a code to read back.
- Get its first number, bought separately on Numbers: a new one, or port the one it uses now. Calls work as soon as the number is ready; a Canadian number texts Canadians right away, and a US number texts once carriers approve the business, usually in 1 to 2 weeks. Each number has its own monthly price.
- Invite their team. They install the app, enter your activation code and sign in. This is free and can happen before the business is verified.
- Connect your software. Create an API key under Developers, then send your first text:
Request
curl https://api.agencyphone.com/v1/messages \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: 3f0c2a4e-first-text" \
--data-urlencode from="+14165550142" \
--data-urlencode to="+14165550199" \
--data-urlencode text="Hi Dana, this is Lakeside Dental. Reply here any time."- Add a webhook endpoint under Developers to receive replies, calls and voicemail as they happen.
Core concepts
Agencies and your team
Your agency is the account that pays, owns the numbers and holds every subaccount. People on your agency team have one of three roles.
| Action | Owner | Admin | Member |
|---|---|---|---|
| Billing and payment method | Yes | No | No |
| API keys and webhooks | Yes | Yes | No |
| Client apps and agency team | Yes | Yes | No |
| Create or close subaccounts | Yes | Yes | No |
| Buy, assign and release numbers | Yes | Yes | No |
| Texting registration | Yes | Yes | Yes |
| Chat with clients | Yes | Yes | Yes |
| Open a client's inbox for support | Yes | Yes | No |
One person can belong to several agencies and create more than one. After signing in, "Your agencies" lists them.
Subaccounts
A subaccount is one business you serve. It holds that business's numbers, team, contacts, conversations, calls and voicemail, and its own settings: business hours, ring timeout, voicemail greeting, call recording, blocked callers and time zone. Usage is reported per subaccount, so you can rebill each client.
Closing a subaccount starts a 30-day closing period. After it, the account's numbers are released and its data is deleted.
Client users
People on a client's team are client admins or client members. Everyone on the team sees every conversation and call of the account: it is a shared inbox. Unread counts are tracked per person. Client admins can invite teammates and change the account's settings.
Numbers
Every number belongs to your agency. A number can be held by the agency or assigned to one client
account, and it can be reassigned. When a number moves to another subaccount, the old account
keeps its past conversations. Each number has a label (for example "Main line"), a type (local
or toll_free) and a texting status.
Conversations and messages
A conversation is one of your numbers talking with one outside number. Every text in it is a message, whether it was sent from the app, from the API or received. Texts sent through the API show a small "Sent by API" label in the app, so your client's team knows what was automated.
Calls and voicemail
Inbound calls ring every available teammate at once on the phone and in the browser. The first person to answer gets the call. Unanswered calls go to voicemail, and so do calls outside business hours when you choose that under Phone, Calling. Every call has a record with its direction, who answered, timing and duration. Recordings are kept when the subaccount has call recording on.
Contacts and opt-outs
Contacts are people your client's team saves: a name, number, email, company and notes. When someone replies STOP, their contact is marked as opted out and texts to them are blocked until they reply START.
Balance and usage
Your agency has one prepaid balance. Calls and texts are charged to it as they happen, and each activated phone and number once a month, at the published rates. See Billing.
Client apps and the activation code
Your agency's name and logo appear inside your clients' app, in the web app and in emails to client users. The app's name, icon and colors are the same for every agency, in the App Store, Google Play and on the phone. Under Client apps you set your logo, the name your clients see and how to reach you for help (Brand), then what your clients' team sees first (Onboarding): a welcome message and a checklist of onboarding steps (notifications and the microphone, importing contacts, the Home Screen widget, your portal and links of your own), which you can turn off, reorder and add to.
Your activation code is an 8-character code your clients enter after installing the app. It shows your brand before they sign in and never grants access on its own.
Client apps
Mobile app
One app for iOS and Android, named AgencyPhone in the stores. Three tabs: Home (one log of texts, missed calls, voicemails and messages from your agency), Call (keypad, recents, favorites and contacts) and Chat (your agency pinned at the top, then your texts), with Settings behind the profile picture. Calls ring on a locked phone like any other call. Texts, missed calls, voicemail and chat messages arrive as push notifications.
Web app
The same features in a browser at agencyphone.com/app, for teammates at a desk. Incoming calls ring in the most recently used tab.
Incoming calls
- Status. Each person is Online, Away or Do not disturb, or on a status the agency made for the subaccount that rings them only for contacts with its tags (or nobody). Do not disturb never rings.
- Ring timeout. 10 to 60 seconds per subaccount before the call goes to voicemail.
- Business hours. Weekly hours, split shifts and dated closures in the account's time zone. Outside them, calls go straight to voicemail.
- Voicemail. An uploaded greeting, a typed greeting read aloud, or a default greeting with the business name. Messages up to 3 minutes.
- Transfer. A teammate can pass a call to another teammate. The caller waits while it rings.
- Blocked callers are rejected before anyone's phone rings and cannot text the account.
Emergency calling
The app doesn't call 9-1-1, and numbers carry no 9-1-1 service, so there's no emergency address to keep. Anyone who dials 9-1-1 or another short code in the app is told to dial it from their phone's own keypad, which connects directly with the phone's location and never depends on your balance, a suspension or business hours. Before their first call, every user sees and accepts this notice:
This app doesn't call 9-1-1. For an emergency, dial 9-1-1 from your phone's own keypad. It connects directly and shares your phone's location. Business calls in this app need internet and power.
Guides
Quick start
From nothing to a first text in four steps.
- Make a key. In the dashboard, open Developers, API keys and choose Create API key. Pick what it reaches and what it may do, confirm with the code we email you, and copy the key. It is shown once.
- Make a first request. List the subaccounts the key reaches, and print the response headers
with
-i:
Request
curl -i https://api.agencyphone.com/v1/accounts \
-H "Authorization: Bearer ap_live_YOUR_KEY"- Read the request ID. The
Request-Idheader,req_..., names this request. Find it under Developers, Logs, with the status and how long it took. An error carries the same ID in its body. - Send a text from one of the subaccount's numbers, with an idempotency key so a retry never sends twice:
Request
curl https://api.agencyphone.com/v1/messages \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: first-text-0001" \
-H "Content-Type: application/json" \
-d '{"from":"+14165550142","to":"+14165550199","text":"Hi Dana, this is Lakeside Dental. Reply here any time."}'Next: add a webhook endpoint under Developers, Webhooks to hear replies, and read Errors for what a refusal looks like.
Missed-call text-back
Text a caller back within seconds when nobody answers.
- Subscribe a webhook endpoint to
call.missed. - When it arrives, send a text from the number that was called (
data.to) to the caller (data.from). Use the event ID as the idempotency key so a retried webhook never texts twice.
Node.js
app.post("/agencyphone", express.raw({ type: "application/json" }), async (req, res) => {
if (!verifyWebhook(req.body, req.get("AgencyPhone-Signature"), process.env.AGENCYPHONE_SECRET)) {
return res.sendStatus(400);
}
const event = JSON.parse(req.body);
res.sendStatus(200);
if (event.type !== "call.missed") return;
await fetch("https://api.agencyphone.com/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AGENCYPHONE_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": event.id,
},
body: JSON.stringify({
from: event.data.to,
to: event.data.from,
text: "Sorry we missed your call. How can we help?",
}),
});
});The reply lands on your client's team's phones and at your webhook as message.received.
Speed to lead
When a form, ad or CRM creates a lead, text it from the client's number right away. Replies reach
the team's phones, so a person can take over. Listen for message.sent with data.source set to
app to know a person has replied, and pause your automation for that conversation.
Webhook received
An automation that starts with "Webhook received" has its own private address: send it leads from a website form, Zapier, Make, n8n, a HighLevel workflow's webhook or your own software, and each request starts that automation. The address is in the automation's When, with Copy, a sample request, Send test and its last 20 requests. Anyone with it can start the automation, so treat it like a password; Roll address gives it a new one and the old one stops at once.
Send a POST as a JSON object (nested objects and lists are fine) or as a form post, up to 32 KB.
Only a phone number in the US or Canada is required.
Request
curl -X POST https://www.agencyphone.com/api/hooks/hook_... \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Doe",
"phone": "(416) 555-0199",
"email": "jane@example.com",
"message": "Is Saturday possible?",
"sms_consent": true,
"consent_text": "I agree to get texts from Lakeside Dental. Reply STOP to opt out.",
"order": { "id": "A-1001", "total": 240 }
}'- The contact's fields are found by name (
phone,phone_number,mobile;name, orfirst_nameandlast_name;email;message), nested ones too, likecontact.phone. When your fields are named otherwise, map them in the When: it lists the fields of the requests it got, so send one first. sms_consent(alsoconsentoropt_in) set totrue,yesoronrecords that they agreed to texts, with the exactconsent_textthey saw. Automations that text check it.- Every field is in the automation's steps as
{{payload.order.total}}, and the ones that aren't the contact's as{{lead.order.total}}.
Each request with a phone becomes or updates a contact and a lead, even while the automation is
off, and starts it while it's on. Until the automation is saved with "Webhook received", a request
is only kept, so its fields can be mapped. It answers 201 with the lead's ID, 202 when it was
only kept, 422 when the phone number is missing or not North American, 404 for an address
that doesn't exist, was rolled or was turned off, and 429 when requests arrive faster than 60 a
minute.
Lead links became webhooks: each link's address (/api/leads/lead_...) still works and now
belongs to an automation that starts with "Webhook received". "A new lead comes in" starts on every
lead, from any webhook or a Facebook lead form.
Start an automation from your software
An automation that starts with "Manual" runs only when someone adds a contact to it: on the
contact's card, in the Inbox, in the phone app, or with the API's
POST /automations/{id}/enrollments, which starts any automation, whatever its When. Every
automation's ID is on its row in Automations and beside its name in the editor.
AI texting with a person in the loop
Your AI agent can hold a text conversation from a client's number:
- Create an API key restricted to that subaccount with
messages:readandmessages:write. - On
message.received, read the conversation withGET /messages?conversation_id=..., generate a reply and send it withPOST /messages. - Every reply your agent sends is labeled "Sent by API" in the app.
- When
message.sentarrives withdata.sourceset toapp, a person has stepped in. Stop replying in that conversation.
Book appointments from an AI receptionist
While the caller is on the line, ask GET /availability for the open times on the day they want,
offer two or three, then book the one they pick with POST /appointments and only_if_open: true,
so a time someone took meanwhile is refused with slot_unavailable instead of double-booked. The
business's team sees it at once in the app's Calendar tab, a tap from calling or texting the
customer. Confirm by text with POST /messages.
Appointment reminders
Send reminders from your booking system with POST /messages and an idempotency key built from the
appointment ID and the reminder type, for example appt-8812-24h. Read replies such as "C" from
message.received, and watch message.failed for numbers that cannot receive texts.
Calls and voicemail into your CRM
call.completedcarries the direction, the number, who answered and the duration.call.missedmarks a missed call.voicemail.createdincludes a signed audio URL. Download it within 10 minutes, or fetch a fresh URL later withGET /voicemails/{id}.call.startedmarks the start of a call, andGET /calls/{id}/transcriptreturns a recorded call's words a little after it ends.GET /calls/{id}returns a signed recording URL when the call was recorded.
Keep opt-outs in sync
Subscribe to contact.opted_out and suppress the number everywhere in your software. AgencyPhone
already blocks texts to that contact from that subaccount. The other way, when someone
unsubscribes in your software, send PATCH /contacts/{id} with do_not_disturb: true.
Placing calls from your software
Click to call: a button in your CRM rings your client's teammate, and when they pick up, calls the customer from the business's number.
- Give a key
calls:write,calls:readandteam:read, for that subaccount. - Find who can take the call:
GET /members?account=ca_...and pick someone whosecan_take_callsis true. - Place it with
POST /calls:account,toandteammate, with an idempotency key built from your own task or lead ID.
Node.js
const response = await fetch("https://api.agencyphone.com/v1/calls", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AGENCYPHONE_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": `call-task-${task.id}`,
},
body: JSON.stringify({
account: "ca_lakeside",
to: task.customerPhone,
teammate: "mem_6Hd3",
metadata: { crm_task: String(task.id) },
}),
});
const call = await response.json();
if (!response.ok) showToRep(call.error.message); // for example outside_calling_hours- Follow it with webhooks.
call.startedarrives when the call begins, andcall.completedwhen it ends after connecting, with who answered, the duration and yourmetadata. A call the customer didn't pick up ends withoutcall.completed: readGET /calls/{id}for a status ofno_answer,busy,canceledorfailed. - If the business records calls, read
GET /calls/{id}/transcripta little after the call ends. It answers 404transcript_not_readyuntil then. - To cancel while it rings,
POST /calls/{id}/hangup.
A refusal is a rule, not a fault: show its message to the person who clicked. The codes and the
rule behind each are under Calls. An AI agent can't place a call and a recorded message
can't be played into one.
Email from a client's inbox
Send from the business's own address, and keep the whole conversation where the team reads it.
- Give a key
emails:readandemails:write. - Read the inbox with
GET /accounts/{id}/inbox: itsaddress, whethersending_pausedis true, andsent_todayagainstdaily_limit. - Start a thread with
POST /emails:account,to,subjectandtext. Keep thethread_idit answers with. - Listen for
email.deliveredandemail.bounced. An address that bounced is never emailed again, so mark it in your software too. - When the customer answers,
email.receivedarrives with the email and itsthread_id. Reply in the same conversation withPOST /emailsandthread.
The team sees every email your software sends and receives in the apps, and can answer it there.
Setting up a client end to end
Everything the dashboard does to take a new client live, from your software. The key needs
accounts:write, profiles:write, numbers:buy and team:invite with their read scopes, and
has to reach the whole agency to create the subaccount and to verify the business.
- Create the subaccount with
POST /accounts:nameandtimezone. Keep its ID,ca_.... - Ask what is next with
GET /accounts/{id}/setup. Itsnextnames the next step and the request that does it. Come back to it after every step. - Fill in the business profile with
PATCH /accounts/{id}/profile: legal name, entity type, tax ID, address, contact and what its texts are for. The answer'sneedslists what is still missing. Never guess these; ask your client. - Verify the business with
POST /accounts/{id}/profile/verifyandaccept_monthly_charge: true. The price in the profile'sverificationis taken from your balance now and every month. 402balance_too_lowsays how much to add under Billing. - Search for a number with
GET /numbers/available:accountand anarea_code. Each result has its monthly price. - Buy it with
POST /numbers. It becomes active within minutes;number.purchasedtells you when. - Invite the team with
POST /invitations, one person at a time. Withviaset tolinkyou get the join code to pass on yourself. - Check setup until live.
GET /accounts/{id}/setupturnsliveto true once the number is active, someone has joined and texting is on. A US number texts once carriers approve the registration, usually in 1 to 2 weeks; calls work meanwhile.
Optional along the way: business hours with PUT /accounts/{id}/hours, who rings with
PUT /accounts/{id}/ring-groups and PUT /numbers/{id}/call-steps, and Home cards with
POST /home-cards.
AI agents over the API
Create a business's AI agent, teach it and put it on a number.
- Give a key
agents:read,agents:writeandnumbers:routing. - Read an agent you already built in the dashboard with
GET /agents/{id}and keep itsconfigas your template. - Create one with
POST /agents:accountand theconfig, with the name, what it knows and who it asks changed for this business. Names in the document are looked up in that subaccount only. - Teach it with
POST /knowledge, one fact a line, and give it longer material withPOST /knowledge-basesandPOST /knowledge-bases/{id}/sources. - Check
ready_for_callsonGET /agents/{id}.not_readysays what is missing, such as the business's hours or someone to pass calls to. - Put it on a number with
POST /agents/{id}/numbers. From then on it answers that number's calls after the steps before it. - Watch what it does with
GET /agents/{id}/eventsand theagent.actionandcall.summarizedevents, and what it costs withGET /agents/{id}/usage, which takes a key that reaches the whole agency.
Pause it at any time with POST /agents/{id}/pause. Which connections and data tables an agent
may use is set in the dashboard only.
API reference
Base URL
Base URL
https://api.agencyphone.com/v1Requests and responses are JSON. Send request bodies as JSON or form-encoded; GET and DELETE
take their parameters in the query string. Timestamps are ISO 8601 in UTC to the second, in fields
ending _at. Dates without a time are YYYY-MM-DD in the subaccount's time zone. Phone numbers
are E.164, for example +14165550199. Money is whole millionths of a dollar in fields ending
_micros: 6000 is $0.006.
The OpenAPI 3.1 description of every endpoint and webhook is at
https://api.agencyphone.com/v1/openapi.json, for generating a client or importing into a tool.
Every endpoint is also listed under All endpoints, which is written from the
same table the API runs on.
Authentication
Create API keys in the dashboard under Developers, API keys. Creating a key asks for a fresh sign-in code. The key is shown once; store it as a secret. Send it as a bearer token:
Request
curl https://api.agencyphone.com/v1/accounts \
-H "Authorization: Bearer ap_live_YOUR_KEY"A key belongs to your agency and has two limits: what it reaches and what it may do.
| A key reaches | What that means |
|---|---|
| The whole agency | Every subaccount, ones you add later too, and the agency's own actions |
| Every subaccount | Every subaccount, ones you add later too, with none of the agency's own actions |
| Specific subaccounts | Only the subaccounts you pick. Keys made with groups keep reaching subaccounts you add to the group later |
The agency's own actions are making, renaming, pausing and closing subaccounts, labeling numbers,
the numbers you hold without a subaccount, usage, the balance and the ledger, verifying a
business, which starts a charge to the agency, and an AI agent's usage, which is the agency's
ledger. Only a key that
reaches the whole agency can hold accounts:write, accounts:close, numbers:write and
usage:read. An agency-level endpoint is one that belongs to the agency itself and not to one
subaccount: All endpoints marks those "agency key". Calling one with a key that
doesn't reach the whole agency answers 403 agency_reach_required.
A key's permissions are the same in every subaccount it reaches. Limit a key to the subaccounts it needs: software that serves one client, such as an AI agent, should get a key for that subaccount only. Anything outside a key's reach answers 404, as if it didn't exist.
To replace a key, roll it: you get a new key with the same name, reach, permissions, API version and safety settings, and the old one keeps working for the time you choose (up to 7 days) so you can switch without downtime. Keys can also expire on a date you set. Revoke a key at any time; requests with a revoked key fail right away. Your agency's owners and admins get an email whenever a key is created or rolled.
A key can also lock: when it reaches the daily spend limit you gave it, or when it is used in a
way that looks wrong. A locked key answers 403 api_key_locked until an owner or admin unlocks
it. API key security has all of it.
Permissions
A key is made by picking Full access, Read only, or a level for each area: none, read or write.
Write includes read. Each level grants the scopes below, and every endpoint needs exactly one
scope. A request without it answers 403 missing_scope, naming the scope.
| Area | Read | Write |
|---|---|---|
| Subaccounts | accounts:read | accounts:write, and accounts:close when checked |
| Numbers | numbers:read | numbers:write, numbers:buy, numbers:routing |
| Usage and balance | usage:read | |
| Contacts | contacts:read | contacts:write |
| Texts | messages:read | messages:write |
| Calls and voicemail | calls:read | calls:write |
emails:read | emails:write | |
| Appointments | appointments:read | appointments:write |
| Pipelines | opportunities:read | opportunities:write |
| Automations | automations:read | automations:write |
| Action items | action_items:read | action_items:write |
| Widgets | widgets:read | widgets:write |
| Data tables | data:read | data:write |
| Notifications | notifications:read | notifications:write |
| Team | team:read | team:write, team:invite |
| Setup | settings:write | |
| AI agents | agents:read | agents:write |
| Business profiles | profiles:read | profiles:write |
| App and storage | app:read | app:write |
| Events | events:read |
| Scope | Allows |
|---|---|
accounts:read | List and get subaccounts, their setup and their business hours |
accounts:write | Create and rename subaccounts, and pause and resume them |
accounts:close | Close and reopen subaccounts. Closing stops calls and texts and starts a 30-day wait |
numbers:read | List numbers, their call steps and ring groups |
numbers:write | Change a number's label |
numbers:buy | Search for numbers, buy one for a subaccount and release one |
numbers:routing | Set a number's call steps and ring groups and put an AI agent on a number |
usage:read | Calls, minutes, texts and spend by subaccount, the agency's balance and its ledger |
contacts:read | List contacts, their notes and tags |
contacts:write | Create and update contacts, their tags and notes, and opt a contact out |
messages:read | List conversations and texts |
messages:write | Send texts |
calls:read | List calls, voicemail, transcripts and call backs, with signed audio URLs |
calls:write | Ring someone on a business's team and connect them to a customer, and hang up a call the API placed |
emails:read | List a business's email threads and emails, and read its inbox |
emails:write | Send email from a business's inbox and move threads |
notifications:read | List notifications |
notifications:write | Send notifications to a business's team |
appointments:read | List appointments, meeting types and open times |
appointments:write | Book, change and cancel appointments |
action_items:read | List and get action items and their templates |
action_items:write | Put action items on a business's Home, change them and finish them |
widgets:read | Read what a business's widgets show from your software |
widgets:write | Set what widgets show: text, numbers, pictures and links |
data:read | Read a business's data tables and their rows |
data:write | Add rows to data tables and change them |
opportunities:read | Read a business's pipelines, their stages and the opportunities in them |
opportunities:write | Add opportunities, move them between stages and close them |
automations:read | List a business's automations, what starts them and whether they're on |
automations:write | Start an automation for a contact and take someone out of one |
team:read | List a business's team with who is online, its invitations and each person's hours |
team:write | Take people off a business's team and change each person's hours |
team:invite | Invite someone to a business's team as a member, and cancel an invitation |
agents:read | Read a business's AI agents, what they know, what they did and what they cost |
agents:write | Create, change, pause and resume AI agents, and change what they know |
profiles:read | Read business profiles, their verification and what each still needs |
profiles:write | Change business profiles and send them for verification |
app:read | Read a business's Home cards and its storage bins |
app:write | Change a business's Home cards and pinned action items, and create and close storage bins |
settings:write | Change business hours, meeting types, pipelines and their stages, and turn automations on and off |
events:read | List the last 30 days of events. An event shows only to a key that can also read its object |
Four scopes are kept apart from the rest of their area on purpose:
team:invite: whoever joins a business's team reads its texts and calls, so inviting is its own scope. It always invites a member, never an admin, and every invitation made through the API is in your audit log with the key's name.numbers:buy: buying is charged to your agency every month and a released number can't be brought back.numbers:routing: call steps, ring groups and putting an AI agent on a number decide who answers a business's calls, outside numbers included.settings:write: hours, meeting types, pipelines and turning automations on and off. A key made to start automations or move opportunities can't change a subaccount's setup with it.
Billing is never available to a key: cards, adding funds and invoices stay in the dashboard. So do API keys and webhook endpoints themselves, your agency's staff and its own settings.
IDs and the account field
Every object has id, with a prefix that names what it is, and object with its kind. A
reference to another object is that object's ID in a field named for it, such as contact_id or
number_id. Treat IDs as opaque strings and never build one.
| Prefix | Object | Prefix | Object |
|---|---|---|---|
ca_ | A subaccount | agn_ | An AI agent |
num_ | A number | aev_ | A line of an agent's feed |
ct_ | A contact | agt_ | An agent's call settings |
note_ | A note on a contact | act_ | What an agent did on a call |
cv_ | A conversation by text | kn_ | A line of general knowledge |
msg_ | A text | kb_ | A knowledge base |
call_ | A call | ks_ | A knowledge source |
vm_ | A voicemail | mem_ | A team member |
tr_ | A call's transcript | inv_ | An invitation |
cb_ | A call back | rg_ | A ring group |
em_ | An email | bp_ | A business profile |
eth_ | An email thread | hc_ | A Home card |
apt_ | An appointment | bin_ | A storage bin |
mt_ | A meeting type | le_ | A ledger entry |
opp_ | An opportunity | tbl_ | A data table |
pl_ | A pipeline | row_ | A row of a data table |
pst_ | A pipeline stage | ntf_ | A notification |
aut_ | An automation | chm_ | A chat message |
enr_ | An automation enrollment | evt_ | An event |
ai_ | An action item | ag_ | Your agency |
ait_ | An action item template | req_ | A request |
A subaccount's ID starts with ca_. Copy it in the dashboard from the subaccount's Settings, or
from its row's menu in the subaccounts list, Copy ID.
Every object that belongs to a subaccount carries account, the subaccount's ID, in API responses
and in webhook payloads. Every list takes account to show one subaccount's objects. Objects and
lists from before account existed also keep client_account_id, with the same value, and it
still works as a parameter. The samples below that show client_account_id carry account
beside it. An object of the agency's own, such as a bin it keeps for itself, has account set to
null.
Errors
Errors use the HTTP status and a body that says what happened and what to do:
Response
{
"error": {
"type": "invalid_request",
"code": "parameter_missing",
"message": "Add to.",
"param": "to",
"request_id": "req_8Zk2mQ4nT7vB1xW9cR5yLp3d",
"doc_url": "https://docs.agencyphone.com/#errors"
}
}Branch on code, show message to a person, and keep request_id for when you ask us about a
request. param names the parameter at fault, or is null.
| Status | Type | When |
|---|---|---|
| 400 | invalid_request | A parameter is missing or invalid; param names it |
| 401 | authentication_error | The key is missing, wrong, revoked or expired |
| 402 | invalid_request | The agency's balance can't cover it |
| 403 | permission_error | The key lacks the scope, or the action needs a key that reaches the agency |
| 404 | not_found | The object or endpoint does not exist, or the key cannot see it |
| 405 | invalid_request | The path exists but not with this method; the Allow header lists the methods |
| 409 | invalid_request | The request is valid but the state of things refuses it, such as already done |
| 409 | idempotency_error | A problem with the idempotency key |
| 413 | invalid_request | The request body is over 1 MB |
| 422 | invalid_request | The request is valid but cannot be done, such as a text to an opted-out contact |
| 429 | rate_limited | Too many requests, or a daily limit was reached |
| 500 | api_error | Something failed on our side; retry with the same idempotency key |
| 502 | api_error | The carrier or mail network refused it; retry with the same idempotency key |
A 404 for an object never says whether it exists for another agency.
The codes you will meet most:
| Code | Status | What to do |
|---|---|---|
parameter_missing | 400 | Add the parameter param names |
invalid_parameter | 400 | Fix the parameter param names; the message says how |
invalid_body | 400 | Send the body as a JSON object or form-encoded fields |
invalid_version | 400 | Use an API version from Versioning |
metadata_limit | 400 | An object holds 20 metadata keys at most; remove one first |
confirmation_required | 400 | The action needs its confirming parameter, such as confirm to release a number |
missing_api_key | 401 | Send the key as Authorization: Bearer ... |
invalid_api_key | 401 | Check that you copied the whole key |
revoked_api_key | 401 | Create a new key under Developers |
expired_api_key | 401 | Use the key that replaced it, or create a new one |
balance_too_low | 402 | Add funds under Billing, then retry. The message says how much. A text answers 422 with this code |
missing_scope | 403 | Give the key the permission the message names, or use another key |
agency_reach_required | 403 | Use a key that reaches the whole agency |
api_key_locked | 403 | An owner or admin unlocks it under Developers; see API key security |
resource_missing | 404 | Check the ID and the key's subaccounts |
unknown_endpoint | 404 | Check the path against All endpoints |
method_not_allowed | 405 | Use a method from the response's Allow header |
body_too_large | 413 | Send a request body of 1 MB or less |
idempotency_key_reused | 409 | Use a new idempotency key for a new request |
idempotency_in_progress | 409 | The first request is still running; retry in a moment |
idempotency_replayed | 409 | It already succeeded and its response held a secret; read the object instead |
contact_opted_out | 422 | The contact has Do not disturb on; don't text or call them |
account_suspended | 422 | The subaccount or your agency isn't active |
number_not_textable | 422 | The number's texting registration isn't approved yet |
not_enabled | 422 | Calling and texting aren't open for your agency yet |
rate_limited | 429 | Wait for Retry-After seconds, then retry |
spend_limit_busy | 429 | The key is near its daily spend limit, so its sends run one at a time; retry after Retry-After |
daily_limit | 429 | A daily cap was reached; the message says which and when to try again |
internal_error | 500 | Retry with the same idempotency key; tell us the request_id if it keeps failing |
provider_error | 502 | The carrier or mail network refused it; retry with the same idempotency key |
Each resource below lists the codes of its own.
Request IDs
Every response carries a Request-Id header, req_ and 24 characters, and an error repeats it
in request_id. Log it with your own records. The dashboard's request log is searched by it, and
it is the first thing to send us with a question about a request.
Response headers
Request-Id: req_8Zk2mQ4nT7vB1xW9cR5yLp3d
AgencyPhone-Version: 2026-11-25
RateLimit-Limit: 20
RateLimit-Remaining: 19
RateLimit-Reset: 1Pagination
List endpoints return the newest items first unless the endpoint says otherwise, with cursor pagination:
limit: 1 to 100, default 25.starting_after: the ID of the last item you received.
Response
{
"data": [{ "id": "ct_9d1a", "object": "contact", "name": "Dana Whitfield" }],
"has_more": true
}While has_more is true, ask again with starting_after set to the last item's id.
Expanding
A response names other objects by ID. Ask for the objects themselves with expand, and save the
second request:
Request
curl -G https://api.agencyphone.com/v1/calls/call_5m3r \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-d "expand[]=contact" \
-d "expand[]=account"expand[]=contact, expand=contact,number and, in a JSON body, "expand": ["contact"] all work.
On an object with contact_id, contact appears beside it with the whole contact. account
turns from the ID into the subaccount.
| Name | Fills in | Scope needed |
|---|---|---|
account | The subaccount, in account | accounts:read |
contact | The contact for contact_id | contacts:read |
conversation | The conversation for conversation_id | messages:read |
message | The text for message_id | messages:read |
number | The number for number_id | numbers:read |
call | The call for call_id | calls:read |
appointment | The appointment for appointment_id | appointments:read |
opportunity | The opportunity for opportunity_id | opportunities:read |
automation | The automation for automation_id | automations:read |
agent | The AI agent for agent_id | agents:read |
thread | The email thread for thread_id | emails:read |
member | The team member for member_id | team:read |
- Up to 5 names in one request. A name that isn't in the table answers 400.
- The key needs the scope of each name, or the request answers 403
missing_scopebefore anything runs: a text is never sent and then refused for itsexpand. - One level deep: an expanded object's own references stay IDs.
- On a list, every item is expanded, and
limitis 25 at most withexpand(400,paramlimit). - A reference the object doesn't have is left alone, and one the key can't see comes back null.
Idempotency
Every POST takes an Idempotency-Key header of up to 200 characters, and so does any other
endpoint that All endpoints says takes one. Repeating a request with the same
key and the same parameters within 24 hours returns the first response instead of acting again.
Use a key that names the reason for the request, such as an event ID or appt-8812-24h.
- Only successes are kept. A request that failed keeps nothing, so retrying it with the same key runs it.
- The same key with different parameters answers 409
idempotency_key_reused. - The same key while the first request is still running answers 409
idempotency_in_progress. A request that never answered frees its key after 2 minutes. - A response that holds a secret that can't be read again (an invitation's join code, a bin's
code) is never kept. Repeating that key answers 409
idempotency_replayed: the request already succeeded, so read the object instead. - After 24 hours the key can be used again.
Metadata
Contacts, texts, calls and emails take metadata: your own keys and values, for an order number
or your CRM's ID. Up to 20 keys, a key of up to 40 characters, a value a string of up to 500.
Send it when you create the object, or PATCH it later: a PATCH merges, and a key set to null
or an empty string is removed. Metadata comes back on the object and in its webhook events. It is
never shown in the apps and never read by AI agents.
Request
curl -X PATCH https://api.agencyphone.com/v1/contacts/ct_9d1a \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"metadata":{"crm_id":"8812","campaign":null}}'Rate limits
Each key can make 20 requests per second. Every response carries RateLimit-Limit,
RateLimit-Remaining and RateLimit-Reset headers, and a 429 adds Retry-After in seconds. A
request that is refused for another reason still counts. Requests with a key that isn't valid are
limited by address.
What reaches a person or spends money has the product's own limits on top:
| What | Limit |
|---|---|
| Texts and notifications | 1 per second per subaccount, bursts of up to 10 |
| Calls placed | 60 an hour per subaccount and 3 a day to one number |
| 100 in 24 hours per subaccount, 1,000 in 24 hours per agency through the API, 25 in 24 hours for a subaccount made in the last 7 days | |
| Numbers bought | 10 in one request and 20 a day per agency through the API |
| Invitations | 20 a day per subaccount and 100 a day per agency through the API |
| Bins | 50 a day per owner |
Versioning
A version is the date of a change that could break software written against the one before. The
current version is 2026-11-25, the first. A key is pinned to the version that was current when
it was made, so a later version never changes what your software gets. To try another version on
one request, send the AgencyPhone-Version header. Every response says which version ran in the
same header. A version we don't have answers 400 invalid_version.
Additions never make a version: new endpoints, new optional parameters, new fields on an object, new event types and new error codes can arrive at any time, so ignore fields and event types you don't know. A breaking change is removing or renaming a field, parameter or endpoint, changing a field's type or meaning, or making an optional parameter required. Every change is listed by date in the Changelog.
Request logs
Every request made with a valid key is kept for 30 days: the key, the method and path, the status, how long it took, its request ID, the API version, whether it came through the API or the MCP server (with the tool), the subaccount it was about and the address it came from. For a request that was refused, the log also keeps the error's type, code, message and parameter, and the request's parameters cut to 2,000 characters, with tax IDs and anything named like a secret removed. A request without a valid key belongs to no agency and is not kept.
Owners and admins read it in the dashboard under Developers, Logs: search by request ID or path, filter by status, key, method and source, and open a row for the request and its error.
Subaccounts
GET /accounts (scope accounts:read) lists the subaccounts the key can reach, and
GET /accounts/{id} gets one.
Response
{
"data": [
{
"id": "ca_lakeside",
"object": "client_account",
"name": "Lakeside Dental",
"status": "active",
"timezone": "America/Toronto",
"paused_at": null,
"paused_reason": null,
"closing_at": null,
"texting_paused": false,
"created_at": "2026-09-01T15:02:11Z"
}
],
"has_more": false
}status is active, suspended (paused), closing or closed. texting_paused is true when
AgencyPhone paused the subaccount's texting after warning signs such as a spike in STOP replies;
calls still work, and the texting.paused webhook tells you.
Manage subaccounts with these (scope accounts:write, except closing):
| Request | What it does |
|---|---|
POST /accounts | Creates one. Send name and, optionally, timezone (an IANA name, America/Toronto by default). Needs a key that reaches the whole agency. Past your plan's included subaccounts it returns subaccount_limit |
PATCH /accounts/{id} | Renames it or changes its timezone |
POST /accounts/{id}/pause | Pauses it: calls and texts stop until you resume it. Send an optional reason (up to 200 characters). Nothing is deleted and its numbers stay |
POST /accounts/{id}/resume | Turns a paused subaccount back on |
POST /accounts/{id}/close | Closes it and starts the 30 days (scope accounts:close). Calls and texts stop at once |
POST /accounts/{id}/reopen | Brings a closing subaccount back before its 30 days end (scope accounts:close) |
Pausing, resuming, closing and reopening are safe to repeat: asking for a state it is already in
returns the subaccount as it is. Every change is recorded in your audit log with the key's name,
and the subaccount.* webhooks announce it, whether it came from the API or your dashboard. A
paused subaccount's texts fail with account_inactive.
Setup, hours and the business profile
GET /accounts/{id}/setup (scope accounts:read) is the dashboard's "Get live" list for your
software: whether the business is verified, its number, its team and its app, each step done or
not, and next, the one next thing to do with the request that does it. live turns true once it
has a number, its team has joined and texting is on.
Request
curl https://api.agencyphone.com/v1/accounts/ca_lakeside/setup \
-H "Authorization: Bearer ap_live_YOUR_KEY"Response
{
"object": "setup",
"account": "ca_lakeside",
"live": false,
"verified": true,
"number": null,
"texting": "in_review",
"steps": [
{
"id": "number",
"done": false,
"next": "Buy a number: search with GET /numbers/available, then POST /numbers."
},
{ "id": "team", "done": false, "next": "Invite their team with POST /invitations." },
{
"id": "app",
"done": false,
"next": "Open the app's preview on the subaccount's Overview in the dashboard to check what the team sees."
}
],
"next": {
"step": "number",
"message": "Buy a number: search with GET /numbers/available, then POST /numbers.",
"method": "POST",
"path": "/numbers"
}
}GET /accounts/{id}/hours (scope accounts:read) returns the hours the business answers calls,
in the subaccount's time zone, and what calls outside them do. PUT /accounts/{id}/hours (scope
settings:write) replaces the week: one range a day on the half hour, at least one open day, and
a day left out or null is closed. after_hours is ring or voicemail.
Request
curl -X PUT https://api.agencyphone.com/v1/accounts/ca_lakeside/hours \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"days":{"mon":{"open":"09:00","close":"17:00"},"tue":{"open":"09:00","close":"17:00"}},"after_hours":"voicemail"}'GET /accounts/{id}/profile (scope profiles:read) returns the business's details, whether it
is verified, where its texting registration stands with the carriers, and needs: each thing
still missing before it can be verified, as a field and a message. The tax ID is never
returned, only tax_id_last4. PATCH /accounts/{id}/profile (scope profiles:write) saves the
fields you send and keeps the rest; null clears a field. Nothing is sent to the carriers and
nothing is charged.
Response
{
"id": "bp_3Qd8",
"object": "business_profile",
"account": "ca_lakeside",
"legal_name": "Lakeside Dental Inc.",
"entity_type": "private_profit",
"tax_id_last4": null,
"website": "https://lakesidedental.example",
"country": "CA",
"verified": false,
"verified_at": null,
"verification": { "free": false, "price_micros": 4000000 },
"registration": {
"status": "draft",
"texting": "not_started",
"rejection_reason": null,
"needs_code": false,
"submitted_at": null
},
"locked": false,
"needs": [{ "field": "tax_id", "message": "Add the business's tax ID." }]
}The sample leaves out the address, contact and texting details, which come back too. The price in
verification is your plan's, read from the rate card.
POST /accounts/{id}/profile/verify (scope profiles:write, a key that reaches the whole agency)
does what Verify does in the dashboard. It checks the saved details, takes the verification price from your agency's balance,
now and every month and never from a card, and sends a US business's texting registration to the
carriers. Send accept_monthly_charge: true to agree to the charge, unless verifying is free.
| Code | Status | When |
|---|---|---|
profile_incomplete | 422 | Details are missing; the message names the first, and needs lists them all |
confirmation_required | 400 | accept_monthly_charge wasn't true |
balance_too_low | 402 | The balance can't cover the price; the message says how much to add |
agency_reach_required | 403 | Verifying starts a charge to your agency, so it takes a key that reaches the whole agency |
already_verified | 409 | It is verified already; nothing is charged |
profile_locked | 409 | The details are with the carriers or approved, so they can't change |
account_closing | 409 | The subaccount isn't active; resume or reopen it first |
A sole proprietor's owner is texted a code after verifying, which someone enters in the dashboard.
Usage, balance and the ledger
GET /usage (scope usage:read) returns a month of usage and spend by subaccount, the same
numbers as the dashboard's Usage page. Send month as YYYY-MM (UTC; the current month by
default) and, optionally, account. Usage is the agency's own, so a new key can hold
usage:read only when it reaches the whole agency; an older key limited to some subaccounts sees
only those.
Amounts are in millionths of a dollar: 6000 is $0.006.
Response
{
"object": "usage",
"month": "2026-11",
"from": "2026-11-01T00:00:00Z",
"to": "2026-12-01T00:00:00Z",
"total_amount_micros": 12480000,
"subaccounts": [
{
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"name": "Lakeside Dental",
"calls": 41,
"call_minutes": 118.4,
"texts": 302,
"numbers": 2,
"amount_micros": 12480000
}
]
}GET /balance (scope usage:read) returns your agency's prepaid balance, for keys that reach
the whole agency: balance_micros, low_balance (at or under your auto-recharge threshold) and
auto_recharge. The API reads your balance and usage but never moves money: adding funds, cards
and invoices stay in the dashboard.
GET /ledger (scope usage:read, a key that reaches the whole agency) lists every charge and
every time funds were added, newest first, with the balance after each. amount_micros is
negative for a charge. Filter with account, type, created_after and created_before.
Response
{
"data": [
{
"id": "le_7Yq1",
"object": "ledger_entry",
"account": "ca_lakeside",
"type": "call",
"amount_micros": -39900,
"quantity": 3,
"unit_price_micros": 13300,
"balance_after_micros": 48210100,
"description": "Call, 3 minutes",
"agent_id": null,
"created_at": "2026-11-25T15:14:41Z"
}
],
"has_more": true
}An AI agent's own charges for a month are GET /agents/{id}/usage, which takes a key that
reaches the whole agency too.
Numbers
GET /numbers (scope numbers:read) lists numbers. Filter with account.
Response
{
"data": [
{
"id": "num_4k2p",
"object": "number",
"number": "+14165550142",
"label": "Main line",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"country": "CA",
"type": "local",
"status": "active",
"texting_status": "approved",
"emergency_address": false
}
],
"has_more": false
}PATCH /numbers/{id} (scope numbers:write) changes a number's label; send null or an empty
string to clear it.
account is null for a number the agency holds. texting_status is not_registered,
pending, approved, rejected or not_required.
GET /numbers/{id} gets one number.
Searching, buying and releasing
These three need numbers:buy. GET /numbers/available returns up to 20 numbers that can be
bought now for a subaccount, each with monthly_price_micros, what a month of it costs your
agency on its plan. Send account, and narrow with type (local or toll_free), country
(US or CA), area_code, region, locality or contains. Searching costs nothing.
POST /numbers buys 1 to 10 numbers from one search. The business has to be verified first. The
first month of each is taken from your agency's balance at the plan's rate, never from a card.
Request
curl https://api.agencyphone.com/v1/numbers \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: lakeside-first-number" \
-H "Content-Type: application/json" \
-d '{"account":"ca_lakeside","numbers":["+14165550142"],"country":"CA"}'Response
{
"data": [
{
"id": "num_4k2p",
"object": "number",
"number": "+14165550142",
"label": null,
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"country": "CA",
"type": "local",
"status": "pending",
"texting_status": "not_required",
"emergency_address": false,
"created_at": "2026-11-25T15:02:11Z"
}
],
"has_more": false
}A number still being set up has the status pending and becomes active within minutes, when
number.purchased fires.
DELETE /numbers/{id} gives a number up for good: calls and texts to it stop and it can't be
brought back. To confirm, send confirm set to the number itself in E.164, in the query string.
It answers with the number, its status released, and number.released fires.
| Code | Status | When |
|---|---|---|
business_not_verified | 409 | Verify the business before buying |
balance_too_low | 402 | The balance can't cover the first month; the message says how much |
number_unavailable | 409 | Someone else took the number first; search again |
daily_limit | 429 | The API buys at most 20 numbers a day for an agency |
confirmation_required | 400 | confirm is missing or isn't the number |
number_porting | 409 | The number is still being set up or moving from another carrier |
Call steps and ring groups
A number's call steps are what a call to it does, in order. GET /numbers/{id}/call-steps (scope
numbers:read) reads them, and PUT /numbers/{id}/call-steps (scope numbers:routing) replaces
the whole list: up to 4 ring groups, each for 1 to 30 seconds, up to 2 outside numbers, one AI
agent, then voicemail last if it is there, and at least one step.
Request
curl -X PUT https://api.agencyphone.com/v1/numbers/num_4k2p/call-steps \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"steps":[{"kind":"ring_group","ring_group_id":"rg_2Lm5","seconds":20},{"kind":"voicemail"}]}'Response
{
"object": "call_steps",
"account": "ca_lakeside",
"number_id": "num_4k2p",
"steps": [
{ "kind": "ring_group", "ring_group_id": "rg_2Lm5", "seconds": 20, "ring_on_calls": false },
{ "kind": "voicemail" }
]
}A step's kind is ring_group (with ring_group_id, seconds and ring_on_calls),
outside_number (with number, seconds and press_one), ai_agent (with agent_id) or
voicemail. An AI agent that isn't ready for calls can't go on a number: 409 agent_not_ready
names what it lacks. An outside number, in a call step or in a ring group, must be a United
States or Canadian number and never a 900 or 976 number: 422 destination_not_allowed.
GET /ring-groups?account=ca_... (scope numbers:read) lists a subaccount's ring groups in
order, General first. Every business has General, which rings the whole team while nobody is
picked for it. PUT /accounts/{id}/ring-groups (scope numbers:routing) replaces them with the
list you send: a group with an id is changed, one without is added, and one left out is deleted,
with its call steps. People are member_ids of that subaccount. Up to 10 groups besides General.
Team
A business's team is the people who answer its calls and texts in the app. A member's ID (mem_)
is one person on one business: the same person on two businesses has two member IDs.
GET /members?account=ca_... (scope team:read) lists a subaccount's team, newest first, with
who is online and who can take a call right now. GET /members/{id} gets one.
Response
{
"data": [
{
"id": "mem_6Hd3",
"object": "member",
"account": "ca_lakeside",
"name": "Maria Chen",
"email": "maria@lakesidedental.example",
"role": "admin",
"presence": "online",
"status": "At lunch",
"can_take_calls": true,
"joined_at": "2026-09-02T14:10:00Z"
}
],
"has_more": false
}presence is online, away, dnd (Do not disturb) or offline. can_take_calls is true when
a device of theirs is signed in and rings for calls.
GET /members/{id}/hours (scope team:read) returns the person's own week in the business's time
zone and their time off that hasn't ended. PUT /members/{id}/hours (scope team:write) replaces
the week, or clears it with hours set to null. Booking and call backs follow it. Time off is set
in the apps.
DELETE /members/{id} (scope team:write) takes the person off this business's team: they stop
seeing its texts and calls and leave its ring groups. Their account and any other business they
are on are untouched. A business keeps at least one admin (409 last_admin). Roles can't be
changed through the API.
Invitations and the join code
Inviting needs team:invite, a scope of its own: whoever accepts reads that business's texts and
calls, so a key that only manages a team can't add someone to it. An invitation is always for a
member, never an admin, and is written to your audit log with the key's name.
POST /invitations invites one person. With via set to email, the default, they are emailed a
code that lasts 7 days. With via set to link nothing is sent: the response holds code, the
join code, and join_url, the link that opens it, for your software to pass on.
Request
curl https://api.agencyphone.com/v1/invitations \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"account":"ca_lakeside","email":"sam@lakesidedental.example","name":"Sam Ortiz","via":"link"}'Response
{
"id": "inv_9Kc4",
"object": "invitation",
"account": "ca_lakeside",
"email": "sam@lakesidedental.example",
"name": "Sam Ortiz",
"role": "member",
"via": "link",
"created_at": "2026-11-25T15:20:00Z",
"expires_at": "2026-12-02T15:20:00Z",
"code": "EXAMPLE1",
"join_url": "https://www.agencyphone.com/join/EXAMPLE1"
}The code is stored only as a hash, so this response is the one time it can be read. It is never
kept for idempotency: repeating the key answers 409 idempotency_replayed. An earlier open
invitation to the same address is canceled.
GET /invitations?account=ca_... (scope team:read) lists invitations that can still be
accepted; a code is never part of them. DELETE /invitations/{id} cancels one.
| Code | Status | When |
|---|---|---|
already_member | 409 | The person is on the team already |
seat_limit | 422 | The team is at its limit of people |
role_not_allowed | 422 | role was anything but member |
daily_limit | 429 | More than 20 invitations a day for a subaccount, or 100 a day for your agency, through the API |
email_not_sent | 503 | The email couldn't be sent; retry |
Contacts
GET /contacts(scopecontacts:read): filter withaccount,phone,email,tagorq, part of a name, an email address or a phone number.POST /contacts(scopecontacts:write):account,phone, and optionallyname,email,company,notes,tagsandmetadata. One contact per number per subaccount.GET /contacts/{id}(scopecontacts:read): one contact.PATCH /contacts/{id}(scopecontacts:write): any ofname,email,company,notes,tags,metadataanddo_not_disturb. Sendnullto clear a field.
Request
curl -X PATCH https://api.agencyphone.com/v1/contacts/ct_9d1a \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"tags":["whitening","vip"],"metadata":{"crm_id":"8812"}}'Response
{
"id": "ct_9d1a",
"object": "contact",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"name": "Dana Whitfield",
"phone": "+14165550199",
"email": "dana@example.com",
"company": null,
"notes": "Prefers texts after 5 PM.",
"tags": ["vip", "whitening"],
"opted_out": false,
"do_not_disturb": false,
"metadata": { "crm_id": "8812" },
"created_at": "2026-09-12T18:20:44Z"
}tags replaces the contact's tags: lowercase, up to 20 of up to 40 characters each.
GET /tags?account=ca_... (scope contacts:read) lists the tags a subaccount's contacts carry,
the most used first, each with how many contacts carry it.
do_not_disturb and opted_out are the same thing under two names: true when the contact texted
STOP, the team turned on Do not disturb, or your software did. Send do_not_disturb: true to opt
a contact out, for example when they unsubscribe in your CRM: texts and API calls to them are
refused from then on. It can't be turned off through the API; only the contact, by texting START,
or the team can.
Notes
A contact's notes are the short facts on their card in the apps. The team reads them, and the business's AI agents read them before they answer, so a note from your software reaches both.
GET /contacts/{id}/notes(scopecontacts:read): newest first, each with itsauthor, aperson, anagentorapi.POST /contacts/{id}/notes(scopecontacts:write):text, one fact of 3 to 300 characters, marked as written by the key.PATCH /notes/{id}andDELETE /notes/{id}(scopecontacts:write): change or delete a note, whoever wrote it. The team can bring a deleted note back for a day.
A note can't hold a PIN, a password, a card or account number, any run of 4 or more digits, or
health details (422 note_refused), and a fact the card already holds isn't kept twice (409
note_exists). The older notes field on the contact is the card's About text, one block of up
to 2,000 characters.
Other codes: contact_exists (the subaccount has a contact with that number already),
cannot_opt_in (do_not_disturb was sent as false).
Conversations
GET /conversations (scope messages:read) lists conversations, most recent first. Filter with
account, number_id or remote (the outside number). GET /conversations/{id} gets one.
Response
{
"data": [
{
"id": "cv_2k9x",
"object": "conversation",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"number_id": "num_4k2p",
"remote": "+14165550199",
"contact_id": "ct_9d1a",
"last_message_at": "2026-09-30T14:41:07Z",
"last_message_preview": "Can someone call me?"
}
],
"has_more": false
}Messages
GET /messages?conversation_id=cv_2k9x (scope messages:read) lists the messages in a
conversation, newest first.
POST /messages (scope messages:write) sends a text:
| Parameter | Required | Description |
|---|---|---|
from | Yes | One of your numbers, on a subaccount the key can reach |
to | Yes | A US or Canadian number |
text | Yes | The text to send, up to 1,600 characters |
metadata | No | Your own keys and values, kept on the text |
Request
curl https://api.agencyphone.com/v1/messages \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: 3f0c2a4e-appointment-reminder" \
--data-urlencode from="+14165550142" \
--data-urlencode to="+14165550199" \
--data-urlencode text="Your cleaning is tomorrow at 10:30 AM. Reply C to confirm."Response
{
"id": "msg_7hq2",
"object": "message",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"conversation_id": "cv_2k9x",
"direction": "outbound",
"source": "api",
"from": "+14165550142",
"to": "+14165550199",
"text": "Your cleaning is tomorrow at 10:30 AM. Reply C to confirm.",
"status": "queued",
"segments": 1,
"created_at": "2026-09-30T13:38:02Z"
}GET /messages/{id} (scope messages:read) returns one message, for checking its status.
PATCH /messages/{id} (scope messages:write) changes its metadata and nothing else.
A message's status moves from queued to sending, sent and delivered, or to failed with an
error. Received texts have the status received. A text to an opted-out contact is stored as
blocked and not sent. segments is how many SMS segments the text used; each segment is billed.
Codes for sending:
| Code | Status | When |
|---|---|---|
unknown_number | 400 | from isn't one of your numbers on a subaccount the key reaches |
number_not_textable | 422 | The number's texting registration isn't approved yet |
contact_opted_out | 422 | The contact has Do not disturb on |
balance_too_low | 422 | Your agency's balance can't cover the text |
account_suspended | 422 | The subaccount or your agency isn't active |
agency_number | 422 | Texts between your own numbers aren't allowed; use Chat to reach your agency's team |
sending_rate_limited | 429 | More than 1 text a second for the subaccount, past its burst of 10 |
provider_error | 502 | The carrier network refused the text; retry with the same idempotency key |
Picture texts and group texts can't be sent through the API yet.
Calls
GET /calls (scope calls:read) lists calls. Filter with account, number_id or status.
GET /calls/{id} returns one call and, when it was recorded, a recording_url signed for 10
minutes.
Response
{
"id": "call_5m3r",
"object": "call",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"number_id": "num_4k2p",
"direction": "outbound",
"from": "+14165550142",
"to": "+14165550199",
"status": "completed",
"answered_by": null,
"started_at": "2026-11-25T15:10:02Z",
"answered_at": "2026-11-25T15:10:19Z",
"ended_at": "2026-11-25T15:14:41Z",
"duration_seconds": 262,
"recording_url": null,
"ai_agent": null,
"handed_off_at": null,
"summary": null,
"outcome": null,
"transcript": null,
"contact_id": "ct_9d1a",
"placed_by": { "type": "api", "name": "Lakeside CRM" },
"metadata": { "crm_task": "4471" }
}status is one of ringing, in_progress, completed, missed, voicemail, busy,
no_answer, canceled, failed, rejected or blocked. placed_by says who placed an
outbound call: api with the key's name when your software did, person when someone tapped
Call, and null for a call that came in. A teammate's own call with the business's AI agent is
never listed.
Placing a call
POST /calls (scope calls:write) is click to call. It rings a teammate's app first, their
phone or their browser. When they pick up, the customer is dialed from the subaccount's number
and the two are connected, exactly as when the teammate taps Call in the app. A person is always
on the business's side of the call.
| Parameter | Required | Description |
|---|---|---|
account | Yes | The subaccount the call is for |
to | Yes | The customer's number in E.164, a United States or Canadian area code |
teammate | Yes | Who takes the call: a member's ID (mem_) or their email. They must be on the subaccount's own team |
from | No | The subaccount's number to call from, its ID or the number. Needed when it has more than one |
metadata | No | Your own keys and values, kept on the call |
Request
curl https://api.agencyphone.com/v1/calls \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: task-4471-call" \
-H "Content-Type: application/json" \
-d '{"account":"ca_lakeside","to":"+14165550199","teammate":"maria@lakesidedental.example","metadata":{"crm_task":"4471"}}'It answers 201 with the call, its status ringing. Minutes are charged from your agency's
balance at the rate card's rate, as for any call. The call is marked as placed by your key beside
the teammate.
Because software can call at scale where a person taps once, a call from the API is checked for more than a call from the app. Each refusal has its own code:
| Code | Status | The rule |
|---|---|---|
emergency_number | 422 | 9-1-1, 9-3-3, other three-digit codes and 900 and 976 numbers are never dialed, and there is no test mode that does |
destination_not_allowed | 422 | Only United States and Canadian area codes. Other +1 countries are refused, since that is where toll fraud goes |
contact_opted_out | 422 | The contact has Do not disturb on |
number_blocked | 422 | The number is on the business's blocked list |
agency_number | 422 | The number is one of AgencyPhone's own; calls between your numbers aren't placed |
outside_calling_hours | 422 | Calls go out only from 8 AM to 9 PM where the customer is and where the business is. The message says when it opens |
teammate_not_ready | 422 | The teammate hasn't opened the app yet, or hasn't accepted its 9-1-1 notice |
number_unavailable | 422 | The subaccount has no active number that can place calls |
rate_limited | 429 | More than 60 calls an hour for the subaccount, or the teammate is calling too fast |
daily_limit | 429 | More than 3 calls a day to one number, or a new business's daily limit |
balance_too_low | 402 | The balance can't cover the call |
account_suspended | 422 | The subaccount or your agency isn't active |
not_enabled | 422 | Calling isn't open for your agency yet |
resource_missing | 404 | teammate isn't on this subaccount's team, or from isn't one of its active numbers |
parameter_missing | 400 | The subaccount has more than one number, so from is needed |
POST /calls/{id}/hangup (scope calls:write) ends a call the API placed, while it rings or
after it connected. A call a customer made or a person placed is not the API's to cut off: 409
not_api_call. A call that is over answers 409 call_ended. PATCH /calls/{id} changes a call's
metadata and nothing else.
Two things are not available, on purpose:
- An AI agent placing a call. Agents answer calls and never place them. An unattended AI voice calling people is a different product under different law, and it needs its own consent design.
- Playing a recorded message into a call. Leave recorded message exists only inside a live call a person is on, for a customer whose consent that person confirmed. Software can't stand in for that.
Transcripts, actions and call backs
GET /calls/{id}/transcript (scope calls:read) returns who said what and when, with the call's
summary. It is written a little after a recorded call ends; until then, and for a call that
wasn't recorded, it answers 404 transcript_not_ready.
Response
{
"id": "tr_2Wn6",
"object": "call_transcript",
"account": "ca_lakeside",
"call_id": "call_5m3r",
"summary": "Dana asked to move her cleaning to Friday. Maria rebooked it for 10:30 AM.",
"duration_seconds": 262,
"lines": [
{
"type": "speech",
"start_ms": 1200,
"end_ms": 4100,
"side": "business",
"speaker": { "kind": "person", "name": "Maria Chen" },
"text": "Hi Dana, it's Maria from Lakeside Dental."
}
],
"created_at": "2026-11-25T15:15:01Z",
"completed_at": "2026-11-25T15:15:40Z"
}GET /calls/{id}/actions lists what an AI agent did on the call, oldest first: bookings, texts,
hand-offs, messages taken, lookups and what it was refused. The same lines arrive as
agent.action events.
A call back is a promise an AI agent made that someone on the team calls a person back by a time.
GET /callbacks lists them, newest first, filtered by account, status (open, done,
missed or cancelled) or phone, and GET /callbacks/{id} gets one. callback.created and
callback.updated announce them. An outbound call to the number that connects closes the call
back, a call placed with POST /calls included.
Automated calls
An automated call is one the server places with nobody on your team on the line. With message, a
voice says your words and can take one key: keys maps a digit from 0 to 8 to a label, and
optionally words to say back and a text to send from the same number. With agent and goal,
one of the subaccount's agents holds the call to reach the goal, opening with opening as written.
Every call says how to stop them, and pressing 9 means that person is never called this way again.
They are for people the business already knows, for reminders, confirmations and follow-ups, never for selling. A call is placed only when every rule holds:
- Automated calls are turned on: by the agency's owner under Settings, then for the subaccount under Agents, Outbound.
- The business is verified, and one of its own admins confirmed its details in their app.
- You've texted with the person: at least 10 texts, 3 of them from the person.
- Someone on the team has spoken with them on a call that connected.
- Your first text or call with them was more than 14 days ago.
- They haven't asked you to stop, and Do not disturb is off.
Each person gets one automated call a day and each number places three a day (429 daily_limit),
between 8 AM and 9 PM where the person is. A rule that fails answers 422
automated_call_not_allowed, with the rule in the message. GET /automated-calls/check says rule
by rule whether a person can be called, without placing anything.
bash
curl https://api.agencyphone.com/v1/automated-calls \
-H "Authorization: Bearer $AGENCYPHONE_KEY" \
-H "Idempotency-Key: reminder-4821" \
-d '{
"account": "ca_7dK2mQ9xLp4RtYw3ZbN6Hf",
"to": "+14165550199",
"message": "This is Northwind Dental. Your cleaning is Friday at 2. Press 1 to confirm, or 2 to change it.",
"keys": {
"1": { "label": "confirm", "say": "Confirmed. See you Friday." },
"2": { "label": "reschedule", "say": "We will text you a link.", "text": "Pick a new time: https://northwind.example/book" }
}
}'The answer comes back at once with status calling. automated_call.completed follows with
outcome (played, key_pressed, voicemail_left, voicemail_hung_up, goal_met,
goal_not_met, talked, asked_to_stop, hung_up, no_answer or failed), key_pressed and
key_label, and for an agent's call its summary and transcript. Minutes are charged at the
outgoing call rate, plus the agent's minutes for an agent's call. An agent on these calls talks
only: it has no booking or lookup tools yet.
Voicemails
GET /voicemails (scope calls:read) lists voicemails with an audio_url signed for 10 minutes.
GET /voicemails/{id} gets one with a fresh audio_url and transcript, what the caller said,
when the voicemail was transcribed.
Response
{
"data": [
{
"id": "vm_8c2e",
"object": "voicemail",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"call_id": "call_5m4a",
"from": "+14165550173",
"duration_seconds": 41,
"audio_url": "https://...",
"listened_at": null,
"created_at": "2026-09-30T18:02:15Z"
}
],
"has_more": false
}Every business has an inbox, an address at mail.agencyphone.com or on your agency's own verified
domain. The team reads and answers it in the apps beside their texts; your software sends from it
and reads it here.
GET /accounts/{id}/inbox (scope emails:read) returns the address, whether sending is paused
and why, and how many emails the business sent in the last 24 hours against the most it can.
POST /emails (scope emails:write) sends a plain text email from the subaccount's inbox. Send
account, to and subject to start a thread, or thread to reply in one. to is one address.
Request
curl https://api.agencyphone.com/v1/emails \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: quote-A-1001" \
-H "Content-Type: application/json" \
-d '{"account":"ca_lakeside","to":"dana@example.com","subject":"Your quote","text":"Hi Dana,\n\nYour quote is attached to your file. Reply here with any questions."}'Response
{
"id": "em_4Tg7",
"object": "email",
"account": "ca_lakeside",
"thread_id": "eth_8Pb2",
"direction": "outbound",
"from": "lakeside-dental@mail.agencyphone.com",
"to": ["dana@example.com"],
"cc": [],
"subject": "Your quote",
"text": "Hi Dana,\n\nYour quote is attached to your file. Reply here with any questions.",
"status": "queued",
"source": "api",
"attachments": [],
"metadata": {},
"created_at": "2026-11-25T16:02:00Z"
}An email's status moves from queued to sent and delivered, or to bounced, complained
or failed. Received mail has the status received. Attachments can't be sent through the API
yet; an email that has them lists their names and sizes.
GET /emails(scopeemails:read): filter withaccount,threadordirection.GET /emails/{id}gets one, andPATCH /emails/{id}changes itsmetadata.GET /email-threads(scopeemails:read): conversations by email, the one with the newest email first. Filter withaccount,folder(inbox,archiveorspam) orwith, the other person's address.GET /email-threads/{id}gets one.PATCH /email-threads/{id}(scopeemails:write): moves a thread to anotherfolder, as the apps do. Spam takes every thread from that sender with it and keeps their next emails there.
A plan includes a number of sent emails a business a month; past it each is charged at the rate card's email rate. Received mail is free. While every business sends through one shared mail account, sending is capped:
| Code | Status | The rule |
|---|---|---|
address_suppressed | 422 | The address bounced or marked an email as spam, so it is never emailed again |
sending_paused | 403 | Too many of the business's emails bounced or were marked as spam. An owner or admin turns it back on under the subaccount's Settings, Email |
daily_limit | 429 | More than 100 emails in 24 hours from one subaccount, from anywhere |
agency_daily_limit | 429 | More than 1,000 emails through the API in 24 hours across your agency |
new_subaccount_limit | 429 | More than 25 through the API in 24 hours from a subaccount made in the last 7 days |
balance_too_low | 402 | The balance can't cover an email past the included ones |
no_inbox | 409 | The subaccount has no inbox to send from yet |
parameter_conflict | 400 | thread was sent together with to; a reply goes to the thread's own address |
Events: email.sent, email.delivered and email.bounced for what the business sends, from the
apps or the API, and email.received for mail that arrives and isn't spam. email.bounced also
fires for a spam complaint; either way that address won't be emailed again.
Notifications
A notification tells a business's team something in their app: a new lead, a booking, a review to
answer. It is the same notification your team sends from the Inbox's Notifications tab: its own
row on the team's Home in the app, pushed to their phones, and never a message in the chat.
Notifications don't need a phone number and aren't charged. When the team writes to you, that's
in Chat and, for your software, the chat.message.received webhook.
POST /notifications (scope notifications:write) sends one:
| Parameter | Required | Description |
|---|---|---|
client_account_id | Yes | The subaccount whose team gets it |
text | Yes | Up to 4,000 characters. The push to their phones shows the start of it |
Request
curl https://api.agencyphone.com/v1/notifications \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: lead-5521" \
--data-urlencode client_account_id="ca_lakeside" \
--data-urlencode text="New lead from the website: Dana Whitfield, (416) 555-0199, asking about whitening."Response
{
"id": "ntf_3s8d",
"object": "notification",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"text": "New lead from the website: Dana Whitfield, (416) 555-0199, asking about whitening.",
"sender": { "type": "api", "name": "Lakeside CRM" },
"created_at": "2026-09-30T16:05:12Z"
}The team sees it from your agency, under your agency's name. In your dashboard it shows with the API key's name as the sender.
GET /notifications (scope notifications:read) lists notifications, newest first, including the
ones your team sent from the dashboard. Filter with client_account_id. sender.type is api
for your software, with the key's name, or person for someone on your team, with their name
(null once they've left).
Common codes: resource_missing (the key can't reach the subaccount), account_suspended (the
subaccount or your agency isn't active), sending_rate_limited.
When someone on the business's team writes in the chat, endpoints subscribed to
chat.message.received get the message:
Webhook payload
{
"id": "evt_4n2w",
"type": "chat.message.received",
"created_at": "2026-09-30T16:07:40Z",
"agency_id": "ag_northwind",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"data": {
"id": "chm_6t1q",
"object": "chat_message",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"text": "Thanks, I'll call her now.",
"sender": { "type": "person", "name": "Maria Chen" },
"created_at": "2026-09-30T16:07:40Z"
}
}Appointments
A business's appointments are one calendar its whole team shares in the app's Calendar tab. The
team adds them in the app; your software books, changes and cancels them here, and hears about
every change through the appointment.* webhooks. Each appointment is one tap from calling or
texting its customer.
GET /availability (scope appointments:read) returns the open times on one day:
| Parameter | Required | Description |
|---|---|---|
client_account_id | Yes | The subaccount |
date | Yes | YYYY-MM-DD in the subaccount's timezone |
duration_minutes | No | How long the appointment is, 5 to 480; default 60 |
Open times start every 30 minutes inside the business's hours (set under Phone, Calling; 9 AM to 5 PM, Monday to Friday, until you set them), never in the past, and never overlap a booked appointment. The business is one calendar: any booked appointment makes its time busy. Booking, moving or cancelling one here sends a notification to the person it's with, or to the team.
Request
curl -G https://api.agencyphone.com/v1/availability \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-d client_account_id=ca_greenline \
-d date=2026-11-03 \
-d duration_minutes=60Response
{
"object": "availability",
"client_account_id": "ca_greenline",
"account": "ca_greenline",
"date": "2026-11-03",
"timezone": "America/Toronto",
"duration_minutes": 60,
"slots": [
{ "starts_at": "2026-11-03T14:00:00Z", "ends_at": "2026-11-03T15:00:00Z" },
{ "starts_at": "2026-11-03T16:00:00Z", "ends_at": "2026-11-03T17:00:00Z" }
]
}POST /appointments (scope appointments:write) books one:
| Parameter | Required | Description |
|---|---|---|
client_account_id | Yes | The subaccount |
title | Yes | What it is, up to 120 characters, for example Estimate |
starts_at | Yes | ISO 8601 with a timezone or Z |
ends_at | No | Or send duration_minutes; 60 minutes by default, up to 7 days |
duration_minutes | No | Used when ends_at is left out |
customer_name | No | Shown when the number isn't a contact yet |
customer_phone | No | E.164; the team calls and texts it in one tap |
location | No | Up to 300 characters |
notes | No | Up to 2,000 characters |
assigned_to_email | No | The email someone on the team signs in with; leave out for anyone |
only_if_open | No | true refuses the booking with slot_unavailable unless the time is open |
Request
curl https://api.agencyphone.com/v1/appointments \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: call-7731-booking" \
-H "Content-Type: application/json" \
-d '{"client_account_id":"ca_greenline","title":"Estimate","starts_at":"2026-11-03T14:00:00Z","duration_minutes":60,"customer_phone":"+14165550188","location":"12 Elm St","only_if_open":true}'Response
{
"id": "apt_5k2m",
"object": "appointment",
"client_account_id": "ca_greenline",
"account": "ca_greenline",
"title": "Estimate",
"status": "scheduled",
"starts_at": "2026-11-03T14:00:00Z",
"ends_at": "2026-11-03T15:00:00Z",
"customer_name": "Dana Whitfield",
"customer_phone": "+14165550188",
"contact_id": "ct_9q4x",
"location": "12 Elm St",
"notes": null,
"assigned_to": null,
"source": "api",
"created_at": "2026-10-12T18:02:11Z",
"updated_at": "2026-10-12T18:02:11Z",
"cancelled_at": null
}customer_name is the contact's name when the number is one of the subaccount's contacts.
GET /appointments (scope appointments:read) lists them earliest first. Filter with
client_account_id, starts_after, starts_before, status (scheduled or cancelled) and
phone. GET /appointments/{id} gets one.
PATCH /appointments/{id} (scope appointments:write) changes any field above except
client_account_id; moving starts_at without ends_at keeps the length, and null clears an
optional field. POST /appointments/{id}/cancel cancels it for the whole team; it stays listed
with status: "cancelled", and cancelling it again returns it as it is.
Common codes: resource_missing (the key can't reach the subaccount or appointment),
slot_unavailable, assignee_not_on_team, appointment_cancelled (a cancelled one can't
change), account_inactive.
Meeting types
A meeting type is a kind of meeting a business can be booked for, with its own length, hours and
booking link. GET /accounts/{id}/meeting-types (scope appointments:read) lists a subaccount's.
Changing them is setup, so it needs settings:write:
POST /accounts/{id}/meeting-types: onlynameis needed. The rest starts as an in person hour, in the subaccount's own hours, with anyone free on the team. Sendduration_minutes,kind,hours,books_withandhoststo set them.PATCH /meeting-types/{id}: changes only what is sent.hoursreplaces the whole week andhoststhe members it's with. Its booking link stays the same.POST /meeting-types/{id}/archiveandPOST /meeting-types/{id}/unarchive: an archived type's booking link stops working and nobody can book it; appointments already booked stay.
Request
curl https://api.agencyphone.com/v1/accounts/ca_lakeside/meeting-types \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"New patient exam","duration_minutes":45}'Action items
An action item is a card on Home in a business's app: something its team has to do, like calling
a new lead. The card is one tap with no buttons; you choose what the tap does (call, text, open a
contact, a chat, a link, book an appointment, or open a menu of up to 5 steps) and how it can end
(up to 5 outcomes, such as Booked or No answer). Your agency's dashboard makes them the same
way, and so will automations, so an item looks and works the same however it was made.
POST /action-items (scope action_items:write) puts one on Home:
| Parameter | Required | Description |
|---|---|---|
client_account_id | Yes | The subaccount |
template_id | No | Start from one of your templates (GET /action-item-templates); anything you send wins |
contact_id or phone | No | Who it's about; a new phone is added to the business's contacts, with name |
list | No | Instead of one contact: each tap picks the next contact matching tags, created_within_minutes, not_called, not_texted, newest or oldest first |
title | Yes* | Up to 120 characters once filled in (*unless the template has one) |
body | No | Up to 500 characters |
details | No | Up to 8 { "label", "value" } rows shown in the item |
tap | No | What tapping does: { "type": "call" }, text (with a message), contact, conversation, book, link (with a url), outcome, or menu (the default) |
steps | No | A menu's steps: up to 5 { "label", "action", "main" } |
outcomes | No | Up to 5 names, each up to 40 characters |
requires_outcome | No | true hides Done, so someone always says how it went |
due_at or due_in_minutes | No | Shown in the app, amber once overdue |
expires_at or expires_in_minutes | No | It goes away on its own after this |
assigned_to_email | No | Someone on the team; leave out for everyone |
external_id | No | Your CRM's ID for it, up to 200 characters |
data | No | Your own JSON, up to 4 KB, never shown in the app |
notify | No | Push the person it's for, or the team; true by default |
dry_run | No | true checks it and fills its variables without making it |
An action's person is the item's contact unless you name another with contact_id or phone.
Anything you write can use variables, filled in once when the item is made:
{{contact.first_name}}, {{contact.name}}, {{contact.phone}}, {{contact.company}},
{{contact.email}}, {{business.name}}, {{item.external_id}} and {{data.<key>}} (one level
down too, like {{data.answers.budget}}). Add a fallback after a bar: {{data.service|a quote}}.
A variable with no value and no fallback is left blank and listed in missing_variables; a link
that needs one isn't shown. On a list, the contact's variables are filled in when each contact is
picked.
Request
curl https://api.agencyphone.com/v1/action-items \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: lead-55120" \
-H "Content-Type: application/json" \
-d '{"client_account_id":"ca_lakeside","phone":"+14165550177","name":"Jane Doe","title":"Call {{contact.first_name}}, new quote request","tap":{"type":"call"},"outcomes":["Booked","No answer"],"requires_outcome":true,"due_in_minutes":5,"external_id":"lead-55120","data":{"source":"Spring promo"},"details":[{"label":"Source","value":"{{data.source}}"}]}'Response
{
"id": "ai_3hd8",
"object": "action_item",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"template": null,
"title": "Call Jane, new quote request",
"body": null,
"details": [{ "label": "Source", "value": "Spring promo" }],
"contact_id": "ct_7mq2",
"phone": "+14165550177",
"list": null,
"tap": { "type": "call" },
"steps": [],
"outcomes": ["Booked", "No answer"],
"requires_outcome": true,
"assigned_to": null,
"due_at": "2026-10-23T15:05:00Z",
"expires_at": null,
"status": "open",
"finished_as": null,
"outcome": null,
"finished_at": null,
"finished_by": null,
"opened_at": null,
"opened_by": null,
"finished_contacts": [],
"source": "api",
"external_id": "lead-55120",
"data": { "source": "Spring promo" },
"created_at": "2026-10-23T15:00:00Z",
"updated_at": "2026-10-23T15:00:00Z",
"missing_variables": []
}GET /action-items (scope action_items:read) lists them newest first. Filter with
client_account_id, status (open or finished), contact_id, external_id, template_id
and created_after. GET /action-items/{id} gets one, with finished_contacts for a list.
PATCH /action-items/{id} (scope action_items:write) changes an open item's title, body,
details, due_at, expires_at, assigned_to_email, external_id and data, with variables
filled in again. POST /action-items/{id}/resolve finishes it: send outcome (one of its
outcomes), dismiss: true, or nothing for done. An item that requires an outcome can't just be
done. A finished item can't change.
GET /action-item-templates lists your templates: the action item types you made under App,
Action items, with the defaults items made from them start with. Make and edit them in the
dashboard.
Common codes: resource_missing, invalid_action_item (with the reason), invalid_outcome,
action_item_finished, assignee_not_on_team, account_inactive.
Widget values
The Home Screen widgets your clients' teams add to their iPhones are built under Client apps,
Mobile (and per subaccount under App, Widgets). A title, a line of text, a number or a picture on
a widget can come from your software: in the widget editor, click the block, open Advanced and
give it a key, such as promo_picture, then set its value for each business through the API.
Buttons and taps can open a link from your software too, under the same Advanced. Until
you set a key, or after you clear it, the widget shows the block's own content.
GET /accounts/{id}/widget-values (scope widgets:read) lists every key the subaccount's
widgets use, with what each shows now and which sizes use it.
PATCH /accounts/{id}/widget-values (scope widgets:write) sets values by key and leaves the
rest as they are. null clears a key. Each value must suit how the widgets use its key:
| Kind | Used by | Value |
|---|---|---|
text | A title or a line of text | A string, up to 40 characters for a title and 120 for text |
number | A number | A whole number from 0; the widget shows up to 99+ |
picture | A picture | An https:// address, or { "url", "described_as" } |
link | A button or a tap | An https:// address of up to 500 characters |
A key the widgets don't use, or a value of the wrong kind, gets a 400 that names it in param
(values.promo_picture), and nothing changes. Send up to 50 keys and 5 pictures at a time.
Repeat a request safely with an Idempotency-Key.
Pictures are downloaded once, from a public https address on port 443 or 8443 (no private
networks, no more than 3 redirects), within 10 seconds and up to 10 MB, as a still PNG or JPEG.
They're made the size the widget needs and copied to our storage, so your address only has to
work once. described_as is what VoiceOver reads; words inside a picture aren't read, so say
what it shows. A picture that can't be used keeps the widget's last one, comes back with
picture_status: "failed" and the reason in picture_error, and sends widget.picture_failed.
Request
curl -X PATCH https://api.agencyphone.com/v1/accounts/ca_lakeside/widget-values \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"values":{"promo_picture":{"url":"https://cdn.northwind.example/whitening.jpg","described_as":"Whitening, 20% off in November"},"promo_link":"https://northwind.example/whitening","leads":4}}'Response
{
"object": "widget_values",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"data": [
{
"object": "widget_value",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"key": "leads",
"kind": "number",
"value": 4,
"sizes": ["large"],
"picture_status": null,
"picture_error": null,
"updated_at": "2026-11-04T15:00:00Z"
},
{
"object": "widget_value",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"key": "promo_picture",
"kind": "picture",
"value": {
"url": "https://cdn.northwind.example/whitening.jpg",
"described_as": "Whitening, 20% off in November"
},
"sizes": ["medium"],
"picture_status": "ready",
"picture_error": null,
"updated_at": "2026-11-04T15:00:00Z"
}
]
}Phones show new values the next time the app opens, and right away while it's open. Common
codes: resource_missing, invalid_widget_value (with the key in param), account_closing.
Data
A business's data tables are simple tables the agency keeps under Phone, AI agents, Data: a name
and up to 20 columns, each text, a number, yes or no (boolean), a date (YYYY-MM-DD) or a link
(https://), and up to 10,000 rows. The AI receptionist looks rows up and adds them on a call when
it's allowed to; your software reads and writes them here. A table is named by its key (orders)
and a column by its key (order_number), both shown on the table's page and kept when it's
renamed.
GET /accounts/{id}/data (scope data:read) lists the subaccount's tables with their columns.
GET /accounts/{id}/data/{table} (scope data:read) lists a table's rows, oldest first, in pages
of up to 100 with limit and starting_after.
POST /accounts/{id}/data/{table} (scope data:write) adds a row. PATCH /accounts/{id}/data/{table}/{row} (scope data:write) changes one: the values you send are
merged into the row, and null clears one. Each value must suit its column; a column the table
doesn't have, or a value of the wrong kind, gets a 400 that names it in param
(values.total), and nothing changes. A row's values leave out columns with no value. Both send
data.row_created or data.row_updated, as changes in the dashboard do. Repeat a POST safely with
an Idempotency-Key.
Request
curl -X POST https://api.agencyphone.com/v1/accounts/ca_lakeside/data/orders \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"values":{"order_number":"A100","status":"Shipped","total":40,"paid":true,"ships_on":"2026-11-20"}}'Response
{
"id": "row_4Qm1",
"object": "data_row",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"table": "orders",
"values": { "order_number": "A100", "status": "Shipped", "total": 40, "paid": true, "ships_on": "2026-11-20" },
"source": "api",
"created_at": "2026-11-05T15:04:05Z",
"updated_at": "2026-11-05T15:04:05Z"
}Common codes: resource_missing (no such subaccount, table or row), invalid_value,
account_closing, table_full.
Pipelines
A business's pipelines are the stages its deals move through ("New lead", "Contacted", "Quote
sent"), set up by the agency in the dashboard. Each deal is an opportunity: one contact, a name,
an optional value in cents, the stage it's in, and a status, open while it's being worked and
won, lost or abandoned once closed. The team moves them in the apps, automations move them
with "Move in a pipeline", and your software moves them here. Every business starts with a Sales
pipeline.
GET /pipelines?client_account_id=ca_... (scope opportunities:read) lists the business's
pipelines with their stages in order.
GET /opportunities (scope opportunities:read) lists opportunities, the newest first, filtered
by client_account_id, pipeline_id, stage_id, status, contact_id or phone.
GET /opportunities/{id} gets one.
POST /opportunities (scope opportunities:write) adds one to a pipeline, in its first stage
unless you send stage_id. Name the contact with contact_id, or send phone and a contact is
added for a number the business doesn't have. name is the contact's name by default. Repeat a
POST safely with an Idempotency-Key.
PATCH /opportunities/{id} (scope opportunities:write) moves it (stage_id, and pipeline_id
to move it to another of the business's pipelines, where it lands in the first stage unless you
send one), closes or reopens it (status), renames it or changes its value. Each change sends
its event: opportunity.stage_changed with previous_stage_id, opportunity.status_changed with
previous_status.
Request
curl -X PATCH https://api.agencyphone.com/v1/opportunities/opp_7Hk2 \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"stage_id":"pst_3Qx9","value_cents":450000}'Response
{
"id": "opp_7Hk2",
"object": "opportunity",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"pipeline_id": "pl_9Tz1",
"stage_id": "pst_3Qx9",
"stage_name": "Quote sent",
"contact_id": "ct_5Mn8",
"phone": "+14165550188",
"name": "Roof repair",
"value_cents": 450000,
"status": "open",
"assigned_to_email": null,
"source": "api",
"stage_entered_at": "2026-11-13T15:04:05Z",
"closed_at": null,
"created_at": "2026-11-12T09:30:00Z",
"updated_at": "2026-11-13T15:04:05Z"
}Common codes: resource_missing (no such pipeline, contact or opportunity), stage_not_in_pipeline,
contact_not_in_business, pipeline_archived, assignee_not_on_team.
Setting up pipelines needs settings:write:
POST /pipelines:account,nameandstages, the stages' names in order. A subaccount can have up to 10 pipelines that aren't archived (422pipeline_limit), each with up to 20 stages.PATCH /pipelines/{id}: renames it, or replaces its stages. Send every stage it should have, in order, withidfor the ones it keeps and noidfor new ones. A stage left out is deleted, which is refused while opportunities are in it (409stage_in_use).POST /pipelines/{id}/archive: it leaves the team's board and takes no new opportunities. A subaccount keeps at least one pipeline (409last_pipeline).
Request
curl https://api.agencyphone.com/v1/pipelines \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"account":"ca_lakeside","name":"Implants","stages":["New lead","Consult booked","Treatment plan sent"]}'Automations
The agency builds a business's automations in the dashboard; your software starts them for a
contact and takes people out. Each automation's ID starts with aut_ and is on its row in
Automations, with Copy.
GET /automations (scope automations:read) lists them, the newest first, filtered by
client_account_id: each with its name, its trigger (webhook, facebook_lead,
lead_received, manual, call_missed, text_received and the rest, with trigger_label in the
dashboard's words) and its status, on or off. GET /automations/{id} gets one.
POST /automations/{id}/enrollments (scope automations:write) starts it for a contact,
whatever starts it in the dashboard. Name the contact with contact_id, or send phone (a contact
is added for a number the business doesn't have, with name and email when you send them), or
email (finds a contact with it). payload is a JSON object up to 16 KB that its steps read as
{{payload.order.total}}; for an automation that starts with a lead, it's the lead's answers too.
It answers 202: the automation starts within seconds, unless its guardrails skip it (the same
person within a minute, more than 20 runs for them in a day), which History shows. Repeat a POST
safely with an Idempotency-Key.
Request
curl -X POST https://api.agencyphone.com/v1/automations/aut_4Fp2/enrollments \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: order-A-1001" \
-H "Content-Type: application/json" \
-d '{"phone":"+14165550188","name":"Dana Whitfield","payload":{"order":{"id":"A-1001","total":240}}}'Response
{
"id": "enr_6Rt1",
"object": "enrollment",
"automation_id": "aut_4Fp2",
"contact_id": "ct_5Mn8",
"status": "queued",
"created_at": "2026-11-24T15:04:05Z"
}DELETE /automations/{id}/enrollments/{contact} (scope automations:write) takes a contact out:
their runs of it that are going or waiting stop, with a line in History, and a start still queued
is dropped. It answers with status removed and runs_stopped.
Common codes: resource_missing (no such automation or contact), automation_off,
automation_needs_its_start (its steps read the words of a text, or a lead's answers and you sent
no payload), automations_paused, contact_not_found, contact_not_in_business,
no_open_deal.
GET /automations/{id} also returns graph: the automation's When and its boxes as the editor
saves them, read only. A list never carries it. Writing a graph through the API is not available;
build automations in the dashboard's editor.
POST /automations/{id}/enable and POST /automations/{id}/disable turn one on and off. They
need settings:write, not automations:write, so a key made to start automations can't switch
them. Turning one on runs the checks the dashboard runs first: an automation that isn't finished
answers 422 automation_incomplete with what to fix in the editor. One that is already on, or
already off, is returned as it is.
AI agents
An AI agent is a business's named AI teammate: it answers calls, texts and email, books, takes messages and asks the team. The API reads agents, creates and changes them through their config document, pauses them, puts them on numbers, and changes what they know.
GET /agents (scope agents:read) lists the agents of the subaccounts the key reaches, each with
the numbers it answers and whether it is ready for calls. Filter with account.
Response
{
"data": [
{
"id": "agn_5Vx2",
"object": "agent",
"account": "ca_lakeside",
"name": "Ava",
"role": "front_desk",
"color": "sky",
"paused": false,
"state": "ready",
"on_calls": true,
"on_texts": true,
"on_email": false,
"numbers": ["num_4k2p"],
"ready_for_calls": true,
"not_ready": [],
"created_at": "2026-11-20T10:00:00Z"
}
],
"has_more": false
}not_ready says in words what is missing before the agent can answer calls, and is empty when it
is ready.
The config document
GET /agents/{id} returns the agent with config, the same document as Advanced under the
agent's Settings in the dashboard. It holds the agent's name, role, voice, what it knows, its
manner, what it always and never does, who it asks, and its settings for texts, email and calls.
People, staff groups, meeting types and knowledge bases are named by their names in the
subaccount. It holds no secrets.
POST /agents (scope agents:write) makes an agent from account and a config.
PATCH /agents/{id} replaces the agent's whole config, so read it, change it and send it back.
Both run the editor's checks.
Request
curl https://api.agencyphone.com/v1/agents \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Idempotency-Key: lakeside-front-desk" \
-H "Content-Type: application/json" \
-d @agent.jsonagent.json
{
"account": "ca_lakeside",
"config": {
"format": "agencyphone.agent",
"version": 2,
"name": "Ava",
"role": "front_desk",
"color": "sky",
"paused": false,
"voice": "jennifer",
"thinking": "hybrid",
"says_ai": true,
"knows": "Lakeside Dental is a family dental office at 12 Shore Road. Open Monday to Friday, 9 to 5.",
"manner": { "warmth": 70, "brevity": 60, "formality": 40 },
"always": ["Offer the next open time when someone asks to book."],
"never": ["Give medical advice."],
"check_ins": { "on": false, "every_minutes": null },
"leads_team": false,
"updates_contacts": true,
"asks": { "people": ["Maria Chen"], "groups": [] },
"take_over": { "people": [], "groups": [] },
"texts": { "on": true, "book": true, "ask": true, "follow_up": false, "numbers": [] },
"email": { "on": false, "book": false, "ask": false },
"calls": null
}
}calls set to null keeps the call settings as they are: a new agent starts with the defaults and
is on no number. A subaccount keeps up to 20 agents.
| Code | Status | When |
|---|---|---|
invalid_config | 422 | The document doesn't fit; the message says where |
invalid_reference | 422 | A name in the document isn't the subaccount's own person, group, meeting type or knowledge base |
agent_not_ready | 409 | The change would leave an agent that answers calls not ready; the message says what is missing |
grants_not_available | 422 | Which connections and data tables an agent may use can't change through the API; send them as they are |
agency_reach_required | 403 | A changed calls part needs a key that reaches the whole agency |
agent_limit | 409 | The subaccount has 20 agents already |
Two things the dashboard's editor allows are refused through the API. A key can't change which
connections and data tables an agent uses: it could otherwise point an agent at a database and
text in for the data. And the calls part, which decides what the agent does with callers, takes
a key that reaches the whole agency.
Pausing, numbers, activity and usage
POST /agents/{id}/pauseandPOST /agents/{id}/resume(scopeagents:write): a paused agent answers nothing until it is resumed.POST /agents/{id}/numbers(scopenumbers:routing): sendnumber, one of the subaccount's numbers. The agent goes on the number's call steps in place of Voicemail, or as a new last step when there is none; another agent on the number leaves. The agent has to be ready for calls (409agent_not_ready) and the number can't already have 5 steps (409number_full).DELETE /agents/{id}/numbers/{number}(scopenumbers:routing): takes the agent off the number. A number left with no step gets Voicemail.GET /agents/{id}/events(scopeagents:read): the agent's feed, newest first: what it answered, booked, asked the team, learned and so on.GET /agents/{id}/usage(scopeagents:read, a key that reaches the whole agency, since it reads your agency's ledger): the charges the agent caused this month, by kind, from your agency's ledger. SendmonthasYYYY-MMfor another one.
Knowledge
General knowledge is the lines a subaccount's agents use: facts, and corrections, which win over the rest.
GET /knowledge?account=ca_...(scopeagents:read): newest first. Sendagentfor the lines one agent uses.POST /knowledge(scopeagents:write):accountandtext, one fact of up to 500 characters, for every agent of the subaccount or the ones named inagents.PATCH /knowledge/{id}andDELETE /knowledge/{id}: change a line or remove it. Agents stop using a removed line at once.
Never put passwords, card numbers or account details in knowledge: agents can say what they know.
A knowledge base is a set of sources an agent searches on calls.
GET /knowledge-basesandGET /knowledge-bases/{id}(scopeagents:read): a subaccount's bases withaccount, or every base the key reaches. Your agency's own bases, usable by every subaccount, haveaccountset to null and show only to a key that reaches the whole agency.POST /knowledge-bases,PATCH /knowledge-bases/{id}andDELETE /knowledge-bases/{id}(scopeagents:write): create, rename and delete. A subaccount keeps up to 20 (409knowledge_base_limit).GET /knowledge-bases/{id}/sources,POST /knowledge-bases/{id}/sourcesandDELETE /knowledge-sources/{id}: a source is ananswer(titleis the question,textthe answer), apage(titleandtext) or awebsite(url, https only). A website's one page is read once, now, and the source comes back ready or failed with the reason. A base keeps up to 200 sources (409knowledge_source_limit). Files are added in the dashboard.
The app
What a business's team sees on Home in their app, and the bins they share files through.
Home cards and pinned action items
GET /home-cards?account=ca_... (scope app:read) lists the cards at the top of Home, in their
order. A Home holds up to 12. Changing them needs app:write.
POST /home-cards adds a card, last. Its kind is one of:
| Kind | What it is |
|---|---|
link | A title and an https url |
note | A title with a body |
action | A pinned action item. It stays on Home unless dismissible is true, and may carry an https url |
agency_chat | The chat with your agency, which the app draws itself. No words, one per Home |
A title is up to 30 characters and a body up to 120.
Request
curl https://api.agencyphone.com/v1/home-cards \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"account":"ca_lakeside","kind":"action","title":"Confirm Friday bookings","body":"Call the three patients on Friday morning.","dismissible":true}'Response
{
"id": "hc_1Rn8",
"object": "home_card",
"account": "ca_lakeside",
"kind": "action",
"title": "Confirm Friday bookings",
"body": "Call the three patients on Friday morning.",
"url": null,
"icon": null,
"has_image": false,
"dismissible": true,
"dismissed_at": null,
"position": 3
}PATCH /home-cards/{id} changes the words, link, icon or whether the team may clear it; a card's
kind can't change. An action the team cleared is still listed, with dismissed_at; send
dismissed: false to put it back on Home. DELETE /home-cards/{id} deletes a card, and
PUT /accounts/{id}/home-cards/order orders them: ids is every card of that Home, each once
(422 incomplete_order otherwise). Pictures can't be uploaded through the API; add one in the
dashboard.
Codes: card_limit (422, the Home has 12 cards), agency_chat_exists (409), url_not_allowed
(400, a link must start with https).
For work with contacts, outcomes and due times, use Action items.
Bins
A bin is a shared place for files with a public link: the team's customers upload to it, download from it, or both.
GET /binsandGET /bins/{id}(scopeapp:read): bins newest first, each with its files counted and itsurl. Filter withaccount.POST /bins(scopeapp:write):name,days(1, 7 or 30, how long it stays open),access(upload,downloador both, asboth) and optionallyaccountandcode. Withcodetrue a 4-digit code is made and returned once in the response, which is never kept for idempotency. Withoutaccountthe bin is your agency's own and the key must reach the whole agency.POST /bins/{id}/close(scopeapp:write): its link stops taking and giving files; the files it holds stay.
Codes: storage_full (422), daily_limit (429, more than 50 bins a day for one owner). Files
can't be uploaded through the API yet.
Listing events
Every event is kept once for 30 days, whether or not a webhook endpoint listened.
GET /events (scope events:read) lists them, newest first, and GET /events/{id} gets one. An
event is the same envelope a webhook carries, so the code that handles a webhook handles these.
| Parameter | Description |
|---|---|
account | Only events of this subaccount |
type | Only events of this type, for example message.received |
order | desc, the default, is newest first. asc is oldest first |
starting_after | The ID of the last event you received |
limit | 1 to 100, default 25 |
events:read alone opens nothing: a key sees an event only when it can also read the event's
object. An event the key can't read answers 404.
| Events | Scope the key also needs |
|---|---|
message.* | messages:read |
call.*, voicemail.created, agent.action, callback.* | calls:read |
email.* | emails:read |
contact.opted_out | contacts:read |
email.received | An email arrived in a business's inbox. Never fires for spam |
email.sent | An email was sent from a business's inbox, from the apps or the API; data.source says which |
email.delivered | The receiving mail server accepted an email |
email.bounced | An email bounced or was marked as spam; that address won't be emailed again |
number.purchased | A number became active for a subaccount |
number.released | A subaccount's number was released |
number.* | numbers:read |
appointment.* | appointments:read |
subaccount.*, texting.* | accounts:read |
action_item.* | action_items:read |
opportunity.* | opportunities:read |
data.row_created, data.row_updated | data:read |
chat.message.received | notifications:read |
widget.picture_failed | widgets:read |
api_key.locked, api_key.unlocked | usage:read, with a key that reaches the whole agency |
To catch up after downtime, keep the ID of the last event you handled. When your software comes back, page forward from it:
Request
curl -G https://api.agencyphone.com/v1/events \
-H "Authorization: Bearer ap_live_YOUR_KEY" \
-d order=asc \
-d starting_after=evt_8f1c \
-d limit=100Keep asking with starting_after set to the last event's id while has_more is true. Events
are ordered by when they were recorded, and one can be recorded a moment after a later one. So
start from an event you handled about a minute before the last, expect to see that minute again,
and skip the events whose id you already handled.
All endpoints
Every endpoint, written from the table the API runs on. Paths are under
https://api.agencyphone.com/v1. Permission is the scope the key needs; "agency key" means the
key also has to reach the whole agency. MCP tool is the tool that calls the endpoint through the
MCP server, where one does. Every POST takes an idempotency key.
Events
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /events | List events | events:read | list_events |
GET /events/{id} | Get an event | events:read |
Accounts
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /accounts | List subaccounts | accounts:read | list_accounts |
POST /accounts | Create a subaccount | accounts:write | create_account |
GET /accounts/{id} | Get a subaccount | accounts:read | |
PATCH /accounts/{id} | Rename a subaccount or change its timezone | accounts:write | |
POST /accounts/{id}/pause | Pause a subaccount: calls and texts stop until it is resumed | accounts:write | pause_account |
POST /accounts/{id}/resume | Resume a paused subaccount | accounts:write | resume_account |
POST /accounts/{id}/close | Close a subaccount; it can be reopened for 30 days | accounts:close | |
POST /accounts/{id}/reopen | Reopen a closing subaccount | accounts:close | |
GET /accounts/{id}/widget-values | Every key a subaccount's widgets use, with what each shows now | widgets:read | |
PATCH /accounts/{id}/widget-values | Set what a subaccount's widgets show by key: text, a number, a picture or a link. Merges; null clears a key. Takes an idempotency key | widgets:write | |
GET /accounts/{id}/data | A subaccount's data tables, with their columns | data:read | |
GET /accounts/{id}/data/{table} | A data table's rows, oldest first | data:read | |
POST /accounts/{id}/data/{table} | Add a row to a data table | data:write | |
PATCH /accounts/{id}/data/{table}/{row} | Change a row's values. Merges; null clears a value | data:write | |
GET /accounts/{id}/meeting-types | A subaccount's meeting types, in its order, with their booking links | appointments:read | list_meeting_types |
Usage
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /usage | A month of usage and spend by subaccount | usage:read | get_usage |
GET /ledger | List the agency's ledger | usage:read, agency key |
Balance
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /balance | Your agency's balance | usage:read, agency key | get_balance |
Numbers
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
PATCH /numbers/{id} | Change a number's label | numbers:write | |
GET /numbers | List numbers | numbers:read | list_numbers |
GET /numbers/available | Search numbers to buy | numbers:buy | search_available_numbers |
POST /numbers | Buy numbers | numbers:buy | buy_number |
GET /numbers/{id} | Get a number | numbers:read | |
DELETE /numbers/{id} | Release a number | numbers:buy | release_number |
GET /numbers/{id}/call-steps | Get a number's call steps | numbers:read | |
PUT /numbers/{id}/call-steps | Set a number's call steps | numbers:routing | |
GET /ring-groups | List ring groups | numbers:read | |
PUT /accounts/{id}/ring-groups | Save ring groups | numbers:routing |
Contacts
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /contacts | List contacts | contacts:read | list_contacts |
POST /contacts | Create a contact | contacts:write | create_contact |
GET /contacts/{id} | Get a contact | contacts:read | get_contact |
PATCH /contacts/{id} | Update a contact | contacts:write | update_contact |
GET /contacts/{id}/notes | List a contact's notes | contacts:read | list_contact_notes |
POST /contacts/{id}/notes | Add a note to a contact | contacts:write | add_contact_note |
PATCH /notes/{id} | Update a note | contacts:write | |
DELETE /notes/{id} | Delete a note | contacts:write | |
GET /tags | List a subaccount's tags | contacts:read |
Conversations
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /conversations | List conversations | messages:read | list_conversations |
Messages
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /messages | List messages | messages:read | list_messages |
POST /messages | Send a text | messages:write | send_text |
GET /messages/{id} | Get a message | messages:read | |
GET /conversations/{id} | Get a conversation | messages:read | get_conversation |
PATCH /messages/{id} | Update a text's metadata | messages:write |
Calls
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /calls | List calls | calls:read | list_calls |
GET /calls/{id} | Get a call, with a signed recording URL | calls:read | get_call |
POST /calls | Place a call for a teammate | calls:write | place_call |
PATCH /calls/{id} | Set a call's metadata | calls:write | |
POST /calls/{id}/hangup | Hang up a call the API placed | calls:write | hang_up_call |
GET /calls/{id}/transcript | Get a call's transcript | calls:read | get_call_transcript |
GET /calls/{id}/actions | List what an AI agent did on a call | calls:read |
Voicemails
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /voicemails | List voicemails | calls:read | list_voicemails |
GET /voicemails/{id} | Get a voicemail, with a signed audio URL | calls:read |
Notifications
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /notifications | List notifications | notifications:read | |
POST /notifications | Send a notification to a business's team | notifications:write | send_notification |
Appointments
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /appointments | List appointments, earliest first | appointments:read | list_appointments |
POST /appointments | Book an appointment | appointments:write | book_appointment |
GET /appointments/{id} | Get an appointment | appointments:read | |
PATCH /appointments/{id} | Change an appointment | appointments:write | update_appointment |
POST /appointments/{id}/cancel | Cancel an appointment | appointments:write | cancel_appointment |
POST /accounts/{id}/meeting-types | Create a meeting type | settings:write | |
PATCH /meeting-types/{id} | Update a meeting type | settings:write | |
POST /meeting-types/{id}/archive | Archive a meeting type | settings:write | |
POST /meeting-types/{id}/unarchive | Unarchive a meeting type | settings:write |
Availability
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /availability | Open times on a day | appointments:read | check_availability |
Pipelines
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /pipelines | List a business's pipelines, with their stages | opportunities:read | list_pipelines |
POST /pipelines | Create a pipeline | settings:write | |
PATCH /pipelines/{id} | Update a pipeline | settings:write | |
POST /pipelines/{id}/archive | Archive a pipeline | settings:write |
Opportunities
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /opportunities | List opportunities, the latest to move first | opportunities:read | list_opportunities |
POST /opportunities | Add an opportunity to a pipeline | opportunities:write | create_opportunity |
GET /opportunities/{id} | Get an opportunity | opportunities:read | |
PATCH /opportunities/{id} | Move, close, rename or revalue an opportunity | opportunities:write | move_opportunity |
Automations
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /automations | List a business's automations, the newest first | automations:read | list_automations |
GET /automations/{id} | Get an automation | automations:read | |
POST /automations/{id}/enrollments | Start an automation for a contact, whatever starts it in the dashboard | automations:write | add_to_automation |
DELETE /automations/{id}/enrollments/{contact} | Take a contact out of an automation: its runs for them stop | automations:write | |
POST /automations/{id}/enable | Turn an automation on | settings:write | |
POST /automations/{id}/disable | Turn an automation off | settings:write |
Action items
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /action-items | List action items, newest first | action_items:read | list_action_items |
POST /action-items | Put an action item on a business's Home | action_items:write | create_action_item |
GET /action-items/{id} | Get an action item | action_items:read | |
PATCH /action-items/{id} | Change an open action item | action_items:write | |
POST /action-items/{id}/resolve | Finish an action item: with an outcome, done, or dismissed | action_items:write |
Action item templates
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /action-item-templates | List action item templates | action_items:read |
Subaccounts
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /accounts/{id}/setup | Get a subaccount's setup | accounts:read | get_setup |
GET /accounts/{id}/hours | Get business hours | accounts:read | |
PUT /accounts/{id}/hours | Set business hours | settings:write | |
GET /accounts/{id}/profile | Get a business profile | profiles:read | get_business_profile |
PATCH /accounts/{id}/profile | Update a business profile | profiles:write | update_business_profile |
POST /accounts/{id}/profile/verify | Verify a business | profiles:write, agency key | verify_business |
Team
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /members | List a subaccount's team | team:read | list_members |
GET /members/{id} | Get a team member | team:read | |
DELETE /members/{id} | Remove someone from a team | team:write | remove_member |
GET /members/{id}/hours | Get a team member's hours | team:read | |
PUT /members/{id}/hours | Set a team member's hours | team:write | |
GET /invitations | List a subaccount's open invitations | team:read | |
POST /invitations | Invite someone to a team | team:invite | invite_member |
DELETE /invitations/{id} | Cancel an invitation | team:invite |
Call backs
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /callbacks | List call backs | calls:read | |
GET /callbacks/{id} | Get a call back | calls:read |
Automated calls
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
POST /automated-calls | Place an automated call | calls:write | place_automated_call |
GET /automated-calls | List automated calls | calls:read | |
GET /automated-calls/check | Check whether someone can get an automated call | calls:read | check_automated_call |
GET /automated-calls/{id} | Get an automated call | calls:read | get_automated_call |
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /emails | List emails | emails:read | list_emails |
POST /emails | Send an email | emails:write | send_email |
GET /emails/{id} | Get an email | emails:read | |
PATCH /emails/{id} | Update an email's metadata | emails:write | |
GET /email-threads | List email threads | emails:read | list_email_threads |
GET /email-threads/{id} | Get an email thread | emails:read | |
PATCH /email-threads/{id} | Move an email thread | emails:write | |
GET /accounts/{id}/inbox | Get a subaccount's inbox | emails:read |
AI agents
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /agents | List AI agents | agents:read | list_agents |
POST /agents | Create an AI agent | agents:write | |
GET /agents/{id} | Get an AI agent with its config | agents:read | get_agent |
PATCH /agents/{id} | Replace an AI agent's config | agents:write | |
POST /agents/{id}/pause | Pause an AI agent | agents:write | pause_agent |
POST /agents/{id}/resume | Resume a paused AI agent | agents:write | resume_agent |
GET /agents/{id}/events | List an AI agent's activity | agents:read | list_agent_activity |
GET /agents/{id}/usage | An AI agent's charges for a month | agents:read, agency key | |
POST /agents/{id}/numbers | Put an AI agent on a number | numbers:routing | put_agent_on_number |
DELETE /agents/{id}/numbers/{number} | Take an AI agent off a number | numbers:routing |
Knowledge
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /knowledge | List general knowledge | agents:read | list_knowledge |
POST /knowledge | Add a line of general knowledge | agents:write | add_knowledge |
PATCH /knowledge/{id} | Change a line of general knowledge | agents:write | |
DELETE /knowledge/{id} | Remove a line of general knowledge | agents:write | |
GET /knowledge-bases | List knowledge bases | agents:read | |
POST /knowledge-bases | Create a knowledge base | agents:write | |
GET /knowledge-bases/{id} | Get a knowledge base | agents:read | |
PATCH /knowledge-bases/{id} | Rename a knowledge base | agents:write | |
DELETE /knowledge-bases/{id} | Delete a knowledge base | agents:write | |
GET /knowledge-bases/{id}/sources | List a knowledge base's sources | agents:read | |
POST /knowledge-bases/{id}/sources | Add a source to a knowledge base | agents:write | |
DELETE /knowledge-sources/{id} | Remove a source from its knowledge base | agents:write |
App
| Endpoint | What it does | Permission | MCP tool |
|---|---|---|---|
GET /home-cards | List a subaccount's Home cards | app:read | |
POST /home-cards | Add a Home card | app:write | |
PATCH /home-cards/{id} | Change a Home card | app:write | |
DELETE /home-cards/{id} | Delete a Home card | app:write | |
PUT /accounts/{id}/home-cards/order | Order a subaccount's Home cards | app:write | |
GET /bins | List bins | app:read | |
POST /bins | Create a bin | app:write | |
GET /bins/{id} | Get a bin | app:read | |
POST /bins/{id}/close | Close a bin | app:write |
Webhooks
Endpoints
Add endpoints in the dashboard under Developers. Each endpoint has an HTTPS URL, the events it
receives and, optionally, one subaccount. Its signing secret is shown when you create it and
can be revealed or rotated later with a fresh sign-in code. To check your setup, choose Send test
from the endpoint's menu and pick any event type the endpoint listens for: a sample of that event
that says it is a test is delivered. Turn an endpoint off to pause it; events that happen while
it's off aren't sent to it later, but they are kept, so you can read them with GET /events.
Events
| Event | When |
|---|---|
message.received | A text arrived on one of your numbers |
message.sent | A text was sent, from the app or the API; data.source says which |
message.delivered | The carrier confirmed delivery |
message.failed | The text could not be delivered; data.error explains why |
call.started | A call began: one that came in, or one placed from the app or the API |
call.completed | A call ended after connecting |
call.missed | An inbound call was not answered |
call.summarized | A call an AI agent answered has its summary and outcome, and its transcript when the business records calls |
voicemail.created | A caller left a voicemail |
contact.opted_out | A contact replied STOP and will not receive texts |
chat.message.received | Someone on a business's team wrote to your agency in the chat |
appointment.created | An appointment was booked, in the app or the API |
appointment.updated | An appointment's time or details changed |
appointment.cancelled | An appointment was cancelled |
subaccount.paused | A subaccount was paused, in the dashboard or the API |
subaccount.resumed | A paused subaccount was resumed |
subaccount.closed | A subaccount was closed and its 30 days began |
subaccount.reopened | A closing subaccount was reopened |
texting.paused | AgencyPhone paused a subaccount's texting after warning signs |
texting.resumed | A subaccount's texting was turned back on |
action_item.created | An action item was put on a business's Home |
action_item.opened | Someone on the team opened an action item for the first time |
action_item.contact_finished | One contact on a list item was finished; data.finished_contact says who and how |
action_item.resolved | An action item was finished; data.outcome says how it went |
widget.picture_failed | A picture sent for a widget couldn't be used; data.picture_error says why |
agent.action | The AI receptionist booked, texted a link, handed a call over, took a message, looked something up, used a connection, sent an email or saved to a table, or was refused one; data.outcome says which |
data.row_created | A row was added to a business's data table, from the dashboard, an import, the API or the AI receptionist; data.source says which |
data.row_updated | A row in a business's data table changed |
opportunity.created | An opportunity was added to a pipeline, in the apps, by an automation or by the API; data.source says which |
opportunity.stage_changed | An opportunity moved to another stage; data.previous_stage_id says where it was |
opportunity.status_changed | An opportunity was won, lost, abandoned or opened again; data.previous_status says what it was |
callback.created | An AI agent set up a call back from someone on the team; data.due_at says by when and data.assigned_to_email who calls |
callback.updated | A call back was done, missed or cancelled; data.previous_status says what it was and data.done_by_call_id the call that closed it |
automated_call.completed | An automated call ended; data.outcome says how, data.key_pressed the key, and an agent's call carries data.summary |
api_key.locked | An API key or a connected app was locked; data.lock_reason says why and data.lock_detail holds the counts. Belongs to the agency: account is null |
api_key.unlocked | A locked API key or connected app was unlocked, by a person or at the next day's start; data.lock_reason says why it had been locked |
Payload
Every event has the same envelope. account is the subaccount the event is about, the same
value as the older client_account_id beside it. Both are null for an event that belongs to the
agency and no subaccount (api_key.locked and api_key.unlocked); those go only to endpoints
that listen for every subaccount. data is the object the event is about: a
message, call, voicemail, contact, email, number, chat message, appointment, action item, widget
value, agent action, data row, opportunity or callback, in the same shape as the API returns (see
Notifications for a chat message), with its own account and your metadata.
Webhook payload
{
"id": "evt_8f1c",
"type": "message.received",
"created_at": "2026-09-30T14:41:07Z",
"agency_id": "ag_northwind",
"client_account_id": "ca_lakeside",
"account": "ca_lakeside",
"data": {
"id": "msg_7hr9",
"object": "message",
"conversation_id": "cv_2k9x",
"direction": "inbound",
"from": "+14165550199",
"to": "+14165550142",
"text": "Can someone call me?",
"status": "received",
"segments": 1
}
}Verifying signatures
Each request has an AgencyPhone-Signature header: t={unix time},v1={signature}. The signature
is the hex HMAC-SHA256 of {t}.{raw body} with your endpoint's secret. Compare it in constant time
and reject requests older than 5 minutes.
import crypto from "node:crypto";
// header: the AgencyPhone-Signature request header, "t=1790779267,v1=5f2b..."
export function verifyWebhook(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1 ?? "");
return fresh && a.length === b.length && crypto.timingSafeEqual(a, b);
}Verify against the raw body exactly as received, before parsing it.
Retries
Respond with any 2xx status within 10 seconds. Anything else is retried seven times: after 1
minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours, each counted from the
attempt before, so the last try is about two days after the first. Then the delivery is marked
as abandoned. An event can arrive more than once; use its id to skip duplicates.
If an endpoint has had no successful delivery for 72 hours while events were being sent, it is turned off and your agency gets an email. Turn it back on in the dashboard once it is fixed.
Catching up after downtime
A delivery that was abandoned, or an event that happened while an endpoint was off, isn't lost.
Every event is kept for 30 days whoever listened. Read what you missed with GET /events, paging
forward from the last event you handled: see Listing events.
Delivery log
The dashboard shows every delivery from the last 7 days with its status, response code, the start of the request and response bodies, and when the next retry is due.
Endpoint requirements
- HTTPS on port 443 or 8443.
- The address must resolve to a public IP. Private, loopback, link-local and cloud metadata addresses are refused.
- Redirects are not followed.
MCP server
The MCP server gives an AI model the same API through the Model Context Protocol. Give a model a key and it can run a client's communications: find a contact, read the conversation, answer by text or email, check open times and book, move a deal, place a call for a teammate, read usage, or set up a new subaccount from its name to live.
Address
https://www.agencyphone.com/api/mcpHow it works
- A tool is an endpoint. Each tool runs the endpoint behind it through the same checks as a request to the API: the key's permissions, its reach, the rate limit, idempotency, events and the request log, where the row is marked MCP with the tool's name. The MCP server has no permissions of its own.
- Tools follow the key's permissions. The server lists only the tools the key's scopes allow, so a read-only key gets a read-only server. All endpoints names the tool for each endpoint that has one.
- 63 tools. 60 are curated, one for each common task, and three are generic.
- Three tools reach the rest. Everything without a tool of its own is reached with
api_readandapi_write.list_endpointssearches every endpoint by words,api_readcalls anyGETby its path, andapi_writecalls any other endpoint by method and path.api_writeis listed only for a key that can change something. - Lists are short. List tools take
limitandstarting_after, and the result sayshas_more.accountis a parameter on every tool that needs one. - Every message counts. Each MCP message, a tool call or not, takes from the key's rate limit and shows under Developers, Logs.
- Errors come back to the model. A refusal is a tool result marked as an error, carrying the same body as the API, so the model can read the code and fix its call.
- Retries are safe when asked for. Tools that create or send take
idempotency_key. Nothing is made idempotent without it. - The server also offers two resources, a guide for the model and the OpenAPI document, and three prompts: set up a new client, follow up missed calls, and a daily summary.
Turning a key on
A key works with the MCP server only after someone turns that on. In the dashboard, open Developers, MCP server, pick a key or create one, and switch it on. Only owners and admins can. Keys are off by default, and a key that isn't on answers 403. The page lists the tools the picked key exposes and its recent MCP activity.
What reaches a person or costs money
A model holding these tools can act in the world. The ones to think about:
| Tool | What it does |
|---|---|
send_text | Sends a real text from the business's number, charged per segment |
send_email | Sends a real email from the business's inbox |
place_call | Rings a teammate's app, then calls the customer; minutes are charged |
send_notification | Shows on the team's phones |
invite_member | Lets someone onto a team, where they read its texts and calls |
buy_number | Charged to your agency every month |
verify_business | Takes the verification price from your balance, now and every month |
release_number | Gives a number up for good |
remove_member | Takes someone off a team |
Tools are marked for clients that ask before acting: read-only tools as read-only, deletes, releases and the like as destructive, and what reaches a person as open-world. The product's own limits hold whatever a model asks for: opt-outs, calling hours, daily caps and the balance rule.
What customers wrote is data
Texts, emails, call transcripts, voicemails and contact notes are written by people outside your agency. A model that reads them while holding tools that send can be told, inside a text, to do something: that is prompt injection. What we do about it, and what you should:
- Keys are off for MCP by default. No key becomes an MCP key by accident.
- Give an MCP key the least it needs. A key that reads and drafts needs no send scope. Limit it to the subaccounts the job is for.
- Read and write tools are apart.
api_readcan never change anything, andapi_writeappears only with a write scope, so a read-only key has no way to act. - The server tells the model. Its instructions and its guide say that what customers wrote is information to read, never instructions to follow, and to say what it will do before it sends, calls, buys or deletes.
- Keep a person in the loop for anything that reaches a customer, by setting your client to ask before those tools run.
Claude Code
Terminal
claude mcp add --transport http agencyphone https://www.agencyphone.com/api/mcp --header "Authorization: Bearer ap_live_YOUR_KEY"Or commit a .mcp.json to your project and keep the key in your environment:
.mcp.json
{
"mcpServers": {
"agencyphone": {
"type": "http",
"url": "https://www.agencyphone.com/api/mcp",
"headers": {
"Authorization": "Bearer ${AGENCYPHONE_API_KEY}"
}
}
}
}Connect by signing in
An app that speaks OAuth, such as Claude or ChatGPT, needs no key. Give it the address. It asks the server, gets a 401 that points at the server's metadata, and opens a window on agencyphone.com. There an owner or admin of the agency signs in as usual, picks what the app reaches (the whole agency, every subaccount, or specific subaccounts) and what it can do (full access, or none, read or write for each area), and clicks Allow. The window says where the app will send you back to. Check that address before you allow it.
The connection then shows under Developers, MCP server, Connections, with who connected it, what it reaches and when it was last used. Revoke ends it at once. To change what a connection reaches or can do, revoke it and connect again. A connection ends by itself when whoever allowed it stops being an owner or admin of the agency.
A connected app is held to exactly what was picked, by the same checks as a key: reach, permissions, the rate limit and the request log, where its rows are marked MCP and named after the app.
Claude custom connectors
On claude.ai and in the desktop app: Customize, Connectors, Add, Add custom connector. Enter a name and the address above. Under Authentication pick Sign in now, and under OAuth client keep Use Claude's published identity. Click Add, then allow it in the window that opens. On Team and Enterprise plans an owner adds it under Organization settings, Connectors, and each person clicks Connect.
In Claude Code, add the server without a header, then run /mcp and follow the steps in your
browser, or run claude mcp login agencyphone:
Command
claude mcp add --transport http agencyphone https://www.agencyphone.com/api/mcpChatGPT
Add the address above as a custom connector and choose OAuth for its sign-in. ChatGPT opens the same window on agencyphone.com. OpenAI's help center says where custom connectors are added on your plan.
OpenAI Responses API
Pass the server as an MCP tool, with the key in headers:
Tool
{
"type": "mcp",
"server_label": "agencyphone",
"server_url": "https://www.agencyphone.com/api/mcp",
"headers": { "Authorization": "Bearer ap_live_YOUR_KEY" },
"require_approval": "always"
}Any client
The server speaks Streamable HTTP at one address, protocol versions 2025-11-25 and 2025-06-18.
- Send one bearer header on every request:
Authorization: Bearer ap_live_YOUR_KEY, or an access token from the OAuth door below. - There is no session: the server issues no session ID, and any request can be answered alone.
- Send one JSON-RPC message per
POST; batches are refused. The answer is JSON.GETanswers 405, since the server never pushes. - A request from a browser page on an origin we don't list is refused. Server-side clients send no origin and are fine.
OAuth for client builders
The server follows the MCP authorization specification (revision 2026-07-28, and 2025-11-25 before it): OAuth 2.1 with PKCE.
- A request with no token answers 401 with
WWW-Authenticate: Bearer resource_metadata="https://www.agencyphone.com/.well-known/oauth-protected-resource/api/mcp", scope="mcp". - The authorization server is
https://www.agencyphone.com, with its metadata at/.well-known/oauth-authorization-server. - Name your client with a client ID metadata document (an https address that serves its
client_id,client_nameandredirect_uris), or register it with aPOSTto theregistration_endpoint. Every client is public: no secret,S256PKCE on every request. - Redirect addresses are https, or http on
localhost,127.0.0.1or[::1]with any port. A custom scheme is refused. - Send
resourcewith the address you connect to. A token works only at the MCP server, never on the REST API. - Access tokens last an hour. A refresh token is used once and answered with a new one. Sent
again within a minute (a lost answer) it gets a new pair and the one before is ended; sent
again later it ends the connection. A refresh token that no longer works answers
invalid_grant. - The one scope is
mcp. What a connection may do is what the person picked, and a tool it may not use isn't listed. - A
POSTto therevocation_endpointwith either token ends the connection.
Texting registration and compliance
Texting registration
US carriers require every business that texts from a local number to be registered (10DLC). Each subaccount has one brand registration and one or more campaigns. The dashboard guides you through the legal name, tax ID, address, website, contact, use case, description, 2 to 5 sample messages and how people opt in, with an example for each.
Texts from US numbers are blocked until the registration is approved. You get an email when it is approved or rejected, with the reason and what to change. Registration fees are passed through from the carrier at cost plus a small handling charge, shown on the pricing page.
Consent and opt-outs
You and your clients must have the consent the law requires before texting or calling anyone, including under the TCPA in the United States and CASL in Canada.
- STOP, STOPALL, UNSUBSCRIBE, CANCEL, END and QUIT opt a contact out of texts from that client account.
- START and UNSTOP opt them back in.
- HELP replies with the campaign's help message.
Sending to an opted-out contact fails with contact_opted_out.
Call recording
Recording is off unless a subaccount turns it on. It can play "This call may be recorded." to the caller first. Some states and provinces require the consent of everyone on the call; the agency and the client are responsible for the notice and consent the law requires.
Billing
Pay as you go
There are no plans, no free trial and no monthly minimum. Subaccounts, their teams and chat are free until their business is verified. Each verified business has a monthly price, and each number has its own. Nothing is free after that. Pricing is by verified business, not by user: a subaccount can have any number of teammates. Every agency gets the API and webhooks. Current fees and usage rates are on the pricing page.
Balance
Usage is paid from your agency's prepaid balance. Your card is saved the first time you activate a phone, with nothing charged then; auto-recharge adds money from it the first time calls or texts need it, and whenever the balance falls below a threshold you choose. Each top-up comes with a receipt.
When the balance is below $1.00, outbound calls and texts pause until you add money. Inbound calls and inbound texts always work. You get an email when the balance falls below $10.00.
What is charged
- Calls per started minute of connected time. A call that is not answered is not charged as a call. Voicemail is charged per minute of recording.
- Texts per segment, sent or received. Pictures are charged per message.
- Phones per activated phone per month, from the day it's activated. Texting registration is included.
- Numbers per number per month, from the day each one is bought.
- Carrier text surcharges as the carrier reports them on each text, plus a small handling charge.
Usage reports
The Usage page shows this month's usage by subaccount (calls, texts, phones and numbers) with a CSV download, so you can rebill each client. Billing, at the bottom left of the dashboard and only for the owner, shows the balance, a six month chart of spend by activity, charges, invoices, cards and top up.
Security
Signing in
Agency and client users sign in with Google, GitHub, an emailed link and code, or a password. A password sign-in asks for a 6-digit code sent by email. "Trust this device for 30 days" skips the code on that device. "Sign out everywhere" ends every session and forgets every trusted device.
Confirming sensitive actions
Creating API keys, adding webhook endpoints or revealing their secrets, changing the payment method, releasing numbers, closing a subaccount, transferring agency ownership and changing an email address all ask for a fresh code.
API key security
How a key is kept. A key is ap_live_ and 32 random characters, about 190 bits from a secure
random source. We keep only its SHA-256 hash and its first 12 characters, which tell keys apart
in the dashboard. Nobody at AgencyPhone can read a key, and neither can you after the moment it
is made: it is shown once. If you lose it, roll the key to get a new one. The hash is never
written to logs, request logs, audit records or events, and no person can read it from the
database.
Who can make one. Your agency's owners and admins, signed in with their code and with a code confirmed in the last 10 minutes. The same is asked to edit a key, roll it, unlock it or change its safety settings. Revoking asks for no code, since it only takes access away. Owners and admins get an email whenever a key is created or rolled.
Give it only what it needs. A key has a reach (the whole agency, every subaccount, or the subaccounts you pick) and permissions (None, Read or Write per area). Software that serves one client should get a key for that subaccount with the permissions it uses. See Authentication and Permissions.
Expiry. A key can expire in 30 days, 90 days or a year, or never. An expired key stops
working at once and answers 401 expired_api_key.
Rolling. Roll key, in a key's menu under Developers, API keys, makes a new key with the same name, reach, permissions, API version, MCP switch, daily limit and lock setting. The old key keeps working for the time you pick: not at all, 1 hour, 24 hours or 7 days. The new key's expiry is as long as the old key's was. Today's spend comes along, so rolling is no way around a daily limit.
Locks. A locked key is refused with 403 api_key_locked before anything else runs. Requests
already running when it locks finish. Unlike a revoked key, a locked key can be unlocked. A key
locks for one of two reasons.
Its daily spend limit. Optional, set when you make the key and editable later, in your balance's
currency. What counts is everything the key's requests were charged that day, in your agency's
time zone: texts, calls, emails, numbers. When the day's spend reaches the limit the key locks.
Close to the limit, the key's sending requests run one at a time: one that would run beside
another answers 429 spend_limit_busy with Retry-After: 1, so requests sent at the same moment
can't pass the limit together. The same answer comes the first time a key does something that
costs money in a new way (its first text, its first number) while another such request is
running, since we don't yet know what it costs. The day's spend ends under the limit plus the
cost of one request, as large as that kind of request has cost the key before. During a roll's
overlap the old key and the new one share one day's spend and one limit. Texts and calls an
automation sends later, after the key enrolled someone in it, are the automation's and don't
count.
One thing can't be held back: a call is charged when it ends, so calls placed under the limit
finish and are charged, and the key locks with the first charge that reaches the limit. The key
stays locked until someone unlocks it, unless you chose "Unlock automatically the next day".
Unlocking by hand lifts the limit for the rest of that day.
Something looked wrong. "Lock it if something looks wrong" is on for new keys and can be turned off per key. Keys made before 2026-11-26 have it off until you turn it on. The rules are few and narrow on purpose, since a false lock breaks working software:
| Rule | The key locks when |
|---|---|
forbidden_burst | 30 or more of its requests are refused with 403 in 10 minutes, across 4 or more different permissions |
new_locations | It is used from 3 or more countries it was never used from, within 60 minutes (a key at least 24 hours old that was used before). Or from 50 or more new addresses in 60 minutes, for a key at least 7 days old that used 5 or fewer in the 30 days before |
volume_surge | Its successful sending requests in 60 minutes reach the larger of 500 and 10 times its own busiest hour of the 14 days before (a key at least 7 days old) |
refused_destinations | 25 or more requests in 60 minutes are refused for an emergency number or a destination we don't allow, or 100 or more because the contact opted out, and those refusals are at least half of everything the key tried to send in that hour |
Each lock keeps which rule fired and the counts behind it, never a message, a phone number or a secret. The rules count only what happened after the last unlock, so unlocking doesn't lock again on the same evidence.
Alerts. When a key locks, your owners and admins get an email and a notification in the
dashboard, the agency Overview lists it under Errors, and api_key.locked goes to your webhook
endpoints that listen for every subaccount (api_key.unlocked when it is unlocked). At 80% of a
daily limit they get one warning email that day.
Unlocking. Under Developers, API keys, a locked key says Locked. Review shows why it locked and the evidence, and offers Unlock, Roll key and Revoke key. If the key may have leaked, roll it: the old secret stops at once and the new key starts unlocked, with the same permissions and limits.
Connected apps. An app that signed in (see Connect by signing in) has the same lock setting and daily limit, picked on the consent page and changed later under Developers, MCP server, Safety. A locked app says Locked there, with Review and Unlock. It has no secret to roll: revoke it and connect again.
Keep a key safe on your side. Store it as a secret on your server, never in a browser, an app or a repository. Use one key per piece of software, so you can roll or revoke one without touching the others. Give keys that send texts or place calls a daily limit.
Data retention
- Texts and call records: 2 years.
- Call recordings and voicemail: 1 year.
- Closed subaccounts: deleted after the 30-day closing period, except records the law requires us to keep.
Limits
| Limit | Value |
|---|---|
| API requests per key | 20 per second |
| Texts sent per subaccount | 1 per second, bursts of 10 |
| Page size | Up to 100 items |
Page size with expand | Up to 25 items |
| Request body | 1 MB |
| Idempotency window | 24 hours |
| Webhook response time | 10 seconds |
| Webhook retries | Up to about 2 days |
| Signed audio URLs | 10 minutes |
| Calls placed through the API | 60 an hour per subaccount, 3 a day to one number |
| Emails sent | 100 in 24 hours per subaccount |
Events kept for GET /events | 30 days |
| Request log | 30 days |
| Voicemail length | 3 minutes |
| Ring timeout | 10 to 60 seconds |
| Countries | United States and Canada |
Changelog
Every change to the API, by date. A version is the date of a change that could break software written against the one before; see Versioning.
2026-11-26
No new version: an addition.
- Connect by signing in. The MCP server has an OAuth 2.1 door, so Claude, ChatGPT and other clients that sign in connect from the address alone, with no key. An owner or admin picks what the app reaches and what it can do, and revokes it under Developers, MCP server, Connections. API keys work over MCP exactly as before. See Connect by signing in.
- Key safety. A key or a connected app can have a daily spend limit and can lock itself when
it is used in a way that looks wrong. A locked key answers 403
api_key_lockeduntil an owner or admin unlocks it; near its limit, sends that would run at the same moment answer 429spend_limit_busy. Two new events,api_key.lockedandapi_key.unlocked, belong to the agency, so theiraccountis null. New keys have the lock on; keys made before today are unchanged until you turn it on. See API key security. - Rolling keeps everything. A rolled key now also keeps its API version, its MCP switch and its safety settings, and gets the old key's whole lifetime again. Before, a rolled key moved to the newest API version and lost its MCP switch.
2026-11-25
The first version, 2026-11-25. Everything from before still works as it did.
Platform
- Every response carries
Request-IdandAgencyPhone-Version. Errors addrequest_idanddoc_url. - Versions: a key is pinned to the version current when it was made, and
AgencyPhone-Versionon a request picks another. accounton every object that belongs to a subaccount, in webhook envelopes, and as a filter on every list.client_account_idstays.expandreturns referenced objects in the same response. A list withexpandtakes alimitof 25 at most.- Every
POSTtakes anIdempotency-Key. metadataon contacts, texts, calls, emails, appointments and opportunities.- A request body over 1 MB answers 413
body_too_large. - What belongs to the agency (the balance, the ledger, verifying a business, an AI agent's usage)
takes a key that reaches the whole agency: 403
agency_reach_requiredotherwise. - An unknown path answers 404
unknown_endpoint, and a known path with another method 405method_not_allowedwithAllow. - The request log keeps each request for 30 days with its ID, duration, source and, for a refusal, why. It is under Developers, Logs.
- The reference's endpoint tables are written from the same table the API runs on.
New endpoints
- Events:
GET /eventsandGET /events/{id}, to catch up after downtime. - Subaccounts: setup, business hours, the business profile and verifying it.
- Numbers: one number, searching, buying and releasing, call steps and ring groups.
- Team: members with presence, each person's hours, invitations and the join code.
- Contacts: tags, metadata, the
email,tagandqfilters, opting a contact out, and notes. - Texts: one conversation, and metadata on a text.
- Calls: placing a call for a teammate, hanging up, metadata, transcripts, what an AI agent did, one voicemail with its transcript, and call backs.
- Email: sending, emails, threads and the inbox.
- Appointments: creating, changing and archiving meeting types.
- Pipelines: creating, changing and archiving pipelines and their stages.
- Automations: the graph on one automation, and turning one on and off.
- AI agents: agents with their config document, pausing, numbers, activity, usage, general knowledge and knowledge bases.
- The app: Home cards, pinned action items and bins.
- Usage: the ledger.
New events
call.started.email.received,email.sent,email.deliveredandemail.bounced.number.purchasedandnumber.released.- Send test sends any event type an endpoint listens for.
New scopes
calls:write,emails:read,emails:write,numbers:buy,numbers:routing,team:read,team:write,team:invite,agents:read,agents:write,profiles:read,profiles:write,app:read,app:write,settings:writeandevents:read.- Keys made before keep exactly the scopes they had.
MCP server
- The API as 63 tools for an AI model at
https://www.agencyphone.com/api/mcp, with the key's own permissions: 60 curated andlist_endpoints,api_readandapi_writefor the rest. A key is turned on for it under Developers, MCP server.
Still to come
Left out of this version on purpose, in plain words:
- Picture texts and group texts through the API.
- Files: email attachments, files in knowledge bases, uploads to bins and pictures on Home cards. Each needs an upload step.
- Writing an automation's graph, and reading an automation's history.
- Taking over a chat from an AI agent, and answering a question an agent asked the team.
- Subaccount groups, marking conversations read, the monthly AI spend cap and appointment attendees.
- Porting a number in, and paid storage sizes.
Not planned: an AI agent placing a call, playing a recorded message into a call, billing (cards, adding funds, auto-recharge), API keys and webhook endpoints through the API, your agency's staff and settings, the team's private chats, and deleting contacts, calls or texts.

