> For a complete page index, fetch https://developer.close.com/llms.txt # Update a phone number PUT https://api.close.com/api/v1/phone_number/{id}/ Content-Type: application/json You need the "Manage Team Phone Numbers" permission to change most settings. If you're the only member of a number, you can change its `label`, voicemail greeting, and call forwarding without that permission. You can: - Change the `label` of the number. - Set up call forwarding via `forward_to` and `forward_to_enabled`. - Set up a voicemail greeting by including a URL of an mp3 recording in `voicemail_greeting_url`. We require the URL to be secure (i.e. starting with https://). - Modify which users are members of the number via `participants`. This should be a list of user IDs. - Modify which Groups are assigned to the number via `participant_groups`. This should be a list of Group IDs from the Groups API. - Modify which external phone numbers the number dials via `phone_numbers`. This should be a list of phone numbers in E.164 international format, e.g. "+16503334444". - Change how long (in seconds, 15-90) the number rings on inbound calls before moving on (e.g. to voicemail) via `inbound_ring_duration`. Reference: https://developer.close.com/api/resources/phone-numbers/update ## Authentication - `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty. - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `id` (string, required) ### Body (application/json) This endpoint expects an UpdatePhoneNumber. - `forward_to` (string, optional) - `forward_to_enabled` (boolean, optional) - `inbound_ring_duration` (integer, optional) — Number of seconds (15-90) to ring this number on inbound calls before moving on (e.g. to voicemail). - `label` (string, optional) - `participant_groups` (list of string, optional) - `participants` (list of string, optional) - `phone_numbers` (list of string, optional) - `press_1_to_accept` (boolean, optional) - `voicemail_greeting_url` (string, optional, nullable) ## Response ### 200 Successful response - `address_id` (string, required, nullable) - `bundle_id` (string, required, nullable) - `carrier` (enum, required, nullable) - Allowed values: `twilio`, `plivo` - `carrier_type` (enum, required, nullable) - Allowed values: `local`, `national`, `mobile`, `tollfree`, `shortcode` - `country` (string, required, nullable) - `date_created` (datetime, required) - `date_updated` (datetime, required) - `id` (string, required) - `is_premium` (boolean, required) - `is_verified` (boolean, required) - `label` (string, required) - `last_billed_price` (double, required, nullable) - `mms_enabled` (boolean, required) - `next_billing_on` (datetime, required, nullable) - `number` (string, required) - `number_formatted` (string, required) - `organization_id` (string, required) - `participant_groups` (list of string, required) — IDs of the Groups assigned to this phone number. See the Groups API. - `sms_enabled` (boolean, required) - `supports_mms_to_countries` (list of string, required) - `supports_sms_to_countries` (list of string, required) - `type` (enum, required) - Allowed values: `internal`, `external`, `virtual` - `is_group_number` (boolean, required, deprecated) — This field is deprecated and will be removed in a future update. Until then, it is set to `false` when the phone number has exactly one member (as defined by the `participants` field) and doesn't have any of the "shared" configuration set up (e.g. a phone menu, lead-based routing, a non-default ring order, etc.), and `true` otherwise. - `user_id` (string, required, nullable, deprecated) — This field is deprecated. See the `participants` field instead to learn who's assigned to this phone number. This `user_id` field will be removed in a future update. Until then, it is set to a specific user ID *only if* the given phone number has a single participant and no additional "shared" configuration (e.g. a phone menu, lead-based routing, a non-default ring order, etc.). - `forward_to` (string, optional, nullable) - `forward_to_enabled` (boolean, optional) - `forward_to_formatted` (string, optional, nullable) - `inbound_ring_duration` (integer, optional, nullable) — Number of seconds we ring this number on inbound calls before moving on (e.g. to voicemail). `null` means the default of 30 seconds is used. - `participants` (list of string, optional) — Every member of the phone number, as user IDs. If this field is absent, see `user_id` for the sole member. - `phone_numbers` (list of string, optional) — Present unless the phone number has exactly one member and no shared-number configuration (a phone menu, lead-based routing, a dial-out list, or a non-default ring order). - `phone_numbers_formatted` (list of string, optional) — Present under the same condition as `phone_numbers`, with each value formatted for display. - `press_1_to_accept` (boolean, optional) - `voicemail_greeting_url` (string, optional, nullable) - `was_ported` (boolean, optional) ## Errors ### 400 Bad Request Error Bad request - `any` ### 401 Unauthorized Error Unauthorized - `any` ### 404 Not Found Error Not found - `any` ## Examples **Request** ```json { "forward_to": "+16502221111", "forward_to_enabled": true, "inbound_ring_duration": 45, "label": "My number w/ forwarding", "voicemail_greeting_url": "https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3" } ``` **Response** ```json { "address_id": null, "bundle_id": null, "carrier": null, "carrier_type": null, "country": "US", "date_created": "2016-07-18T22:54:24.787000+00:00", "date_updated": "2016-07-22T22:55:55.938000+00:00", "id": "phon_asdjkfev50ZKOqTVndOFN4effzv99vDvpDxrks9XLU3", "is_premium": false, "is_verified": true, "label": "My number w/ forwarding", "last_billed_price": null, "mms_enabled": true, "next_billing_on": null, "number": "+16503335555", "number_formatted": "+1 650-333-5555", "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH", "participant_groups": [], "sms_enabled": true, "supports_mms_to_countries": [ "CA", "US" ], "supports_sms_to_countries": [ "CA", "US" ], "type": "internal", "is_group_number": false, "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA", "forward_to": "+16502221111", "forward_to_enabled": true, "forward_to_formatted": "+1 650-222-1111", "inbound_ring_duration": 45, "press_1_to_accept": false, "voicemail_greeting_url": "https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3" } ``` **SDK Code** ```python phone_numbers_update_example import requests url = "https://api.close.com/api/v1/phone_number/id/" payload = { "forward_to": "+16502221111", "forward_to_enabled": True, "inbound_ring_duration": 45, "label": "My number w/ forwarding", "voicemail_greeting_url": "https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3" } headers = { "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript phone_numbers_update_example const url = 'https://api.close.com/api/v1/phone_number/id/'; const credentials = btoa(":"); const options = { method: 'PUT', headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'}, body: '{"forward_to":"+16502221111","forward_to_enabled":true,"inbound_ring_duration":45,"label":"My number w/ forwarding","voicemail_greeting_url":"https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go phone_numbers_update_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.close.com/api/v1/phone_number/id/" payload := strings.NewReader("{\n \"forward_to\": \"+16502221111\",\n \"forward_to_enabled\": true,\n \"inbound_ring_duration\": 45,\n \"label\": \"My number w/ forwarding\",\n \"voicemail_greeting_url\": \"https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3\"\n}") req, _ := http.NewRequest("PUT", url, payload) req.SetBasicAuth("", "") 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_update_example require 'uri' require 'net/http' url = URI("https://api.close.com/api/v1/phone_number/id/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{\n \"forward_to\": \"+16502221111\",\n \"forward_to_enabled\": true,\n \"inbound_ring_duration\": 45,\n \"label\": \"My number w/ forwarding\",\n \"voicemail_greeting_url\": \"https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3\"\n}" response = http.request(request) puts response.read_body ``` ```java phone_numbers_update_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api.close.com/api/v1/phone_number/id/") .basicAuth("", "") .header("Content-Type", "application/json") .body("{\n \"forward_to\": \"+16502221111\",\n \"forward_to_enabled\": true,\n \"inbound_ring_duration\": 45,\n \"label\": \"My number w/ forwarding\",\n \"voicemail_greeting_url\": \"https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3\"\n}") .asString(); ``` ```php phone_numbers_update_example request('PUT', 'https://api.close.com/api/v1/phone_number/id/', [ 'body' => '{ "forward_to": "+16502221111", "forward_to_enabled": true, "inbound_ring_duration": 45, "label": "My number w/ forwarding", "voicemail_greeting_url": "https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3" }', 'headers' => [ 'Content-Type' => 'application/json', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp phone_numbers_update_example using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://api.close.com/api/v1/phone_number/id/"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.PUT); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"forward_to\": \"+16502221111\",\n \"forward_to_enabled\": true,\n \"inbound_ring_duration\": 45,\n \"label\": \"My number w/ forwarding\",\n \"voicemail_greeting_url\": \"https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ```