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

# Assign an E911 address to a phone number

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

Assigns a validated E911 address to the phone number and begins provisioning at the carrier. The number's `e911_status` becomes `pending`; it moves to `active` asynchronously once the carrier confirms. The address is re-validated at the carrier and must be valid.

Use this operation after [Create E911 address](/docs/apis/rest/e-911-addresses/create-address) when emergency calls from the number must present that physical service location. Resource addresses and SIP Addresses are routing handles and cannot be assigned for E911.

The address `label` is sent to the carrier as the caller name presented to the dispatcher. The emergency network limits that field to 32 characters, so a longer label is truncated to the first 32 characters. Truncation never affects the street address used to route the call, and does not cause the assignment to fail.

#### 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/assign-e-911-address

## Authentication

- `Authorization` header (basic auth, required) — 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) ```

## Request

### Path parameters

- `id` (string, required) — Unique ID of the phone number.

### Body (application/json)

- `e911_address_id` (string, required) — The ID of a validated E911 address in the same project to assign to this phone number.

## Response

### 200

The request has succeeded.

- `id` (string, required) — The unique identifier of the phone number.
- `number` (string, required) — The phone number in E.164 format.
- `name` (string, required, nullable) — The name given to the phone number. Helps to distinguish different phone numbers within your project.
- `capabilities` (list of enum, required) — A list of communication methods this phone number supports.
  - Allowed values: `voice`, `sms`, `mms`, `fax`
- `number_type` (enum, required) — The type of number this is defined as.
  - Allowed values: `toll-free`, `longcode`
- `e911_address_id` (string, required, nullable) — The E911 address ID associated with this phone number.
- `e911_status` (enum, required, nullable) — The E911 provisioning status for this phone number. `null` when the number has never had an E911 address assigned. Once an address is assigned the value is `pending` while the carrier processes the order, then `active` once the carrier confirms the registration, or `failed` if the carrier does not confirm it. Removing the address sets `pending_removal`, and the value becomes `unregistered` once the carrier confirms the removal.
  - Allowed values: `pending`, `active`, `failed`, `pending_removal`, `unregistered`
- `cnam` (string, required, nullable) — The caller ID name currently applied at the carrier for this phone number, or `null` when none is set. This is the name call recipients can see. Change it with [Request a caller ID name](/docs/apis/rest/caller-id-name/request-caller-id-name). This value changes only after a request is approved and applied at the carrier, so it can differ from the requested `name` while a request is being reviewed or after one is rejected or fails.
- `created_at` (datetime, required) — The date the number was added to your project.
- `updated_at` (datetime, required) — The date the number was last updated.
- `next_billed_at` (datetime, required, nullable) — The next date the number will be billed for.
- `call_handler` (enum, required, nullable) — What type of handler you want to run on inbound calls.
  - Allowed values: `relay_context`, `relay_topic`, `relay_script`, `relay_application`, `relay_connector`, `relay_sip_endpoint`, `relay_verto_endpoint`, `laml_webhooks`, `laml_application`, `dialogflow`, `video_room`, `call_flow`, `ai_agent`, `fabric_subscriber`, `sip_gateway`, `call_queue`
- `calling_handler_resource_id` (string, required, nullable) — The unique identifier of the calling handler resource.
- `call_receive_mode` (enum, required) — How do you want to receive the incoming call.
  - Allowed values: `voice`, `fax`
- `call_request_url` (string, required, nullable) — The URL to make a request to when using the laml_webhooks call handler.
- `call_request_method` (enum, required, nullable) — The HTTP method to use when making a request to the call_request_url.
  - Allowed values: `GET`, `POST`
- `call_fallback_url` (string, required, nullable) — The fallback URL to make a request to when using the laml_webhooks call handler and the call_request_url fails.
- `call_fallback_method` (enum, required, nullable) — The HTTP method to use when making a request to the call_fallback_url.
  - Allowed values: `GET`, `POST`
- `call_status_callback_url` (string, required, nullable) — The URL to make status callbacks to when using the laml_webhooks call handler.
- `call_status_callback_method` (enum, required, nullable) — The HTTP method to use when making a request to the call_status_callback_url.
  - Allowed values: `GET`, `POST`
- `call_laml_application_id` (string, required, nullable) — The ID of the LaML Application to use when using the laml_application call handler.
- `call_dialogflow_agent_id` (string, required, nullable) — The ID of the Dialogflow Agent to start when using the dialogflow call handler.
- `call_relay_topic` (string, required, nullable) — A string representing the Relay topic to forward incoming calls to. This is only used (and required) when call_handler is set to relay_topic.
- `call_relay_topic_status_callback_url` (string, required, nullable) — A string representing a URL to send status change messages to. This is only used (and required) when call_handler is set to relay_topic.
- `call_relay_script_url` (string, required, nullable) — The URL to make a request to when using the relay_script call handler. The URL must respond with a valid SWML script.
- `call_relay_context` (string, required, nullable) — The name of the Relay Context to send this call to when using the relay_context call handler.
- `call_relay_context_status_callback_url` (string, required, nullable) — A string representing a URL to send status change messages to. This is only used (and required) when call_handler is set to relay_context.
- `call_relay_application` (string, required, nullable) — The name of the Relay Application to send this call to when using the relay_application call handler.
- `call_relay_connector_id` (string, required, nullable) — The ID of the Relay Connector to send this call to when using the relay_connector call handler.
- `call_sip_endpoint_id` (string, required, nullable) — The ID of the Relay SIP Endpoint to send this call to when using the relay_sip_endpoint call handler.
- `call_verto_resource` (string, required, nullable) — The name of the Verto Relay Endpoint to send this call to when using the relay_verto_endpoint call handler.
- `call_video_room_id` (string, required, nullable) — The ID of the Video Room to send this call to when using the video_room call handler.
- `message_handler` (enum, required, nullable) — What type of handler you want to run on inbound messages.
  - Allowed values: `relay_context`, `relay_topic`, `relay_application`, `laml_webhooks`, `laml_application`
- `messaging_handler_resource_id` (string, required, nullable) — The unique identifier of the messaging handler resource.
- `message_request_url` (string, required, nullable) — The URL to make a request to when using the laml_webhooks message handler.
- `message_request_method` (enum, required, nullable) — The HTTP method to use when making a request to the message_request_url.
  - Allowed values: `GET`, `POST`
- `message_fallback_url` (string, required, nullable) — The fallback URL to make a request to when using the laml_webhooks message handler and the message_request_url fails.
- `message_fallback_method` (enum, required, nullable) — The HTTP method to use when making a request to the message_fallback_url.
  - Allowed values: `GET`, `POST`
- `message_laml_application_id` (string, required, nullable) — The ID of the LaML Application to use when using the laml_application message handler.
- `message_relay_topic` (string, required, nullable) — The name of the Relay Topic to send this message to when using the relay_topic message handler.
- `message_relay_context` (string, required, nullable) — The name of the Relay Context to send this message to when using the relay_context message handler.
- `country_code` (string, required, nullable) — The ISO 3166-1 alpha-2 country code of the phone number.

## Examples

**Request**

```json
{
  "e911_address_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
```

**Response**

```json
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "number": "+15558675309",
  "name": "Jenny",
  "capabilities": [
    "voice"
  ],
  "number_type": "toll-free",
  "e911_address_id": "string",
  "e911_status": "active",
  "cnam": "ACME PLUMBING",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z",
  "next_billed_at": "2024-01-15T09:30:00Z",
  "call_handler": "relay_context",
  "calling_handler_resource_id": "fe4093d9-58c2-4931-b4b9-5679f82652c6",
  "call_receive_mode": "voice",
  "call_request_url": "string",
  "call_request_method": "POST",
  "call_fallback_url": "string",
  "call_fallback_method": "POST",
  "call_status_callback_url": "string",
  "call_status_callback_method": "POST",
  "call_laml_application_id": "string",
  "call_dialogflow_agent_id": "string",
  "call_relay_topic": "office",
  "call_relay_topic_status_callback_url": "https://myapplication/handle_relay_callbacks",
  "call_relay_script_url": "https://example.signalwire.com/relay-bins/60e2ba7b-366e-44de-84e3-0c76cfccf1cc",
  "call_relay_context": "my_relay_app",
  "call_relay_context_status_callback_url": "https://myapplication/handle_relay_callbacks",
  "call_relay_application": "my_relay_app",
  "call_relay_connector_id": "string",
  "call_sip_endpoint_id": "string",
  "call_verto_resource": "string",
  "call_video_room_id": "fe4093d9-58c2-4931-b4b9-5679f82652c6",
  "message_handler": "relay_application",
  "messaging_handler_resource_id": "fe4093d9-58c2-4931-b4b9-5679f82652c6",
  "message_request_url": "string",
  "message_request_method": "POST",
  "message_fallback_url": "string",
  "message_fallback_method": "POST",
  "message_laml_application_id": "string",
  "message_relay_topic": "string",
  "message_relay_context": "my_relay_app",
  "country_code": "US"
}
```

**SDK Code**

```python
import requests

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

payload = { "e911_address_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }
headers = {
    "Content-Type": "application/json"
}

response = requests.post(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/phone_numbers/id/e911_address';
const credentials = btoa("<project_id>:<api_token>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"e911_address_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}'
};

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/phone_numbers/id/e911_address"

	payload := strings.NewReader("{\n  \"e911_address_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n}")

	req, _ := http.NewRequest("POST", 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/phone_numbers/id/e911_address")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<project_id>", "<api_token>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"e911_address_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\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.post("https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers/id/e911_address")
  .basicAuth("<project_id>", "<api_token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"e911_address_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers/id/e911_address', [
  'body' => '{
  "e911_address_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}',
  '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/phone_numbers/id/e911_address");
client.Authenticator = new HttpBasicAuthenticator("<project_id>", "<api_token>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"e911_address_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\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 = ["e911_address_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"] 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/phone_numbers/id/e911_address")! 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()
```