AgencyPhone 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

  1. Your agency signs up and creates a subaccount for each business you serve. That's free.
  2. You activate the subaccount's phone: a local number, or their existing one brought over.
  3. Your client's team installs the AgencyPhone app and enters your activation code. From then on the app shows your brand.
  4. Calls ring on every teammate's phone and in the browser. Texts, voicemail and missed calls arrive with push notifications.
  5. Your software uses the same number through the API and webhooks.

Who uses what

WhoWhereWhat they do
Your agency teamAgency dashboard on the webCreate subaccounts, buy numbers, file texting registration, set up the client app, manage billing, API keys and webhooks, chat with clients
Your client's teamMobile app and web appCall, text, listen to voicemail, manage contacts, chat with your agency
Your softwareAPI, webhooks and MCP serverSend 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

  1. 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.
  2. 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.
  3. Create a subaccount for the business you serve, from the switcher in the top left. It costs nothing to make.
  4. 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.
  5. 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.
  6. 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.
  7. 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."
  1. 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.

ActionOwnerAdminMember
Billing and payment methodYesNoNo
API keys and webhooksYesYesNo
Client apps and agency teamYesYesNo
Create or close subaccountsYesYesNo
Buy, assign and release numbersYesYesNo
Texting registrationYesYesYes
Chat with clientsYesYesYes
Open a client's inbox for supportYesYesNo

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.

  1. 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.
  2. 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"
  1. Read the request ID. The Request-Id header, 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.
  2. 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.

  1. Subscribe a webhook endpoint to call.missed.
  2. 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, or first_name and last_name; email; message), nested ones too, like contact.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 (also consent or opt_in) set to true, yes or on records that they agreed to texts, with the exact consent_text they 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:

  1. Create an API key restricted to that subaccount with messages:read and messages:write.
  2. On message.received, read the conversation with GET /messages?conversation_id=..., generate a reply and send it with POST /messages.
  3. Every reply your agent sends is labeled "Sent by API" in the app.
  4. When message.sent arrives with data.source set to app, 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.completed carries the direction, the number, who answered and the duration.
  • call.missed marks a missed call.
  • voicemail.created includes a signed audio URL. Download it within 10 minutes, or fetch a fresh URL later with GET /voicemails/{id}.
  • call.started marks the start of a call, and GET /calls/{id}/transcript returns 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.

  1. Give a key calls:write, calls:read and team:read, for that subaccount.
  2. Find who can take the call: GET /members?account=ca_... and pick someone whose can_take_calls is true.
  3. Place it with POST /calls: account, to and teammate, 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
  1. Follow it with webhooks. call.started arrives when the call begins, and call.completed when it ends after connecting, with who answered, the duration and your metadata. A call the customer didn't pick up ends without call.completed: read GET /calls/{id} for a status of no_answer, busy, canceled or failed.
  2. If the business records calls, read GET /calls/{id}/transcript a little after the call ends. It answers 404 transcript_not_ready until then.
  3. 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.

  1. Give a key emails:read and emails:write.
  2. Read the inbox with GET /accounts/{id}/inbox: its address, whether sending_paused is true, and sent_today against daily_limit.
  3. Start a thread with POST /emails: account, to, subject and text. Keep the thread_id it answers with.
  4. Listen for email.delivered and email.bounced. An address that bounced is never emailed again, so mark it in your software too.
  5. When the customer answers, email.received arrives with the email and its thread_id. Reply in the same conversation with POST /emails and thread.

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.

  1. Create the subaccount with POST /accounts: name and timezone. Keep its ID, ca_....
  2. Ask what is next with GET /accounts/{id}/setup. Its next names the next step and the request that does it. Come back to it after every step.
  3. 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's needs lists what is still missing. Never guess these; ask your client.
  4. Verify the business with POST /accounts/{id}/profile/verify and accept_monthly_charge: true. The price in the profile's verification is taken from your balance now and every month. 402 balance_too_low says how much to add under Billing.
  5. Search for a number with GET /numbers/available: account and an area_code. Each result has its monthly price.
  6. Buy it with POST /numbers. It becomes active within minutes; number.purchased tells you when.
  7. Invite the team with POST /invitations, one person at a time. With via set to link you get the join code to pass on yourself.
  8. Check setup until live. GET /accounts/{id}/setup turns live to 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.

  1. Give a key agents:read, agents:write and numbers:routing.
  2. Read an agent you already built in the dashboard with GET /agents/{id} and keep its config as your template.
  3. Create one with POST /agents: account and the config, 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.
  4. Teach it with POST /knowledge, one fact a line, and give it longer material with POST /knowledge-bases and POST /knowledge-bases/{id}/sources.
  5. Check ready_for_calls on GET /agents/{id}. not_ready says what is missing, such as the business's hours or someone to pass calls to.
  6. Put it on a number with POST /agents/{id}/numbers. From then on it answers that number's calls after the steps before it.
  7. Watch what it does with GET /agents/{id}/events and the agent.action and call.summarized events, and what it costs with GET /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/v1

Requests 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 reachesWhat that means
The whole agencyEvery subaccount, ones you add later too, and the agency's own actions
Every subaccountEvery subaccount, ones you add later too, with none of the agency's own actions
Specific subaccountsOnly 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.

