Overview
The Twilio CLI lets you manage Twilio resources, send messages, configure webhooks, and deploy serverless functions directly from the terminal. AI coding agents can use CLI commands to provision resources and test integrations without writing application code.
Install:
Update: brew upgrade twilio / scoop update twilio-cli / npm install -g twilio-cli@latest
Authentication & Profiles
Credential priority: explicit -p/--account-sid flag > env vars (TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN) > active profile.
Phone Numbers
Send SMS
Send Email (SendGrid)
Requires SENDGRID_API_KEY environment variable.
Webhook Development
Local development: The CLI rejects localhost URLs directly. Tunneling services such as ngrok are not bundled with twilio-cli. install one separately, then set the public tunnel URL as your webhook.
** ngrok is NOT included in the CLI — install separately: npm install -g ngrok or via https://ngrok.com
- Start tunnel: ngrok http 3000, then use the provided URL for webhook
configuration
Debugging & Monitoring
Serverless Deployment
Plugins
Regional & Edge Routing
Supported: au1/sydney, ie1/dublin, jp1/tokyo. Each region uses a different Auth Token from your US1 credentials. Find yours in the Twilio Console under API keys & tokens, selecting your target region.
Configuration
Config stored at ~/.twilio-cli/config.json.
Syntax notes:
- Commands use spaces by default, using colon also works:
twilio api core messages create=twilio api:core:messages:create twilio [COMMAND] --helpfor any command's options- Multi-line: use
\for line continuation
CANNOT
- Default list limit is 50 records — always pass
--limitfor larger result sets. - API timeout is 30 seconds — long-running operations may fail silently.
- Cannot use localhost URLs for webhooks — use a tunneling service, such as ngrok, installed separately.
- No autocomplete on Windows — only bash/zsh supported.
- ** ngrok is not bundled with twilio-cli**, install separately
- Cannot send Twilio Email (comms API) via CLI —
twilio email:senduses SendGrid only. For Twilio Email, use the REST API directly.
Next Steps
- Account setup and API keys:
twilio-account-setup,twilio-iam-auth-setup - Webhook architecture and signature validation:
twilio-webhook-architecture - Debugging and observability:
twilio-debugging-observability - Send SMS via API/SDK:
twilio-send-message - SendGrid email setup:
twilio-sendgrid-account-setup

