Twilio's REST surface in this collection centers on a small set of core entities and predictable identifier patterns. Accounts (SIDs starting with AC) are the top-level scope most operations require. Under an account you manage phone-related resources: Addresses (AD SIDs), Applications (AP SIDs), Calls (CA SIDs), and objects related to phone numbers and connect apps (CN, BY, etc.). Treat the Account SID as the primary scoping key: nearly every read, create, update, or delete operation for resources in this collection requires an AccountSid or an account Sid parameter.
Key entities and how they relate
- Accounts (
AC...) are the root scope. Subaccounts are ordinary Account resources created withCreateAccountand returned byListAccount. - Addresses (
AD...) live under an account and are used for emergency/regulatory compliance and associating location metadata with numbers. - Applications (
AP...) are lightweight handlers that encapsulate URLs/TwiML settings for voice and SMS; phone numbers and calls can reference anApplicationSidso Twilio invokes the stored behavior instead of using inlineUrl/Twimlfields. - Calls (
CA...) are created under an account and can reference anApplicationSid, aUrl, or inlineTwimlto drive call behavior. Calls may also reference BYOC trunks (BY...) and Connect Apps (CN...) in some parameters. - Available phone number searches are returned by country-specific list operations (local, mobile, toll-free, voip, etc.). These operations return
available_phone_numberscollections that you typically use as search input before purchasing a number (purchasing is a separate IncomingPhoneNumbers create operation, not listed here).
Understanding these relations prevents dead-ends: create or locate an AccountSid first, then list or create address/application/phone-number resources under that account, then create calls or associate numbers that reference those resource SIDs.
Identifier patterns that matter
These prefixes appear repeatedly and tell you what a value is without extra lookup:
AC...— Account SID (primary scope). Many operations accept either an explicitAccountSidpath parameter or an accountSidfor updates/fetches.AP...— Application SID. Pass this to calls to have the Application handle voice/SMS webhooks; when present many call parameters are ignored (see gotchas).AD...— Address SID.CA...— Call SID.CN...— Connect App SID (authorized connect apps).BY...— BYOC trunk SID.
If a user gives a plain phone number or a resource URL, extract the Account SID first (or call FetchAccount/ListAccount) so subsequent operations are scoped correctly.
Where to start (entry points)
Start by confirming which account to act on. Use one of these first depending on the user's intent:
- To act on the authenticated account or to confirm its properties, call
FetchAccount. The returnedSidandsubresource_urislet you scope follow-up calls. - To operate across subaccounts, call
ListAccountto enumerate child accounts and pick anAC...to use asAccountSid. - To check spendability or fund availability, call
FetchBalancewith anAccountSid. Note: child accounts do not contain balance info. - To search for phone numbers for purchase, call
ListAvailablePhoneNumberCountryfirst to discover the country code metadata, then call the appropriate country-specific number-list operation (ListAvailablePhoneNumberLocal,...Mobile,...TollFree,...Voip, etc.). Those list operations returnavailable_phone_numbersyou can present to a user.
Most follow-up operations require that AccountSid value; resolve it up front so you can pass it to CreateCall, CreateAddress, CreateApplication, and the other create/update/delete operations.
Common tasks and the minimal sequence of calls
Below are the typical workflows users ask for and the operations you will call, in order.
Make an outbound phone call
- Ensure you have an
AccountSid. If you need to confirm it, callFetchAccount. - Create the call with
CreateCall. Required inputs areToandFrom. Provide either anApplicationSidor aUrl/Twimlthat supplies TwiML for call handling. - Observe the returned call resource to get
Sid(CA...) and status. Deleting a call record usesDeleteCallbut note deletion removes the record from logs.
Notes about call parameters (non-obvious):
- If you pass
ApplicationSid, Twilio prefers the application’s stored settings and ignores several per-call URL parameters (for example,Method,FallbackUrl,FallbackMethod,StatusCallback,StatusCallbackEvent, andStatusCallbackMethodare ignored when an application is present). Use anApplicationSidwhen you want consistent behavior managed centrally; useUrl/Twimlfor one-off behavior. - If you supply both
UrlandTwiml, theTwimlparameter will be ignored — provide only the one you intend to be primary. SendDigitsand answering-machine detection interact: ifSendDigitsis provided,MachineDetectionwill be ignored. Specify only the behavior you expect.AsyncAmdcontrols whether answer‑machine detection runs in the background. By default AMD can block call flow; setAsyncAmdto run detection asynchronously when you do not want the call to wait for detection to finish.Byoc(aBY...SID) is only meaningful whenTois a phone number; it will be ignored for otherTotargets (SIP, client IDs).- Use
CallTokenonly when forwarding an incoming call and you want to preserve the original incoming caller details; acall_tokenis produced from an incoming call event and must be passed to the forwarded outgoing call.
Create and manage Applications
- Create an application with
CreateApplicationand identify it by the returnedSid(AP...) andFriendlyName. - List applications with
ListApplicationto find SIDs for reuse. Update withUpdateApplicationand remove withDeleteApplication. - Applications centralize webhook URLs for voice and SMS; reference an
ApplicationSidfrom calls or phone numbers to inherit those settings.
Manage Address resources (emergency/regulatory)
- Create addresses with
CreateAddress. Addresses require full postal fields plusIsoCountryand may needEmergencyEnabledfor emergency-address use cases. - List, fetch, update, and delete an address with
ListAddress,FetchAddress,UpdateAddress,DeleteAddressrespectively.
Address nuances to remember:
FriendlyNamelength differs by use: Regulatory Compliance addresses allow up to 64 characters; Emergency addresses only allow up to 32 characters. Pick the appropriate length based on whether the address will be used for emergency E911.AutoCorrectAddressdefaults to true; set it tofalseonly when you must preserve the exact submitted address.
Search available phone numbers
- Call
ListAvailablePhoneNumberCountryto get country-level metadata (and confirm supported types), then call the country-specific list operation for the type you need (Local,Mobile,TollFree,Voip,SharedCost,National, orMachineToMachine). - Those search endpoints return
available_phone_numbers. Use them to present options and then create an IncomingPhoneNumber resource to purchase (purchase/create is not included in this operation list but is the usual next step).
Account-level management
- Create a subaccount with
CreateAccountwhen a user asks to segregate resources or billing; list accounts withListAccountto find and act on subaccounts. - Update an account's
FriendlyNameorStatuswithUpdateAccountand fetch account details withFetchAccount. - Use
FetchBalancefor monetary info; remember child accounts do not have balance data.
Authorized Connect Apps
- List authorized connect apps with
ListAuthorizedConnectAppand fetch a specific connect app withFetchAuthorizedConnectAppusing theConnectAppSid(CN...). These are account-level and do not nest under other resources.
Non-obvious behaviors and gotchas
- Account-first mindset: almost every operation requires an account
Sid(AC...). If a user gives resource identifiers but no account, locate or confirm the accountSidbefore attempting create/update/delete calls. - Resource prefixes are meaningful: you can usually tell the resource type by its SID prefix and use that to route the next operation.
- Call parameter precedence and ignored fields: when an
ApplicationSidis present, per-call URL and callback parameters are ignored. When bothTwimlandUrlare given,Twimlis ignored. WhenSendDigitsis provided,MachineDetectionis ignored. These conflicts are the most common source of surprises when callers expect per-call overrides to take effect. - Balance visibility:
FetchBalancedoes not return balances for child/subaccounts. - Deleting call records:
DeleteCallpermanently removes a call record from the API/logs—do not delete if the user expects to retain historical logs. - Address
FriendlyNamelength differs by purpose (regulatory vs emergency); supply a shorter name for emergency addresses. - BYOC (
BY...) values andByocparameters are ignored unlessTois a PSTN phone number. - Answering-machine detection complexity:
MachineDetectionhas multiple modes and several tuning parameters (MachineDetectionTimeout, speech thresholds, silence thresholds). If you want immediateAnsweredByvalues prefer the appropriateMachineDetectionmode; if you want the call to proceed immediately and get detection results later, useAsyncAmdand a status callback.
What to look for in responses
- Resource creation responses include the new resource SID (e.g.,
AP...,AD...,CA...); capture that SID to perform updates, deletes, or further associations. - List responses return paginated envelopes with
first_page_uri,next_page_uri, and apage_sizefield. If you need more results than fit in a page, request subsequent pages using the list parameters. FetchAccountand other fetch operations return the canonical SIDs and subresource URIs that help navigate the account's resources.
Follow these patterns and you can reliably: choose the correct account scope, create or locate applications and addresses, search numbers, place calls with the behavior you expect, and manage the returned resources by their SIDs. When a user asks for an action that requires a resource SID you don't yet have, get or create the scoped resource first and use its SID in the next operation.