/twilio-accountsValidate a Twilio Account SID/Auth Token pair against Twilio, then store it encrypted for outbound dial and inbound webhook verification.
Register Twilio Account
Validates the supplied account_sid and auth_token against Twilio, then persists the credentials and returns the new record. The auth_token is write-only and never appears in any response or log line. account_sid accepts mixed-case hex on input and is canonicalised to lowercase before storage. Per-account rate limit: 5 registrations per 60 seconds. Active accounts are hard-capped at 32 per account. The same Twilio Account SID cannot be claimed by two accounts at the same time.
Request body
3account_sidstringrequiredTwilio Account SID; literal
ACfollowed by exactly 32 hexadecimal characters. Case-insensitive on input; canonicalised to lowercase before storage. Total length must be 34 characters.auth_tokenstringrequiredTwilio Auth Token (1–128 chars). Write-only: validated against Twilio at registration, stored encrypted at rest, and never returned in any response body.
friendly_namestringoptionalHuman-readable label rendered in the developer portal (max 255 chars). Plain text only; control characters and HTML markup are rejected.
Errors
8account_sid is not literal AC followed by exactly 32 hex characters, or auth_token / friendly_name violate their length or content rules.
Copy the Account SID exactly from the Twilio console; trim whitespace; keep friendly_name to plain text under 255 chars.
Twilio responded with an authorisation error; bad Auth Token, revoked token, or the token does not authorise access to the supplied SID.
Re-copy the Auth Token from the Twilio console, and confirm both values come from the same Twilio account.
The supplied account_sid does not exist on Twilio. Typically a typo or a deleted account.
Re-paste the Account SID from the Twilio console; do not retype it by hand.
This account already has an active row for the same account_sid.
Keep using the existing registration, or DELETE /twilio-accounts/{account_id} first and then re-register.
A different account already holds an active row for this account_sid.
Have the previous owner release the SID via DELETE /twilio-accounts/{account_id}, or open a support ticket.
Your account already has 32 active Twilio accounts.
Release an unused account via DELETE /twilio-accounts/{account_id} before registering a new one.
More than 5 POST /twilio-accounts calls from this account in the last 60 seconds.
Wait the number of seconds in Retry-After, then retry. If you legitimately need to register many accounts, do so serially with a short delay.
Twilio did not respond within the validation deadline, or returned a 5xx.
Retry shortly. If Twilio is reporting an incident, wait until it clears.