AreaReadWrite
Subaccountsaccounts:readaccounts:write, and accounts:close when checked
Numbersnumbers:readnumbers:write, numbers:buy, numbers:routing
Usage and balanceusage:read
Contactscontacts:readcontacts:write
Textsmessages:readmessages:write
Calls and voicemailcalls:readcalls:write
Emailemails:reademails:write
Appointmentsappointments:readappointments:write
Pipelinesopportunities:readopportunities:write
Automationsautomations:readautomations:write
Action itemsaction_items:readaction_items:write
Widgetswidgets:readwidgets:write
Data tablesdata:readdata:write
Notificationsnotifications:readnotifications:write
Teamteam:readteam:write, team:invite
Setupsettings:write
AI agentsagents:readagents:write
Business profilesprofiles:readprofiles:write
App and storageapp:readapp:write
Eventsevents:read
ScopeAllows
accounts:readList and get subaccounts, their setup and their business hours
accounts:writeCreate and rename subaccounts, and pause and resume them
accounts:closeClose and reopen subaccounts. Closing stops calls and texts and starts a 30-day wait
numbers:readList numbers, their call steps and ring groups
numbers:writeChange a number's label
numbers:buySearch for numbers, buy one for a subaccount and release one
numbers:routingSet a number's call steps and ring groups and put an AI agent on a number
usage:readCalls, minutes, texts and spend by subaccount, the agency's balance and its ledger
contacts:readList contacts, their notes and tags
contacts:writeCreate and update contacts, their tags and notes, and opt a contact out
messages:readList conversations and texts
messages:writeSend texts
calls:readList calls, voicemail, transcripts and call backs, with signed audio URLs
calls:writeRing someone on a business's team and connect them to a customer, and hang up a call the API placed
emails:readList a business's email threads and emails, and read its inbox
emails:writeSend email from a business's inbox and move threads
notifications:readList notifications
notifications:writeSend notifications to a business's team
appointments:readList appointments, meeting types and open times
appointments:writeBook, change and cancel appointments
action_items:readList and get action items and their templates
action_items:writePut action items on a business's Home, change them and finish them
widgets:readRead what a business's widgets show from your software
widgets:writeSet what widgets show: text, numbers, pictures and links
data:readRead a business's data tables and their rows
data:writeAdd rows to data tables and change them
opportunities:readRead a business's pipelines, their stages and the opportunities in them
opportunities:writeAdd opportunities, move them between stages and close them
automations:readList a business's automations, what starts them and whether they're on
automations:writeStart an automation for a contact and take someone out of one
team:readList a business's team with who is online, its invitations and each person's hours
team:writeTake people off a business's team and change each person's hours
team:inviteInvite someone to a business's team as a member, and cancel an invitation
agents:readRead a business's AI agents, what they know, what they did and what they cost
agents:writeCreate, change, pause and resume AI agents, and change what they know
profiles:readRead business profiles, their verification and what each still needs
profiles:writeChange business profiles and send them for verification
app:readRead a business's Home cards and its storage bins
app:writeChange a business's Home cards and pinned action items, and create and close storage bins
settings:writeChange business hours, meeting types, pipelines and their stages, and turn automations on and off
events:readList 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.

PrefixObjectPrefixObject
ca_A subaccountagn_An AI agent
num_A numberaev_A line of an agent's feed
ct_A contactagt_An agent's call settings
note_A note on a contactact_What an agent did on a call
cv_A conversation by textkn_A line of general knowledge
msg_A textkb_A knowledge base
call_A callks_A knowledge source
vm_A voicemailmem_A team member
tr_A call's transcriptinv_An invitation
cb_A call backrg_A ring group
em_An emailbp_A business profile
eth_An email threadhc_A Home card
apt_An appointmentbin_A storage bin
mt_A meeting typele_A ledger entry
opp_An opportunitytbl_A data table
pl_A pipelinerow_A row of a data table
pst_A pipeline stagentf_A notification
aut_An automationchm_A chat message
enr_An automation enrollmentevt_An event
ai_An action itemag_Your agency
ait_An action item templatereq_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.

StatusTypeWhen
400invalid_requestA parameter is missing or invalid; param names it
401authentication_errorThe key is missing, wrong, revoked or expired
402invalid_requestThe agency's balance can't cover it
403permission_errorThe key lacks the scope, or the action needs a key that reaches the agency
404not_foundThe object or endpoint does not exist, or the key cannot see it
405invalid_requestThe path exists but not with this method; the Allow header lists the methods
409invalid_requestThe request is valid but the state of things refuses it, such as already done
409idempotency_errorA problem with the idempotency key
413invalid_requestThe request body is over 1 MB
422invalid_requestThe request is valid but cannot be done, such as a text to an opted-out contact
429rate_limitedToo many requests, or a daily limit was reached
500api_errorSomething failed on our side; retry with the same idempotency key
502api_errorThe 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:

