> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# Update E911 address

PUT https://%7BYour_Space_Name%7D.signalwire.com/api/relay/rest/addresses/{id}
Content-Type: application/json

Updates an Address that has been previously created.

When `emergency_enabled=true` and the address is in the US (`country` = `US`), the address is validated against the carrier. A valid or auto-corrected address is stored (`validated: true`). An address the carrier cannot validate — or a correctable address when `auto_correct_address=false` — is rejected with a `422` whose body includes an `errors` array and a `candidates` array of suggested addresses (each with `street_number`, `street_name`, `city`, `state`, `postal_code`). Carrier validation applies to US addresses only: a non-US address is stored normally, with `emergency_enabled` returned as `false`. Requests without `emergency_enabled` are stored without carrier validation.

#### Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Numbers_.

[Learn more about API scopes](/docs/platform/your-signalwire-api-space).

Reference: https://signalwire.com/docs/apis/rest/e-911-addresses/update-address

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: signalwire-rest
  version: 1.0.0
paths:
  /api/relay/rest/addresses/{id}:
    put:
      operationId: update_address
      summary: Update E911 address
      description: >-
        Updates an Address that has been previously created.


        When `emergency_enabled=true` and the address is in the US (`country` =
        `US`), the address is validated against the carrier. A valid or
        auto-corrected address is stored (`validated: true`). An address the
        carrier cannot validate — or a correctable address when
        `auto_correct_address=false` — is rejected with a `422` whose body
        includes an `errors` array and a `candidates` array of suggested
        addresses (each with `street_number`, `street_name`, `city`, `state`,
        `postal_code`). Carrier validation applies to US addresses only: a
        non-US address is stored normally, with `emergency_enabled` returned as
        `false`. Requests without `emergency_enabled` are stored without carrier
        validation.


        #### Permissions


        The API token used to authenticate must have the following scope(s)
        enabled to make a successful request: _Numbers_.


        [Learn more about API scopes](/docs/platform/your-signalwire-api-space).
      tags:
        - e911Addresses
      parameters:
        - name: id
          in: path
          description: Unique ID of the address.
          required: true
          schema:
            $ref: '#/components/schemas/uuid'
        - name: Authorization
          in: header
          description: >-
            SignalWire Basic Authentication using Project ID and API Token.


            The client sends HTTP requests with the Authorization header
            containing

            the word Basic followed by a space and a base64-encoded string of
            project_id:token.

            The project ID will be used as the username and the API token as the
            password.


            Example:

            ```

            Authorization: Basic base64(project_id:token)

            ```
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressResponse'
        '401':
          description: Access is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode401'
        '404':
          description: The server cannot find the requested resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode404'
        '422':
          description: >-
            The request failed validation. See `errors` for details. When
            carrier validation rejected the address

            and the carrier returned alternatives, a `candidates` array is
            included alongside `errors`; the key is

            omitted when the carrier returned none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressValidationError'
        '500':
          description: An internal server error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode500'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAddressRequest'
servers:
  - url: https://%7BYour_Space_Name%7D.signalwire.com
    description: SignalWire API
