https://retellai.com/?utm_source=discord&utm_medium=seo logo
When importing a phone number via API (POST /impor...
# ❓・ai-evy-support
c
@AI Evy When importing a phone number via API (POST /import-phone-number), can we pass inbound_agent_id and outbound_agent_id in the same request? Or must agents be assigned after import? What is the exact format for termination_uri parameter? Is it the Twilio SIP trunk termination URI format?
a
Thanks for tagging me @Client Nexus. I'll look through relevant sources and get back to you shortly.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer Yes, you can pass both
inbound_agent_id
and
outbound_agent_id
in the same import request. [(1) ]() The Import Phone Number endpoint accepts these optional body parameters: -
inbound_agent_id
(string | null) - Unique id of agent to bind to the number for receiving inbound calls -
outbound_agent_id
(string | null) - Unique id of agent to bind to the number for conducting outbound calls Termination URI Format The
termination_uri
parameter uses the Twilio elastic SIP trunk termination URI format. Per the documentation: "The termination uri to uniquely identify your elastic SIP trunk. This is used for outbound calls. For Twilio elastic SIP trunks it always end with
.pstn.twilio.com
." Example format:
"someuri.pstn.twilio.com"
Example Request:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.import({
  phone_number: '+14157774444',
  termination_uri: 'someuri.pstn.twilio.com',
}) ;
console.log(phoneNumberResponse.inbound_agent_id) ;
You can also optionally include
sip_trunk_auth_username
and
sip_trunk_auth_password
if your SIP trunk requires authentication.
​ To learn more, see the sources I considered: [[1] Import Phone Number](https://docs.retellai.com/api-references/import-phone-number) ​