Overview
Add a phone number to your workspace that can be used for outbound calling campaigns or inbound call handling. The system supports multiple integrations including Plivo, Twilio, and Telnyx. Credentials are validated before the number is saved, and webhooks are automatically configured for the selected integration.
Prerequisites
- Bearer token for authenticated workspace access
- Valid phone number credentials for your chosen integration provider
- Phone number must be owned by your integration account
Request
Bearer token for the authenticated workspace account.
ID of the user who will own this phone number.
Phone number with country code (e.g., “12125551234”). The + prefix is optional. Must be owned by your integration account.
Integration provider for this phone number. Choose one of: plivo, twilio, or telnyx.
Authentication token for your integration provider account. For Plivo, this is the Auth Token. For Twilio, this is the Auth Token. For Telnyx, this is the API Key.
Account identifier for your integration provider. For Plivo, this is the Auth ID. For Twilio, this is the Account SID. For Telnyx, this is the App ID (automatically configured).
curl --location '{{baseUrl}}/api/call/add-phone' \
--header 'Authorization: Bearer {{authToken}}' \
--header 'Content-Type: application/json' \
--data '{
"userId": "64e5f12345abcdef12345678",
"phoneNumber": "12125551234",
"integration": "twilio",
"authToken": "your_auth_token",
"accSId": "your_account_sid"
}'
Response
{
"message": "Phone number added successfully",
"status": true,
"code": 201,
"errorMessage": "",
"data": {
"_id": "64e5f12345abcdef87654321",
"userId": "64e5f12345abcdef12345678",
"phoneNumber": "12125551234",
"integration": "twilio",
"createdAt": "2025-05-15T10:30:00.000Z"
}
}
Phone number record that was created.
Unique identifier for the phone number record.
Phone number that was added (with country code).
Integration provider used for this number.
Error Handling
- 400 Bad Request – Invalid User ID format, phone number already exists for this user, or invalid credentials for the integration provider.
- 404 Not Found – User not found with the provided
userId.
- 500 Internal Server Error – Failed to set up integration webhooks or other server errors.
Integration-Specific Behavior:
- Plivo: Validates Auth ID and Auth Token, then creates or reuses a Plivo application for webhook configuration.
- Twilio: Validates Account SID, Auth Token, and phone number ownership, then configures webhooks for the number.
- Telnyx: Validates API Key and phone number, then automatically configures webhooks.
All integrations automatically set up webhook endpoints to receive call status updates and recordings.
Phone numbers must be unique per user. If you attempt to add a number that already exists for the user, the request will fail with a 400 error.
Bearer token authentication for workspace access
Example:"64e5f12345abcdef12345678"
Available options:
plivo,
twilio,
telnyx
Phone number added successfully