> 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. # Set a SIP trunk's CPS PATCH https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit Content-Type: application/json Sets the calls-per-second rate for one of your imported SIP trunks. The rate applies to **every number on that trunk** and takes effect within about a second, including for calls already queued. **Admin role required.** Set it to what your carrier actually allows: too high and the carrier rejects calls, too low and campaigns run slower than they need to. See the [Calls per second guide](/voice-agents/platform/create-agent/cps). Reference: https://docs.smallest.ai/api-reference/voice-agents/concurrency/update-custom-trunk-cps-limit ## 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. - `terminationUrl` (string, required) — The trunk's address as shown on the Concurrency page. Normalized the same way as at import, so `sip:` prefixes and URI parameters are ignored; a different port is a different trunk. - `cpsLimit` (integer, required) — Calls per second for every number on the trunk. Whole number from 1 to 50. ## Response ### 200 Rate applied - `status` (boolean, optional) - `data` (ProductCustomTrunkCpsLimitPatchResponsesContentApplicationJsonSchemaData, optional) ## Errors ### 400 Bad Request Error `cpsLimit` outside 1–50 or not a whole number, or `terminationUrl` missing - `status` (boolean, optional) - `errors` (list of string, optional) ### 401 Unauthorized Error Unauthorized access - `status` (boolean, optional) - `errors` (list of string, optional) ### 403 Forbidden Error Admin role required - `status` (boolean, optional) - `data` (ApiResponseData, optional) ### 404 Not Found Error Your organization has no SIP trunk at that address - `status` (boolean, optional) - `errors` (list of string, optional) ### 500 Internal Server Error Internal server error - `status` (boolean, optional) - `errors` (list of string, optional) ## Types ### ProductCustomTrunkCpsLimitPatchResponsesContentApplicationJsonSchemaData - `trunksUpdated` (integer, optional) — Number of SIP trunk records updated ### ApiResponseData ## Examples **Request** ```json { "terminationUrl": "43.205.53.11:5091", "cpsLimit": 2 } ``` **Response** ```json { "status": true, "data": { "trunksUpdated": 1 } } ``` **SDK Code** ```python import requests url = "https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit" payload = { "terminationUrl": "43.205.53.11:5091", "cpsLimit": 2 } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit'; const options = { method: 'PATCH', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"terminationUrl":"43.205.53.11:5091","cpsLimit":2}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit" payload := strings.NewReader("{\n \"terminationUrl\": \"43.205.53.11:5091\",\n \"cpsLimit\": 2\n}") req, _ := http.NewRequest("PATCH", 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 require 'uri' require 'net/http' url = URI("https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"terminationUrl\": \"43.205.53.11:5091\",\n \"cpsLimit\": 2\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"terminationUrl\": \"43.205.53.11:5091\",\n \"cpsLimit\": 2\n}") .asString(); ``` ```php request('PATCH', 'https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit', [ 'body' => '{ "terminationUrl": "43.205.53.11:5091", "cpsLimit": 2 }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"terminationUrl\": \"43.205.53.11:5091\",\n \"cpsLimit\": 2\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "terminationUrl": "43.205.53.11:5091", "cpsLimit": 2 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/product/custom-trunk/cps-limit")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" 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() ```