Igor_70
08/28/2025, 6:47 PMChiranjeet Mishra
08/31/2025, 9:14 PMjavascript
let phoneNumber = "+11231231234";
let shortNumber = phoneNumber.startsWith("+1") ? phoneNumber.substring(2) : phoneNumber;
// Make the API call with shortNumber
This code checks if the phone number starts with "+1" and removes it, providing you the short number to use in your query. Adjust this logic in your application where you prepare the phone number for the API call.Tay
09/01/2025, 6:15 PMIgor_70
09/02/2025, 3:02 PMIgor_70
09/02/2025, 3:04 PMTay
09/02/2025, 6:15 PMChiranjeet Mishra
09/03/2025, 9:55 PMpython
from vapi import Vapi
client = Vapi(token="YOUR_TOKEN")
phone_number = client.phone_numbers.get(id="phone-number-id")
[Retrieve API Details](https://docs.vapi.ai/api-reference/phone-numbers/get)
2. **Process Number Data**: Extract the number string and programmatically remove the country code +1, assuming all numbers you handle are in this format.
python
def strip_country_code(phone_number):
if phone_number.startswith('+1'):
return phone_number[2:]
return phone_number
short_number = strip_country_code(phone_number["number"])
This will give you the phone number without the +1 prefix, allowing you to handle or store it as needed. Ensure your solution adheres to any format requirements that might be specific to your integration or application logic.