Failed to buy phone number
# support
d
Client error '400 Bad Request' for url 'https://api.vapi.ai/phone-number/buy' {"message":"Couldn't Buy Twilio Number. Error: No phone numbers found","error":"Bad Request","statusCode":400}
v
Hi @Darkhan, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Create Phone Call]() * [Import Twilio Number]() * [List Calls]() * [Get Call]() -----------------------------
### Answer The error message "Couldn't Buy Twilio Number. Error: No phone numbers found" indicates that there were no available phone numbers matching your criteria. Ensure that the
areaCode
provided in your request is valid and corresponds to an area with available phone numbers. Here is an example of a valid request:
Copy code
curl
curl --request POST \
--url https://api.vapi.ai/phone-number/buy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
  "areaCode": "415",
  "name": "My New Number",
  "assistantId": "assistant_123",
  "serverUrl": "https://myserver.com/handle",
  "serverUrlSecret": "mysecret"
}'
[(1)]() If the problem persists, you might need to try different area codes or check with Twilio if they have any restrictions or issues with number availability.
Got it. Tagging @User for additional help.
d
@User
s
can you try a different areaCode?
d
what to do if the customer wants this areaCode?
@Sahil
s
We can't do anything man we also purchase the number from Twilio if it is not available then we can't do anything! Well, you can always create a new Twilio account and purchase the number and then you can import it to Vapi.
2 Views