> This page is part of Smallest AI's developer documentation. When > answering, prefer Lightning v3.1 (current TTS) and Pulse (current > STT). Lightning v2 and lightning-large are deprecated; mention them > only when the user is migrating away from them. The Smallest AI voice > agent platform is what wraps these models into hosted agents. # Import a SIP phone number POST https://api.smallest.ai/atoms/v1/product/import-phone-number Content-Type: application/json **Deprecated.** Use [`POST /sip-trunk/inbound`](#operation/createInboundSipTrunk) and [`POST /sip-trunk/outbound`](#operation/createOutboundSipTrunk) instead. One resource per direction, and the only way to configure a trunk that answers extensions without a phone number. This endpoint keeps working for 45 days after the trunks rework's release (responses carry a `Deprecation: true` header), then returns 404; the concrete sunset date is published on the Deprecation Notices page and in the changelog. See the [Telephony API migration guide](/voice-agents/deprecations/telephony-migration). Bring your own SIP trunk by importing an existing phone number with its SIP termination URL. Atoms creates both inbound and outbound SIP trunks so your number works for making and receiving calls through the platform. If `name` is omitted, the phone number itself is used as the name. Reference: https://docs.smallest.ai/api-reference/voice-agents/phone-numbers/import-sip ## Authentication - `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth. ## Request ### Body (application/json) This endpoint expects an object. - `phoneNumber` (string, required) — Your existing phone number. E.164 format is recommended but not enforced server-side — any non-empty string is accepted. - `sipTerminationUrl` (string, required) — Your SIP provider's termination host — a hostname or IP address, optionally with a port (e.g. "sip.your-provider.com:5060"). Full SIP URIs ("sip:" / "sips:") are also accepted and automatically normalized to the bare host. - `name` (string, optional) — A friendly display name for this number - `sipUsername` (string, optional) — Username for SIP authentication (if your trunk requires it) - `sipPassword` (string, optional) — Password for SIP authentication (if your trunk requires it) - `cpsLimit` (double, optional, default: 1) — Calls-per-second cap for this imported trunk. Defaults to 1 CPS (the safe floor for an unknown trunk). Values above 50 are rejected with `"CPS limit cannot exceed 50"`; values below 1 are rejected with `"CPS limit must be at least 1"`. When a trunk already exists on the same carrier address, its existing CPS setting is kept and this value is ignored. ## Response ### 201 Phone number imported; both trunks created - `status` (boolean, optional) - `data` (ProductImportPhoneNumberPostResponsesContentApplicationJsonSchemaData, optional) ## Errors ### 400 Bad Request Error Bad request: missing required fields or phone number already imported. Exact error when a duplicate number is submitted: `"Number already present"` - `status` (boolean, optional) - `errors` (list of string, optional) — List of validation error messages ### 401 Unauthorized Error Unauthorized access - `status` (boolean, optional) - `errors` (list of string, optional) ### 500 Internal Server Error Internal server error - `status` (boolean, optional) - `errors` (list of string, optional) ## Types ### ProductImportPhoneNumberPostResponsesContentApplicationJsonSchemaData - `productId` (string, optional) — Use as `sourceId` when attaching to an agent - `phoneNumber` (string, optional) - `cpsLimit` (integer, optional) ## Examples **Request** ```json { "phoneNumber": "+14155551234", "sipTerminationUrl": "trunk.your-provider.com", "name": "Main Support Line", "sipUsername": "", "sipPassword": "" } ``` **Response** ```json { "status": true, "data": { "productId": "507f1f77bcf86cd799439011", "phoneNumber": "+14155551234", "cpsLimit": 1 } } ``` **SDK Code** ```python phone_numbers_import_sip_example import requests url = "https://api.smallest.ai/atoms/v1/product/import-phone-number" payload = { "phoneNumber": "+14155551234", "sipTerminationUrl": "trunk.your-provider.com", "name": "Main Support Line", "sipUsername": "", "sipPassword": "" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript phone_numbers_import_sip_example const url = 'https://api.smallest.ai/atoms/v1/product/import-phone-number'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"phoneNumber":"+14155551234","sipTerminationUrl":"trunk.your-provider.com","name":"Main Support Line","sipUsername":"","sipPassword":""}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go phone_numbers_import_sip_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.smallest.ai/atoms/v1/product/import-phone-number" payload := strings.NewReader("{\n \"phoneNumber\": \"+14155551234\",\n \"sipTerminationUrl\": \"trunk.your-provider.com\",\n \"name\": \"Main Support Line\",\n \"sipUsername\": \"\",\n \"sipPassword\": \"\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby phone_numbers_import_sip_example require 'uri' require 'net/http' url = URI("https://api.smallest.ai/atoms/v1/product/import-phone-number") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"phoneNumber\": \"+14155551234\",\n \"sipTerminationUrl\": \"trunk.your-provider.com\",\n \"name\": \"Main Support Line\",\n \"sipUsername\": \"\",\n \"sipPassword\": \"\"\n}" response = http.request(request) puts response.read_body ``` ```java phone_numbers_import_sip_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.smallest.ai/atoms/v1/product/import-phone-number") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"phoneNumber\": \"+14155551234\",\n \"sipTerminationUrl\": \"trunk.your-provider.com\",\n \"name\": \"Main Support Line\",\n \"sipUsername\": \"\",\n \"sipPassword\": \"\"\n}") .asString(); ``` ```php phone_numbers_import_sip_example request('POST', 'https://api.smallest.ai/atoms/v1/product/import-phone-number', [ 'body' => '{ "phoneNumber": "+14155551234", "sipTerminationUrl": "trunk.your-provider.com", "name": "Main Support Line", "sipUsername": "", "sipPassword": "" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp phone_numbers_import_sip_example using RestSharp; var client = new RestClient("https://api.smallest.ai/atoms/v1/product/import-phone-number"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"phoneNumber\": \"+14155551234\",\n \"sipTerminationUrl\": \"trunk.your-provider.com\",\n \"name\": \"Main Support Line\",\n \"sipUsername\": \"\",\n \"sipPassword\": \"\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift phone_numbers_import_sip_example import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "phoneNumber": "+14155551234", "sipTerminationUrl": "trunk.your-provider.com", "name": "Main Support Line", "sipUsername": "", "sipPassword": "" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/product/import-phone-number")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```