CodeStatusWhat to do
parameter_missing400Add the parameter param names
invalid_parameter400Fix the parameter param names; the message says how
invalid_body400Send the body as a JSON object or form-encoded fields
invalid_version400Use an API version from Versioning
metadata_limit400An object holds 20 metadata keys at most; remove one first
confirmation_required400The action needs its confirming parameter, such as confirm to release a number
missing_api_key401Send the key as Authorization: Bearer ...
invalid_api_key401Check that you copied the whole key
revoked_api_key401Create a new key under Developers
expired_api_key401Use the key that replaced it, or create a new one
balance_too_low402Add funds under Billing, then retry. The message says how much. A text answers 422 with this code
missing_scope403Give the key the permission the message names, or use another key
agency_reach_required403Use a key that reaches the whole agency
api_key_locked403An owner or admin unlocks it under Developers; see API key security
resource_missing404Check the ID and the key's subaccounts
unknown_endpoint404Check the path against All endpoints
method_not_allowed405Use a method from the response's Allow header
body_too_large413Send a request body of 1 MB or less
idempotency_key_reused409Use a new idempotency key for a new request
idempotency_in_progress409The first request is still running; retry in a moment
idempotency_replayed409It already succeeded and its response held a secret; read the object instead
contact_opted_out422The contact has Do not disturb on; don't text or call them
account_suspended422The subaccount or your agency isn't active
number_not_textable422The number's texting registration isn't approved yet
not_enabled422Calling and texting aren't open for your agency yet
rate_limited429Wait for Retry-After seconds, then retry
spend_limit_busy429The key is near its daily spend limit, so its sends run one at a time; retry after Retry-After
daily_limit429A daily cap was reached; the message says which and when to try again
internal_error500Retry with the same idempotency key; tell us the request_id if it keeps failing
provider_error502The 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: 1

Pagination

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.

NameFills inScope needed
accountThe subaccount, in accountaccounts:read
contactThe contact for contact_idcontacts:read
conversationThe conversation for conversation_idmessages:read
messageThe text for message_idmessages:read
numberThe number for number_idnumbers:read
callThe call for call_idcalls:read
appointmentThe appointment for appointment_idappointments:read
opportunityThe opportunity for opportunity_idopportunities:read
automationThe automation for automation_idautomations:read
agentThe AI agent for agent_idagents:read
threadThe email thread for thread_idemails:read
memberThe team member for member_idteam: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_scope before anything runs: a text is never sent and then refused for its expand.
  • One level deep: an expanded object's own references stay IDs.
  • On a list, every item is expanded, and limit is 25 at most with expand (400, param limit).
  • 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:

WhatLimit
Texts and notifications1 per second per subaccount, bursts of up to 10
Calls placed60 an hour per subaccount and 3 a day to one number
Email100 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 bought10 in one request and 20 a day per agency through the API
Invitations20 a day per subaccount and 100 a day per agency through the API
Bins50 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):

RequestWhat it does
POST /accountsCreates 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}/pausePauses 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}/resumeTurns a paused subaccount back on
POST /accounts/{id}/closeCloses it and starts the 30 days (scope accounts:close). Calls and texts stop at once
POST /accounts/{id}/reopenBrings 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.

CodeStatusWhen
profile_incomplete422Details are missing; the message names the first, and needs lists them all
confirmation_required400accept_monthly_charge wasn't true
balance_too_low402The balance can't cover the price; the message says how much to add
agency_reach_required403Verifying starts a charge to your agency, so it takes a key that reaches the whole agency
already_verified409It is verified already; nothing is charged
profile_locked409The details are with the carriers or approved, so they can't change
account_closing409The 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.

CodeStatusWhen
business_not_verified409Verify the business before buying
balance_too_low402The balance can't cover the first month; the message says how much
number_unavailable409Someone else took the number first; search again
daily_limit429The API buys at most 20 numbers a day for an agency
confirmation_required400confirm is missing or isn't the number
number_porting409The 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.

CodeStatusWhen
already_member409The person is on the team already
seat_limit422The team is at its limit of people
role_not_allowed422role was anything but member
daily_limit429More than 20 invitations a day for a subaccount, or 100 a day for your agency, through the API
email_not_sent503The email couldn't be sent; retry