components:
  schemas:
    uuid:
      type: string
      format: uuid
      description: Universal Unique Identifier.
      title: uuid
    AddressType:
      type: string
      enum:
        - Apartment
        - Basement
        - Building
        - Department
        - Floor
        - Office
        - Penthouse
        - Suite
        - Trailer
        - Unit
      description: Address type for sub-addresses.
      title: AddressType
    UpdateAddressRequest:
      type: object
      properties:
        label:
          type: string
          description: >-
            A friendly name given to the address to help distinguish and search
            for different addresses within your project. When the address is
            assigned to a phone number for E911, this label is also sent to the
            carrier as the caller name. The emergency network limits that field
            to 32 characters, so longer labels are truncated to the first 32
            characters before being sent. Truncation affects only the name shown
            to the dispatcher, never the address used to route the call.
        country:
          type: string
          description: The ISO 3166 Alpha 2 country code.
        first_name:
          type: string
          description: First name of the occupant associated with this address.
        last_name:
          type: string
          description: Last name of the occupant associated with this address.
        street_number:
          type: string
          description: The number portion of the street address.
        street_name:
          type: string
          description: The name portion of the street address.
        address_type:
          $ref: '#/components/schemas/AddressType'
          description: >-
            If the address is divided into multiple sub-addresses, this
            identifies how the address is divided. Possible values are:
            Apartment, Basement, Building, Department, Floor, Office, Penthouse,
            Suite, Trailer, Unit.
        address_number:
          type: string
          description: >-
            If the address is divided into multiple sub-addresses, this
            identifies the particular sub-address.
        city:
          type: string
          description: The city portion of the street address.
        state:
          type: string
          description: >-
            The state/province/region of the street address. In the USA and
            Canada, use the two-letter abbreviated form.
        postal_code:
          type: string
          description: The postal code of the street address.
        emergency_enabled:
          type: boolean
          default: false
          description: >-
            Applies to US addresses only. When `true` and `country` is `US`, the
            address is validated against

            the carrier before it is stored. For any other `country` the flag is
            ignored and the response

            returns `emergency_enabled: false`. Defaults to `false`, which
            stores the address without carrier

            validation.
        auto_correct_address:
          type: boolean
          default: true
          description: >-
            When the carrier suggests a corrected version of the address, `true`
            (the default) stores the corrected address; `false` rejects the
            request with the suggestion returned as candidates.
      required:
        - label
        - country
        - first_name
        - last_name
        - street_number
        - street_name
        - city
        - state
        - postal_code
      description: Request body for updating an address.
      title: UpdateAddressRequest
    AddressResponse:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: The unique identifier of the Address on SignalWire.
        label:
          type: string
          description: >-
            A friendly name given to the address to help distinguish and search
            for different addresses within your project.
        country:
          type: string
          description: The ISO 3166 Alpha 2 country code.
        first_name:
          type: string
          description: First name of the occupant associated with this address.
        last_name:
          type: string
          description: Last name of the occupant associated with this address.
        street_number:
          type: string
          description: The number portion of the street address.
        street_name:
          type: string
          description: The name portion of the street address.
        address_type:
          oneOf:
            - $ref: '#/components/schemas/AddressType'
            - type: 'null'
          description: >-
            If the address is divided into multiple sub-addresses, this
            identifies how the address is divided.
        address_number:
          type:
            - string
            - 'null'
          description: >-
            If the address is divided into multiple sub-addresses, this
            identifies the particular sub-address.
        city:
          type: string
          description: The city portion of the street address.
        state:
          type: string
          description: >-
            The state/province/region of the street address. In the USA and
            Canada, use the two-letter abbreviated form.
        postal_code:
          type: string
          description: The postal code of the street address.
        zip_code:
          type: string
          description: >-
            The postal code of the street address. Alias for postal_code for
            backwards compatibility.
        emergency_enabled:
          type: boolean
          description: >-
            Whether E911 emergency calling is enabled for this address
            (carrier-validated when created/updated with
            `emergency_enabled=true` for a US address).
        validated:
          type: boolean
          description: >-
            Whether the address was validated by the carrier (true when the
            carrier returned a valid or auto-corrected match).
        validated_at:
          type:
            - string
            - 'null'
          description: >-
            The RFC 3339 / ISO 8601 timestamp of the last successful carrier
            validation, or null if never validated.
      required:
        - id
        - label
        - country
        - first_name
        - last_name
        - street_number
        - street_name
        - address_type
        - address_number
        - city
        - state
        - postal_code
        - zip_code
        - emergency_enabled
        - validated
        - validated_at
      description: Response containing a single address.
      title: AddressResponse
    TypesStatusCodesStatusCode401Error:
      type: string
      enum:
        - Unauthorized
      title: TypesStatusCodesStatusCode401Error
    Types.StatusCodes.StatusCode401:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode401Error'
      required:
        - error
      description: Access is unauthorized.
      title: Types.StatusCodes.StatusCode401
    TypesStatusCodesStatusCode404Error:
      type: string
      enum:
        - Not Found
      title: TypesStatusCodesStatusCode404Error
    Types.StatusCodes.StatusCode404:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode404Error'
      required:
        - error
      description: The server cannot find the requested resource.
      title: Types.StatusCodes.StatusCode404
    Types.StatusCodes.SpaceApiErrorItem:
      type: object
      properties:
        detail:
          type: string
          description: A description of what caused the error.
        status:
          type: string
          description: The HTTP status code.
        title:
          type: string
          description: A short summary of the error type.
        code:
          type: string
          description: The error code.
      required:
        - detail
        - status
        - title
        - code
      description: Details about a specific validation error.
      title: Types.StatusCodes.SpaceApiErrorItem
    AddressCandidate:
      type: object
      properties:
        street_number:
          type:
            - string
            - 'null'
          description: The number portion of the suggested street address.
        street_name:
          type:
            - string
            - 'null'
          description: The name portion of the suggested street address.
        city:
          type:
            - string
            - 'null'
          description: The city portion of the suggested street address.
        state:
          type:
            - string
            - 'null'
          description: The state of the suggested street address.
        postal_code:
          type:
            - string
            - 'null'
          description: The postal code of the suggested street address.
      required:
        - street_number
        - street_name
        - city
        - state
        - postal_code
      description: A carrier-suggested alternative to the submitted address.
      title: AddressCandidate
    AddressValidationError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Types.StatusCodes.SpaceApiErrorItem'
          description: List of validation errors.
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/AddressCandidate'
          description: >-
            Alternative addresses suggested by the carrier. Omitted when the
            carrier returned no alternatives.
      required:
        - errors
      description: >-
        The request failed validation. See `errors` for details. When carrier
        validation rejected the address

        and the carrier returned alternatives, a `candidates` array is included
        alongside `errors`; the key is

        omitted when the carrier returned none.
      title: AddressValidationError
    TypesStatusCodesStatusCode500Error:
      type: string
      enum:
        - Internal Server Error
      title: TypesStatusCodesStatusCode500Error
    Types.StatusCodes.StatusCode500:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode500Error'
      required:
        - error
      description: An internal server error occurred.
      title: Types.StatusCodes.StatusCode500
  securitySchemes:
    SignalWireBasicAuth:
      type: http
      scheme: basic
      description: >-
        SignalWire Basic Authentication using Project ID and API Token.


        The client sends HTTP requests with the Authorization header containing

        the word Basic followed by a space and a base64-encoded string of
        project_id:token.

        The project ID will be used as the username and the API token as the
        password.


        Example:

        ```

        Authorization: Basic base64(project_id:token)

        ```

