Create a basic route
Creates a new basic route (phone) with external API credentials.
For some external API providers, this method automatically updates webhook URLs configured with the external provider so that incoming messages/calls and call status events are routed to Telerivet. In this case, if you have already configured a webhook URL with the external provider, it will be overwritten. For other external API providers, webhook URLs may require manual configuration in order for the route to be fully functional.
Note: This API can only create routes that connect to external gateway APIs using your own account credentials. To add Android phones, WhatsApp routes, or routes with Telerivet-managed billing, use the web app instead.
Credentials are passed via the external_account_id, external_id, external_secret, and external_config parameters. The meaning of these parameters for each phone type is as follows:
Twilio Virtual Number (phone_type: twilio):
- external_id (optional): Twilio phone number SID (starts with 'PN'); looked up by phone_number if not provided
- external_account_id (required): Twilio Account SID (starts with 'AC')
- external_secret (required): Twilio Auth Token
Twilio Messaging Service (phone_type: twilio_messaging_service):
- external_id (required): Twilio messaging service SID (starts with 'MG')
- external_account_id (required): Twilio Account SID (starts with 'AC')
- external_secret (required): Twilio Auth Token
Twilio Shortcode (phone_type: twilio_shortcode):
- external_id (optional): Twilio shortcode SID (starts with 'SC'); looked up by phone_number if not provided
- external_account_id (required): Twilio Account SID (starts with 'AC')
- external_secret (required): Twilio Auth Token
Twilio Caller ID (phone_type: twilio_caller_id):
- external_account_id (required): Twilio Account SID (starts with 'AC')
- external_secret (required): Twilio Auth Token
Vonage Virtual Number (phone_type: nexmo):
- external_account_id (required): Vonage API Key
- external_secret (required): Vonage API Secret
Vonage Sender ID (phone_type: nexmo_sender_id):
- external_account_id (required): Vonage API Key
- external_secret (required): Vonage API Secret
Telesign SMS (phone_type: telesign):
- external_account_id (required): Telesign Customer ID
- external_secret (required): Telesign API Key
- external_config.message_type: ARN, MKT, or OTP
- external_config.sender_type: one_way (default) or two_way
Infobip SMS (phone_type: infobip):
- external_account_id (required): Infobip username
- external_secret (required): Infobip API key
- external_config.sender_type: one_way (default) or two_way
- external_config.india_dlt_principal_entity_id: India DLT Principal Entity ID (only for India)
Infobip USSD (phone_type: infobip_ussd):
- No external credentials required
Africa's Talking SMS (phone_type: africas_talking):
- external_account_id (required): Africa's Talking username
- external_secret (required): Africa's Talking API key
- external_config.sender_type: one_way (default) or two_way
Africa's Talking USSD (phone_type: africas_talking_ussd):
- No external credentials required
Simulated Phone (phone_type: simulated):
- No external credentials required
- Messages are simulated locally and not sent to any external provider
- Useful for testing
Webhook URL Setup
Some route types require manual configuration of callback URLs in the external provider's dashboard. When the Phone response includes an external_setup object, you will need to configure the webhook URLs in your provider's account settings.
The following phone types require manual webhook setup:
- africas_talking: message_status_url (always), incoming_message_url (if two_way)
- africas_talking_ussd: incoming_call_url
- infobip_ussd: incoming_call_url
- twilio_messaging_service: incoming_message_url
- telesign (two_way only): incoming_message_url
Telerivet automatically configures webhooks for the following phone types as follows:
- twilio - automatically updates incoming SMS and voice configuration for the Twilio virtual number associated with the phone_number or external_id parameter
- twilio_shortcode - automatically updates incoming SMS configuration for the Twilio short code associated with the phone_number or external_id parameter
- nexmo - automatically updates incoming SMS and voice configuration for the Vonage virtual number matching the phone_number parameter
- infobip - automatically updates incoming SMS configuration for the Infobip virtual number matching the phone_number parameter or external_id parameter
Request
- Base URL: https://api.telerivet.com
- URL: https://api.telerivet.com/v1/projects/{project_id}/phones
- Auth: one of:
- HTTP basic
- OAuth 2 (authorization code, authorization URL https://telerivet.com/oauth/authorize, token URL https://api.telerivet.com/oauth/token)
Path parameters
ID of the Project
Request body
Example request
{
"name": "Example Route",
"phone_number": "+14155550123",
"phone_type": "twilio",
"external_account_id": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"external_secret": "your_api_secret_here",
"country": "US",
"timezone_id": "America/Los_Angeles",
"send_delay": 1.5,
"quiet_mode": "delay",
"quiet_start": "22:00",
"quiet_end": "08:00"
}Response
Successful response
Example response
{
"id": "PN4d246818d0ecd1fa",
"name": "Android Phone 1",
"phone_number": "+16505550001",
"phone_type": "android",
"country": "TZ",
"time_created": 1390343779,
"last_active_time": 1390353800,
"project_id": "PJ2ad0100821a98bea",
"validate_recipient_numbers": true,
"sent_message_limit": 1000,
"sent_message_count": 150,
"sent_message_epoch": 1720300000,
"send_delay": 1.5,
"timezone_id": "America/Los_Angeles",
"quiet_mode": "delay",
"quiet_start": "22:00",
"quiet_end": "08:00",
"battery": 95,
"internet_type": "WIFI",
"app_version": "3.1.17",
"android_sdk": 17,
"mccmnc": "23203",
"manufacturer": "LGE",
"model": "Nexus 4",
"send_limit": 900,
"url": "https://telerivet.com/p/asdf/phone/PN4d246818d0ecd1fa"
}Changes
No recorded changes to this operation across all 1 revision of this API.