Contacts

  • GET /contacts (scope contacts:read): filter with account, phone, email, tag or q, part of a name, an email address or a phone number.
  • POST /contacts (scope contacts:write): account, phone, and optionally name, email, company, notes, tags and metadata. One contact per number per subaccount.
  • GET /contacts/{id} (scope contacts:read): one contact.
  • PATCH /contacts/{id} (scope contacts:write): any of name, email, company, notes, tags, metadata and do_not_disturb. Send null to 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 (scope contacts:read): newest first, each with its author, a person, an agent or api.
  • POST /contacts/{id}/notes (scope contacts:write): text, one fact of 3 to 300 characters, marked as written by the key.
  • PATCH /notes/{id} and DELETE /notes/{id} (scope contacts: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:

ParameterRequiredDescription
fromYesOne of your numbers, on a subaccount the key can reach
toYesA US or Canadian number
textYesThe text to send, up to 1,600 characters
metadataNoYour 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:

CodeStatusWhen
unknown_number400from isn't one of your numbers on a subaccount the key reaches
number_not_textable422The number's texting registration isn't approved yet
contact_opted_out422The contact has Do not disturb on
balance_too_low422Your agency's balance can't cover the text
account_suspended422The subaccount or your agency isn't active
agency_number422Texts between your own numbers aren't allowed; use Chat to reach your agency's team
sending_rate_limited429More than 1 text a second for the subaccount, past its burst of 10
provider_error502The 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.

ParameterRequiredDescription
accountYesThe subaccount the call is for
toYesThe customer's number in E.164, a United States or Canadian area code
teammateYesWho takes the call: a member's ID (mem_) or their email. They must be on the subaccount's own team
fromNoThe subaccount's number to call from, its ID or the number. Needed when it has more than one
metadataNoYour 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:

CodeStatusThe rule
emergency_number4229-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_allowed422Only United States and Canadian area codes. Other +1 countries are refused, since that is where toll fraud goes
contact_opted_out422The contact has Do not disturb on
number_blocked422The number is on the business's blocked list
agency_number422The number is one of AgencyPhone's own; calls between your numbers aren't placed
outside_calling_hours422Calls 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_ready422The teammate hasn't opened the app yet, or hasn't accepted its 9-1-1 notice
number_unavailable422The subaccount has no active number that can place calls
rate_limited429More than 60 calls an hour for the subaccount, or the teammate is calling too fast
daily_limit429More than 3 calls a day to one number, or a new business's daily limit
balance_too_low402The balance can't cover the call
account_suspended422The subaccount or your agency isn't active
not_enabled422Calling isn't open for your agency yet
resource_missing404teammate isn't on this subaccount's team, or from isn't one of its active numbers
parameter_missing400The 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:

  1. Automated calls are turned on: by the agency's owner under Settings, then for the subaccount under Agents, Outbound.
  2. The business is verified, and one of its own admins confirmed its details in their app.
  3. You've texted with the person: at least 10 texts, 3 of them from the person.
  4. Someone on the team has spoken with them on a call that connected.
  5. Your first text or call with them was more than 14 days ago.
  6. 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
}

Email

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 (scope emails:read): filter with account, thread or direction. GET /emails/{id} gets one, and PATCH /emails/{id} changes its metadata.
  • GET /email-threads (scope emails:read): conversations by email, the one with the newest email first. Filter with account, folder (inbox, archive or spam) or with, the other person's address. GET /email-threads/{id} gets one.
  • PATCH /email-threads/{id} (scope emails:write): moves a thread to another folder, 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:

CodeStatusThe rule
address_suppressed422The address bounced or marked an email as spam, so it is never emailed again
sending_paused403Too 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_limit429More than 100 emails in 24 hours from one subaccount, from anywhere
agency_daily_limit429More than 1,000 emails through the API in 24 hours across your agency
new_subaccount_limit429More than 25 through the API in 24 hours from a subaccount made in the last 7 days
balance_too_low402The balance can't cover an email past the included ones
no_inbox409The subaccount has no inbox to send from yet
parameter_conflict400thread 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:

ParameterRequiredDescription
client_account_idYesThe subaccount whose team gets it
textYesUp 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:

ParameterRequiredDescription
client_account_idYesThe subaccount
dateYesYYYY-MM-DD in the subaccount's timezone
duration_minutesNoHow 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=60

Response