```

## Examples



**Request**

```json
{
  "label": "My Address",
  "country": "US",
  "first_name": "Emmett",
  "last_name": "Brown",
  "street_number": "1640",
  "street_name": "Riverside Drive",
  "city": "Alexandria",
  "state": "CA",
  "postal_code": "91905"
}
```

**Response**

```json
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "label": "My Address",
  "country": "US",
  "first_name": "Emmett",
  "last_name": "Brown",
  "street_number": "1640",
  "street_name": "Riverside Drive",
  "address_type": "Apartment",
  "address_number": "42",
  "city": "Alexandria",
  "state": "CA",
  "postal_code": "91905",
  "zip_code": "91905",
  "emergency_enabled": false,
  "validated": false,
  "validated_at": null
}
```

**SDK Code**

```python
import requests

url = "https://{your_space_name}.signalwire.com/api/relay/rest/addresses/id"

payload = {
    "label": "My Address",
    "country": "US",
    "first_name": "Emmett",
    "last_name": "Brown",
    "street_number": "1640",
    "street_name": "Riverside Drive",
    "city": "Alexandria",
    "state": "CA",
    "postal_code": "91905"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers, auth=("<project_id>", "<api_token>"))

print(response.json())
```

```javascript
const url = 'https://{your_space_name}.signalwire.com/api/relay/rest/addresses/id';
const credentials = btoa("<project_id>:<api_token>");

const options = {
  method: 'PUT',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"label":"My Address","country":"US","first_name":"Emmett","last_name":"Brown","street_number":"1640","street_name":"Riverside Drive","city":"Alexandria","state":"CA","postal_code":"91905"}'
};

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://{your_space_name}.signalwire.com/api/relay/rest/addresses/id"

	payload := strings.NewReader("{\n  \"label\": \"My Address\",\n  \"country\": \"US\",\n  \"first_name\": \"Emmett\",\n  \"last_name\": \"Brown\",\n  \"street_number\": \"1640\",\n  \"street_name\": \"Riverside Drive\",\n  \"city\": \"Alexandria\",\n  \"state\": \"CA\",\n  \"postal_code\": \"91905\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.SetBasicAuth("<project_id>", "<api_token>")
	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://{your_space_name}.signalwire.com/api/relay/rest/addresses/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request.basic_auth("<project_id>", "<api_token>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"label\": \"My Address\",\n  \"country\": \"US\",\n  \"first_name\": \"Emmett\",\n  \"last_name\": \"Brown\",\n  \"street_number\": \"1640\",\n  \"street_name\": \"Riverside Drive\",\n  \"city\": \"Alexandria\",\n  \"state\": \"CA\",\n  \"postal_code\": \"91905\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://{your_space_name}.signalwire.com/api/relay/rest/addresses/id")
  .basicAuth("<project_id>", "<api_token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"label\": \"My Address\",\n  \"country\": \"US\",\n  \"first_name\": \"Emmett\",\n  \"last_name\": \"Brown\",\n  \"street_number\": \"1640\",\n  \"street_name\": \"Riverside Drive\",\n  \"city\": \"Alexandria\",\n  \"state\": \"CA\",\n  \"postal_code\": \"91905\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://{your_space_name}.signalwire.com/api/relay/rest/addresses/id', [
  'body' => '{
  "label": "My Address",
  "country": "US",
  "first_name": "Emmett",
  "last_name": "Brown",
  "street_number": "1640",
  "street_name": "Riverside Drive",
  "city": "Alexandria",
  "state": "CA",
  "postal_code": "91905"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<project_id>', '<api_token>'],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://{your_space_name}.signalwire.com/api/relay/rest/addresses/id");
client.Authenticator = new HttpBasicAuthenticator("<project_id>", "<api_token>");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"label\": \"My Address\",\n  \"country\": \"US\",\n  \"first_name\": \"Emmett\",\n  \"last_name\": \"Brown\",\n  \"street_number\": \"1640\",\n  \"street_name\": \"Riverside Drive\",\n  \"city\": \"Alexandria\",\n  \"state\": \"CA\",\n  \"postal_code\": \"91905\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<project_id>:<api_token>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "label": "My Address",
  "country": "US",
  "first_name": "Emmett",
  "last_name": "Brown",
  "street_number": "1640",
  "street_name": "Riverside Drive",
  "city": "Alexandria",
  "state": "CA",
  "postal_code": "91905"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://{your_space_name}.signalwire.com/api/relay/rest/addresses/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```