> 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 Group Phone Numbers" permission to update a group number. You can only update your own personal numbers.

You can:

- Change a `label` of your 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 team members are part of a group number via `participants`. This should be a list of user IDs.
- Modify which external phone numbers are part of a group number via `phone_numbers`. This should be a list of phone numbers in E.164 international format, e.g. "+16503334444".

Reference: https://developer.close.com/api/resources/phone-numbers/update

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /phone_number/{id}/:
    put:
      operationId: update
      summary: Update a phone number
      description: >-
        You need the "Manage Group Phone Numbers" permission to update a group
        number. You can only update your own personal numbers.


        You can:


        - Change a `label` of your 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 team members are part of a group number via
        `participants`. This should be a list of user IDs.

        - Modify which external phone numbers are part of a group number via
        `phone_numbers`. This should be a list of phone numbers in E.164
        international format, e.g. "+16503334444".
      tags:
        - subpackage_phoneNumbers
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Use your API key as the username and leave the password empty.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumber'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePhoneNumber'
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    UpdatePhoneNumber:
      type: object
      properties:
        forward_to:
          type: string
        forward_to_enabled:
          type: boolean
        label:
          type: string
        participants:
          type: array
          items:
            type: string
        phone_numbers:
          type: array
          items:
            type: string
        press_1_to_accept:
          type: boolean
        voicemail_greeting_url:
          type:
            - string
            - 'null'
      title: UpdatePhoneNumber
    UnderlyingCarrier:
      type: string
      enum:
        - twilio
        - plivo
      title: UnderlyingCarrier
    CarrierNumberType:
      type: string
      enum:
        - local
        - national
        - mobile
        - tollfree
        - shortcode
      title: CarrierNumberType
    PhoneNumberType:
      type: string
      enum:
        - internal
        - external
        - virtual
      title: PhoneNumberType
    PhoneNumber:
      type: object
      properties:
        address_id:
          type:
            - string
            - 'null'
        bundle_id:
          type:
            - string
            - 'null'
        carrier:
          oneOf:
            - $ref: '#/components/schemas/UnderlyingCarrier'
            - type: 'null'
        carrier_type:
          oneOf:
            - $ref: '#/components/schemas/CarrierNumberType'
            - type: 'null'
        country:
          type:
            - string
            - 'null'
        date_created:
          type: string
          format: date-time
        date_updated:
          type: string
          format: date-time
        forward_to:
          type:
            - string
            - 'null'
        forward_to_enabled:
          type: boolean
        forward_to_formatted:
          type:
            - string
            - 'null'
        id:
          type: string
        is_group_number:
          type: boolean
        is_premium:
          type: boolean
        is_verified:
          type: boolean
        label:
          type: string
        last_billed_price:
          type:
            - number
            - 'null'
          format: double
        mms_enabled:
          type: boolean
        next_billing_on:
          type:
            - string
            - 'null'
          format: date-time
        number:
          type: string
        number_formatted:
          type: string
        organization_id:
          type: string
        participants:
          type: array
          items:
            type: string
        phone_numbers:
          type: array
          items:
            type: string
        phone_numbers_formatted:
          type: array
          items:
            type: string
        press_1_to_accept:
          type: boolean
        sms_enabled:
          type: boolean
        supports_mms_to_countries:
          type: array
          items:
            type: string
        supports_sms_to_countries:
          type: array
          items:
            type: string
        type:
          $ref: '#/components/schemas/PhoneNumberType'
        user_id:
          type:
            - string
            - 'null'
        voicemail_greeting_url:
          type:
            - string
            - 'null'
        was_ported:
          type: boolean
      required:
        - address_id
        - bundle_id
        - carrier
        - carrier_type
        - country
        - date_created
        - date_updated
        - id
        - is_group_number
        - is_premium
        - is_verified
        - label
        - last_billed_price
        - mms_enabled
        - next_billing_on
        - number
        - number_formatted
        - organization_id
        - sms_enabled
        - supports_mms_to_countries
        - supports_sms_to_countries
        - type
        - user_id
      title: PhoneNumber
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
      description: Use your API key as the username and leave the password empty.
    OAuth2:
      type: http
      scheme: bearer

```

## SDK Code Examples

```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,
    "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=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript phone_numbers_update_example
const url = 'https://api.close.com/api/v1/phone_number/id/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'PUT',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"forward_to":"+16502221111","forward_to_enabled":true,"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  \"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("<CLOSE_API_KEY>", "")
	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("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"forward_to\": \"+16502221111\",\n  \"forward_to_enabled\": true,\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<String> response = Unirest.put("https://api.close.com/api/v1/phone_number/id/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"forward_to\": \"+16502221111\",\n  \"forward_to_enabled\": true,\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
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.close.com/api/v1/phone_number/id/', [
  'body' => '{
  "forward_to": "+16502221111",
  "forward_to_enabled": true,
  "label": "My number w/ forwarding",
  "voicemail_greeting_url": "https://s3.amazonaws.com/bucket/aaa-bbb-ccc.mp3"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

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("<CLOSE_API_KEY>", "");
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  \"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);
```