{
  "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:

ParameterRequiredDescription
client_account_idYesThe subaccount
titleYesWhat it is, up to 120 characters, for example Estimate
starts_atYesISO 8601 with a timezone or Z
ends_atNoOr send duration_minutes; 60 minutes by default, up to 7 days
duration_minutesNoUsed when ends_at is left out
customer_nameNoShown when the number isn't a contact yet
customer_phoneNoE.164; the team calls and texts it in one tap
locationNoUp to 300 characters
notesNoUp to 2,000 characters
assigned_to_emailNoThe email someone on the team signs in with; leave out for anyone
only_if_openNotrue 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: only name is needed. The rest starts as an in person hour, in the subaccount's own hours, with anyone free on the team. Send duration_minutes, kind, hours, books_with and hosts to set them.
  • PATCH /meeting-types/{id}: changes only what is sent. hours replaces the whole week and hosts the members it's with. Its booking link stays the same.
  • POST /meeting-types/{id}/archive and POST /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:

ParameterRequiredDescription
client_account_idYesThe subaccount
template_idNoStart from one of your templates (GET /action-item-templates); anything you send wins
contact_id or phoneNoWho it's about; a new phone is added to the business's contacts, with name
listNoInstead of one contact: each tap picks the next contact matching tags, created_within_minutes, not_called, not_texted, newest or oldest first
titleYes*Up to 120 characters once filled in (*unless the template has one)
bodyNoUp to 500 characters
detailsNoUp to 8 { "label", "value" } rows shown in the item
tapNoWhat tapping does: { "type": "call" }, text (with a message), contact, conversation, book, link (with a url), outcome, or menu (the default)
stepsNoA menu's steps: up to 5 { "label", "action", "main" }
outcomesNoUp to 5 names, each up to 40 characters
requires_outcomeNotrue hides Done, so someone always says how it went
due_at or due_in_minutesNoShown in the app, amber once overdue
expires_at or expires_in_minutesNoIt goes away on its own after this
assigned_to_emailNoSomeone on the team; leave out for everyone
external_idNoYour CRM's ID for it, up to 200 characters
dataNoYour own JSON, up to 4 KB, never shown in the app
notifyNoPush the person it's for, or the team; true by default
dry_runNotrue 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:

KindUsed byValue
textA title or a line of textA string, up to 40 characters for a title and 120 for text
numberA numberA whole number from 0; the widget shows up to 99+
pictureA pictureAn https:// address, or { "url", "described_as" }
linkA button or a tapAn 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, name and stages, the stages' names in order. A subaccount can have up to 10 pipelines that aren't archived (422 pipeline_limit), each with up to 20 stages.
  • PATCH /pipelines/{id}: renames it, or replaces its stages. Send every stage it should have, in order, with id for the ones it keeps and no id for new ones. A stage left out is deleted, which is refused while opportunities are in it (409 stage_in_use).
  • POST /pipelines/{id}/archive: it leaves the team's board and takes no new opportunities. A subaccount keeps at least one pipeline (409 last_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.json

agent.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.

CodeStatusWhen
invalid_config422The document doesn't fit; the message says where
invalid_reference422A name in the document isn't the subaccount's own person, group, meeting type or knowledge base
agent_not_ready409The change would leave an agent that answers calls not ready; the message says what is missing
grants_not_available422Which connections and data tables an agent may use can't change through the API; send them as they are
agency_reach_required403A changed calls part needs a key that reaches the whole agency
agent_limit409The 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}/pause and POST /agents/{id}/resume (scope agents:write): a paused agent answers nothing until it is resumed.
  • POST /agents/{id}/numbers (scope numbers:routing): send number, 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 (409 agent_not_ready) and the number can't already have 5 steps (409 number_full).
  • DELETE /agents/{id}/numbers/{number} (scope numbers:routing): takes the agent off the number. A number left with no step gets Voicemail.
  • GET /agents/{id}/events (scope agents:read): the agent's feed, newest first: what it answered, booked, asked the team, learned and so on.
  • GET /agents/{id}/usage (scope agents: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. Send month as YYYY-MM for 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_... (scope agents:read): newest first. Send agent for the lines one agent uses.
  • POST /knowledge (scope agents:write): account and text, one fact of up to 500 characters, for every agent of the subaccount or the ones named in agents.
  • PATCH /knowledge/{id} and DELETE /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-bases and GET /knowledge-bases/{id} (scope agents:read): a subaccount's bases with account, or every base the key reaches. Your agency's own bases, usable by every subaccount, have account set to null and show only to a key that reaches the whole agency.
  • POST /knowledge-bases, PATCH /knowledge-bases/{id} and DELETE /knowledge-bases/{id} (scope agents:write): create, rename and delete. A subaccount keeps up to 20 (409 knowledge_base_limit).
  • GET /knowledge-bases/{id}/sources, POST /knowledge-bases/{id}/sources and DELETE /knowledge-sources/{id}: a source is an answer (title is the question, text the answer), a page (title and text) or a website (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 (409 knowledge_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:

KindWhat it is
linkA title and an https url
noteA title with a body
actionA pinned action item. It stays on Home unless dismissible is true, and may carry an https url
agency_chatThe 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 /bins and GET /bins/{id} (scope app:read): bins newest first, each with its files counted and its url. Filter with account.
  • POST /bins (scope app:write): name, days (1, 7 or 30, how long it stays open), access (upload, download or both, as both) and optionally account and code. With code true a 4-digit code is made and returned once in the response, which is never kept for idempotency. Without account the bin is your agency's own and the key must reach the whole agency.
  • POST /bins/{id}/close (scope app: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.

ParameterDescription
accountOnly events of this subaccount
typeOnly events of this type, for example message.received
orderdesc, the default, is newest first. asc is oldest first
starting_afterThe ID of the last event you received
limit1 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.

EventsScope the key also needs
message.*messages:read
call.*, voicemail.created, agent.action, callback.*calls:read
email.*emails:read
contact.opted_outcontacts:read
email.receivedAn email arrived in a business's inbox. Never fires for spam
email.sentAn email was sent from a business's inbox, from the apps or the API; data.source says which
email.deliveredThe receiving mail server accepted an email
email.bouncedAn email bounced or was marked as spam; that address won't be emailed again
number.purchasedA number became active for a subaccount
number.releasedA 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_updateddata:read
chat.message.receivednotifications:read
widget.picture_failedwidgets:read
api_key.locked, api_key.unlockedusage: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=100

Keep 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

EndpointWhat it doesPermissionMCP tool
GET /eventsList eventsevents:readlist_events
GET /events/{id}Get an eventevents:read

Accounts

EndpointWhat it doesPermissionMCP tool
GET /accountsList subaccountsaccounts:readlist_accounts
POST /accountsCreate a subaccountaccounts:writecreate_account
GET /accounts/{id}Get a subaccountaccounts:read
PATCH /accounts/{id}Rename a subaccount or change its timezoneaccounts:write
POST /accounts/{id}/pausePause a subaccount: calls and texts stop until it is resumedaccounts:writepause_account
POST /accounts/{id}/resumeResume a paused subaccountaccounts:writeresume_account
POST /accounts/{id}/closeClose a subaccount; it can be reopened for 30 daysaccounts:close
POST /accounts/{id}/reopenReopen a closing subaccountaccounts:close
GET /accounts/{id}/widget-valuesEvery key a subaccount's widgets use, with what each shows nowwidgets:read
PATCH /accounts/{id}/widget-valuesSet what a subaccount's widgets show by key: text, a number, a picture or a link. Merges; null clears a key. Takes an idempotency keywidgets:write
GET /accounts/{id}/dataA subaccount's data tables, with their columnsdata:read
GET /accounts/{id}/data/{table}A data table's rows, oldest firstdata:read
POST /accounts/{id}/data/{table}Add a row to a data tabledata:write
PATCH /accounts/{id}/data/{table}/{row}Change a row's values. Merges; null clears a valuedata:write
GET /accounts/{id}/meeting-typesA subaccount's meeting types, in its order, with their booking linksappointments:readlist_meeting_types

Usage

EndpointWhat it doesPermissionMCP tool
GET /usageA month of usage and spend by subaccountusage:readget_usage
GET /ledgerList the agency's ledgerusage:read, agency key

Balance

EndpointWhat it doesPermissionMCP tool
GET /balanceYour agency's balanceusage:read, agency keyget_balance

Numbers

EndpointWhat it doesPermissionMCP tool
PATCH /numbers/{id}Change a number's labelnumbers:write
GET /numbersList numbersnumbers:readlist_numbers
GET /numbers/availableSearch numbers to buynumbers:buysearch_available_numbers
POST /numbersBuy numbersnumbers:buybuy_number
GET /numbers/{id}Get a numbernumbers:read
DELETE /numbers/{id}Release a numbernumbers:buyrelease_number
GET /numbers/{id}/call-stepsGet a number's call stepsnumbers:read
PUT /numbers/{id}/call-stepsSet a number's call stepsnumbers:routing
GET /ring-groupsList ring groupsnumbers:read
PUT /accounts/{id}/ring-groupsSave ring groupsnumbers:routing

Contacts

EndpointWhat it doesPermissionMCP tool
GET /contactsList contactscontacts:readlist_contacts
POST /contactsCreate a contactcontacts:writecreate_contact
GET /contacts/{id}Get a contactcontacts:readget_contact
PATCH /contacts/{id}Update a contactcontacts:writeupdate_contact
GET /contacts/{id}/notesList a contact's notescontacts:readlist_contact_notes
POST /contacts/{id}/notesAdd a note to a contactcontacts:writeadd_contact_note
PATCH /notes/{id}Update a notecontacts:write
DELETE /notes/{id}Delete a notecontacts:write
GET /tagsList a subaccount's tagscontacts:read

Conversations

EndpointWhat it doesPermissionMCP tool
GET /conversationsList conversationsmessages:readlist_conversations

Messages

EndpointWhat it doesPermissionMCP tool
GET /messagesList messagesmessages:readlist_messages
POST /messagesSend a textmessages:writesend_text
GET /messages/{id}Get a messagemessages:read
GET /conversations/{id}Get a conversationmessages:readget_conversation
PATCH /messages/{id}Update a text's metadatamessages:write

Calls

EndpointWhat it doesPermissionMCP tool
GET /callsList callscalls:readlist_calls
GET /calls/{id}Get a call, with a signed recording URLcalls:readget_call
POST /callsPlace a call for a teammatecalls:writeplace_call
PATCH /calls/{id}Set a call's metadatacalls:write
POST /calls/{id}/hangupHang up a call the API placedcalls:writehang_up_call
GET /calls/{id}/transcriptGet a call's transcriptcalls:readget_call_transcript
GET /calls/{id}/actionsList what an AI agent did on a callcalls:read

Voicemails

EndpointWhat it doesPermissionMCP tool
GET /voicemailsList voicemailscalls:readlist_voicemails
GET /voicemails/{id}Get a voicemail, with a signed audio URLcalls:read

Notifications

EndpointWhat it doesPermissionMCP tool
GET /notificationsList notificationsnotifications:read
POST /notificationsSend a notification to a business's teamnotifications:writesend_notification

Appointments

EndpointWhat it doesPermissionMCP tool
GET /appointmentsList appointments, earliest firstappointments:readlist_appointments
POST /appointmentsBook an appointmentappointments:writebook_appointment
GET /appointments/{id}Get an appointmentappointments:read
PATCH /appointments/{id}Change an appointmentappointments:writeupdate_appointment
POST /appointments/{id}/cancelCancel an appointmentappointments:writecancel_appointment
POST /accounts/{id}/meeting-typesCreate a meeting typesettings:write
PATCH /meeting-types/{id}Update a meeting typesettings:write
POST /meeting-types/{id}/archiveArchive a meeting typesettings:write
POST /meeting-types/{id}/unarchiveUnarchive a meeting typesettings:write

Availability

EndpointWhat it doesPermissionMCP tool
GET /availabilityOpen times on a dayappointments:readcheck_availability

Pipelines

EndpointWhat it doesPermissionMCP tool
GET /pipelinesList a business's pipelines, with their stagesopportunities:readlist_pipelines
POST /pipelinesCreate a pipelinesettings:write
PATCH /pipelines/{id}Update a pipelinesettings:write
POST /pipelines/{id}/archiveArchive a pipelinesettings:write

Opportunities

EndpointWhat it doesPermissionMCP tool
GET /opportunitiesList opportunities, the latest to move firstopportunities:readlist_opportunities
POST /opportunitiesAdd an opportunity to a pipelineopportunities:writecreate_opportunity
GET /opportunities/{id}Get an opportunityopportunities:read
PATCH /opportunities/{id}Move, close, rename or revalue an opportunityopportunities:writemove_opportunity

Automations

EndpointWhat it doesPermissionMCP tool
GET /automationsList a business's automations, the newest firstautomations:readlist_automations
GET /automations/{id}Get an automationautomations:read
POST /automations/{id}/enrollmentsStart an automation for a contact, whatever starts it in the dashboardautomations:writeadd_to_automation
DELETE /automations/{id}/enrollments/{contact}Take a contact out of an automation: its runs for them stopautomations:write
POST /automations/{id}/enableTurn an automation onsettings:write
POST /automations/{id}/disableTurn an automation offsettings:write

Action items

EndpointWhat it doesPermissionMCP tool
GET /action-itemsList action items, newest firstaction_items:readlist_action_items
POST /action-itemsPut an action item on a business's Homeaction_items:writecreate_action_item
GET /action-items/{id}Get an action itemaction_items:read
PATCH /action-items/{id}Change an open action itemaction_items:write
POST /action-items/{id}/resolveFinish an action item: with an outcome, done, or dismissedaction_items:write

Action item templates

EndpointWhat it doesPermissionMCP tool
GET /action-item-templatesList action item templatesaction_items:read

Subaccounts

EndpointWhat it doesPermissionMCP tool
GET /accounts/{id}/setupGet a subaccount's setupaccounts:readget_setup
GET /accounts/{id}/hoursGet business hoursaccounts:read
PUT /accounts/{id}/hoursSet business hourssettings:write
GET /accounts/{id}/profileGet a business profileprofiles:readget_business_profile
PATCH /accounts/{id}/profileUpdate a business profileprofiles:writeupdate_business_profile
POST /accounts/{id}/profile/verifyVerify a businessprofiles:write, agency keyverify_business

Team

EndpointWhat it doesPermissionMCP tool
GET /membersList a subaccount's teamteam:readlist_members
GET /members/{id}Get a team memberteam:read
DELETE /members/{id}Remove someone from a teamteam:writeremove_member
GET /members/{id}/hoursGet a team member's hoursteam:read
PUT /members/{id}/hoursSet a team member's hoursteam:write
GET /invitationsList a subaccount's open invitationsteam:read
POST /invitationsInvite someone to a teamteam:inviteinvite_member
DELETE /invitations/{id}Cancel an invitationteam:invite

Call backs

EndpointWhat it doesPermissionMCP tool
GET /callbacksList call backscalls:read
GET /callbacks/{id}Get a call backcalls:read

Automated calls

EndpointWhat it doesPermissionMCP tool
POST /automated-callsPlace an automated callcalls:writeplace_automated_call
GET /automated-callsList automated callscalls:read
GET /automated-calls/checkCheck whether someone can get an automated callcalls:readcheck_automated_call
GET /automated-calls/{id}Get an automated callcalls:readget_automated_call

Email

EndpointWhat it doesPermissionMCP tool
GET /emailsList emailsemails:readlist_emails
POST /emailsSend an emailemails:writesend_email
GET /emails/{id}Get an emailemails:read
PATCH /emails/{id}Update an email's metadataemails:write
GET /email-threadsList email threadsemails:readlist_email_threads
GET /email-threads/{id}Get an email threademails:read
PATCH /email-threads/{id}Move an email threademails:write
GET /accounts/{id}/inboxGet a subaccount's inboxemails:read

AI agents

EndpointWhat it doesPermissionMCP tool
GET /agentsList AI agentsagents:readlist_agents
POST /agentsCreate an AI agentagents:write
GET /agents/{id}Get an AI agent with its configagents:readget_agent
PATCH /agents/{id}Replace an AI agent's configagents:write
POST /agents/{id}/pausePause an AI agentagents:writepause_agent
POST /agents/{id}/resumeResume a paused AI agentagents:writeresume_agent
GET /agents/{id}/eventsList an AI agent's activityagents:readlist_agent_activity
GET /agents/{id}/usageAn AI agent's charges for a monthagents:read, agency key
POST /agents/{id}/numbersPut an AI agent on a numbernumbers:routingput_agent_on_number
DELETE /agents/{id}/numbers/{number}Take an AI agent off a numbernumbers:routing

Knowledge

EndpointWhat it doesPermissionMCP tool
GET /knowledgeList general knowledgeagents:readlist_knowledge
POST /knowledgeAdd a line of general knowledgeagents:writeadd_knowledge
PATCH /knowledge/{id}Change a line of general knowledgeagents:write
DELETE /knowledge/{id}Remove a line of general knowledgeagents:write
GET /knowledge-basesList knowledge basesagents:read
POST /knowledge-basesCreate a knowledge baseagents:write
GET /knowledge-bases/{id}Get a knowledge baseagents:read
PATCH /knowledge-bases/{id}Rename a knowledge baseagents:write
DELETE /knowledge-bases/{id}Delete a knowledge baseagents:write
GET /knowledge-bases/{id}/sourcesList a knowledge base's sourcesagents:read
POST /knowledge-bases/{id}/sourcesAdd a source to a knowledge baseagents:write
DELETE /knowledge-sources/{id}Remove a source from its knowledge baseagents:write

App

EndpointWhat it doesPermissionMCP tool
GET /home-cardsList a subaccount's Home cardsapp:read
POST /home-cardsAdd a Home cardapp:write
PATCH /home-cards/{id}Change a Home cardapp:write
DELETE /home-cards/{id}Delete a Home cardapp:write
PUT /accounts/{id}/home-cards/orderOrder a subaccount's Home cardsapp:write
GET /binsList binsapp:read
POST /binsCreate a binapp:write
GET /bins/{id}Get a binapp:read
POST /bins/{id}/closeClose a binapp: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

EventWhen
message.receivedA text arrived on one of your numbers
message.sentA text was sent, from the app or the API; data.source says which
message.deliveredThe carrier confirmed delivery
message.failedThe text could not be delivered; data.error explains why
call.startedA call began: one that came in, or one placed from the app or the API
call.completedA call ended after connecting
call.missedAn inbound call was not answered
call.summarizedA call an AI agent answered has its summary and outcome, and its transcript when the business records calls
voicemail.createdA caller left a voicemail
contact.opted_outA contact replied STOP and will not receive texts
chat.message.receivedSomeone on a business's team wrote to your agency in the chat
appointment.createdAn appointment was booked, in the app or the API
appointment.updatedAn appointment's time or details changed
appointment.cancelledAn appointment was cancelled
subaccount.pausedA subaccount was paused, in the dashboard or the API
subaccount.resumedA paused subaccount was resumed
subaccount.closedA subaccount was closed and its 30 days began
subaccount.reopenedA closing subaccount was reopened
texting.pausedAgencyPhone paused a subaccount's texting after warning signs
texting.resumedA subaccount's texting was turned back on
action_item.createdAn action item was put on a business's Home
action_item.openedSomeone on the team opened an action item for the first time
action_item.contact_finishedOne contact on a list item was finished; data.finished_contact says who and how
action_item.resolvedAn action item was finished; data.outcome says how it went
widget.picture_failedA picture sent for a widget couldn't be used; data.picture_error says why
agent.actionThe 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_createdA 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_updatedA row in a business's data table changed
opportunity.createdAn opportunity was added to a pipeline, in the apps, by an automation or by the API; data.source says which
opportunity.stage_changedAn opportunity moved to another stage; data.previous_stage_id says where it was
opportunity.status_changedAn opportunity was won, lost, abandoned or opened again; data.previous_status says what it was
callback.createdAn 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.updatedA 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.completedAn automated call ended; data.outcome says how, data.key_pressed the key, and an agent's call carries data.summary
api_key.lockedAn 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.unlockedA 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/mcp

How 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_read and api_write. list_endpoints searches every endpoint by words, api_read calls any GET by its path, and api_write calls any other endpoint by method and path. api_write is listed only for a key that can change something.
  • Lists are short. List tools take limit and starting_after, and the result says has_more. account is 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:

ToolWhat it does
send_textSends a real text from the business's number, charged per segment
send_emailSends a real email from the business's inbox
place_callRings a teammate's app, then calls the customer; minutes are charged
send_notificationShows on the team's phones
invite_memberLets someone onto a team, where they read its texts and calls
buy_numberCharged to your agency every month
verify_businessTakes the verification price from your balance, now and every month
release_numberGives a number up for good
remove_memberTakes 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_read can never change anything, and api_write appears 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/mcp

ChatGPT

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. GET answers 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_name and redirect_uris), or register it with a POST to the registration_endpoint. Every client is public: no secret, S256 PKCE on every request.
  • Redirect addresses are https, or http on localhost, 127.0.0.1 or [::1] with any port. A custom scheme is refused.
  • Send resource with 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 POST to the revocation_endpoint with 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.

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:

RuleThe key locks when
forbidden_burst30 or more of its requests are refused with 403 in 10 minutes, across 4 or more different permissions
new_locationsIt 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_surgeIts 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_destinations25 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

LimitValue
API requests per key20 per second
Texts sent per subaccount1 per second, bursts of 10
Page sizeUp to 100 items
Page size with expandUp to 25 items
Request body1 MB
Idempotency window24 hours
Webhook response time10 seconds
Webhook retriesUp to about 2 days
Signed audio URLs10 minutes
Calls placed through the API60 an hour per subaccount, 3 a day to one number
Emails sent100 in 24 hours per subaccount
Events kept for GET /events30 days
Request log30 days
Voicemail length3 minutes
Ring timeout10 to 60 seconds
CountriesUnited 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_locked until an owner or admin unlocks it; near its limit, sends that would run at the same moment answer 429 spend_limit_busy. Two new events, api_key.locked and api_key.unlocked, belong to the agency, so their account is 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-Id and AgencyPhone-Version. Errors add request_id and doc_url.
  • Versions: a key is pinned to the version current when it was made, and AgencyPhone-Version on a request picks another.
  • account on every object that belongs to a subaccount, in webhook envelopes, and as a filter on every list. client_account_id stays.
  • expand returns referenced objects in the same response. A list with expand takes a limit of 25 at most.
  • Every POST takes an Idempotency-Key.
  • metadata on 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_required otherwise.
  • An unknown path answers 404 unknown_endpoint, and a known path with another method 405 method_not_allowed with Allow.
  • 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 /events and GET /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, tag and q filters, 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.delivered and email.bounced.
  • number.purchased and number.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:write and events: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 and list_endpoints, api_read and api_write for 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.