Overview

Flowroute understands the need for immediate assistance and is constantly working on addressing communications needs for its end users. We have expanded our API offerings to now include the ability to programmatically add a valid and highly precise E911 address to your account – including an address type and a corresponding address type number; e.g. Apartment 108 – and associate your newly created E911 record with any of your long code or toll-free phone numbers. West has put together a great blog post outlining the importance of identifiable e911 locations, and the difference additional information can make for first responders to emergency calls.

New to Number Management with Flowroute?

This guide assumes that you have an activated Flowroute account and have followed the instructions on Purchase Your First Flowroute Phone Number.

Steps


Validate and create an E911 record

To associate an E911 address with a long code or toll-free phone number on your account, you must create a record for the E911 address first. Flowroute's E911 API has two endpoints you can hit to validate the E911 address that you want to add to your account:

Endpoint Description
https://api.flowroute.com/v2/e911s Lets you validate and post an E911 address as a record on your Flowroute account.
https://api.flowroute.com/v2/e911s/validate Lets you post an E911 address for validation only.

For brevity's sake, we will show you how to work with the first endpoint. For a list of accepted body parameters and an example request, see Create and Validate a New E911 Address.

The Flowroute API v2 provides an alternative programmatic way for you to validate and add an E911 address to your account. To only check on the validity of your E911 address, see Validate an E911 Address. For the Manage method of validating and adding an E911 address to your account, see Create an E911 Entry.

In this tutorial, we will show you two methods of validating and adding an E911 address to your account using the Flowroute API v2:

Request via cURL

  1. Open a command shell session.
  2. If you haven't installed cURL previously, download your specific source package here.
  3. Copy the following example POST request.
  4. curl https://api.flowroute.com/v2/e911s \
    -X POST -u accessKey:secretKey \
    -d '{"data": {"type": "e911", "attributes":{"label": "Pioneer Square Office", "first_name": "Bob", "last_name": "Law", "street_number": "506", "street_name": "2nd Ave", "address_type": "Suite", "address_type_number": "601", "city": "Seattle", "state": "WA", "country": "US", "zip": "98104"}}}' \
    -H 'Content-Type':'application/vnd+api.json'
    
                        
  5. Replace accessKey:secretKey with your API credentials.
  6. In the JSON body parameters section of your cURL request right after the cURL -d flag, replace all the attributes with your E911 address details following the Body Parameters section of "Create and Validate a New E911 Address".
  7. Press Enter.

Tips

To avoid errors, make sure to:

  • Enter your API credentials correctly.
  • Use vertical quotes in your request. Learn more about Unicode and and ISO 10646 standards in ASCII and Unicode quotation marks.
  • Use a backslash (\) at the end of lines to break up a long cURL statement into easier-to-read lines if you're in a UNIX environment. If you're using Windows, replace any backslash at the end of lines with the caret (^) character. Here's a great guide for installing and using cURL.

Request via Python

  1. To begin, follow the Requirements and Installation sections of the library guide.
  2. Open up your preferred text editor and start writing Python code.
  3. vim e911-test.py
                
  4. Import the following required libraries.
  5. import pprint
    import os
    import json
    from flowroutenumbersandmessaging.flowroutenumbersandmessaging_client import FlowroutenumbersandmessagingClient
    
                
  6. Assign your Flowroute accessKey and secretKey to the following variables or set them as environment variables.
  7. basic_auth_user_name = "YOUR_FR_ACCESS_KEY"
    basic_auth_password = "YOUR_FR_SECRET_KEY"
    
                        
  8. Next, instantiate the API Client and the e911s controllers.
  9. client = FlowroutenumbersandmessagingClient(basic_auth_user_name, basic_auth_password)
    e911s_controller = client.e911s
    
                        
  10. Lastly, specify your body parameters and invoke the Python library v3 create_address method.
  11. 
    print("\n--Create and Validate an Address")
    try:
        result = e911s_controller.create_address(
                                                 label="Pioneer Square Office",
                                                 first_name="Bob",
                                                 last_name="Law",
                                                 address_type="Suite",
                                                 Address_type_number = "601",
                                                 street_name="2nd Ave",
                                                 street_number="506",
                                                 city="Seattle",
                                                 state="WA",
                                                 country="US",
                                                 zipcode="98101")
        pprint.pprint(result)
    except Exception as e:
        print(str(e))
        print(e.context.response.raw_body)
    
                        
  12. You're done coding, at least for the E911 address validation and creation portion of this tutorial. Save the file and run it.
  13. python e911-test.py
                

Flowroute API Create and Validate an E911 Address Response

On success, the HTTP status code in the response header is 201 CREATED and the response body contains the newly created e911 object in JSON format. Make a note of the record id of the E911 address in the JSON response. You will need that for the next portion.

{
  "data": {
    "attributes": {
      "address_type": "Suite",
      "address_type_number": "601",
      "city": "Seattle",
      "country": "US",
      "first_name": "Bob",
      "label": "Pioneer Square Office",
      "last_name": "Law",
      "state": "WA",
      "street_name": "2nd Ave",
      "street_number": 506,
      "zip": 98104
    },
    "id": 21793,
    "links": {
      "self": "https://api.flowroute.com/v2/e911s/21793"
    },
    "type": "e911"
  }
}

            

You may assign your newly added E911 address to any long code or toll-free Flowroute number that you own.

Request via cURL

  1. To assign your newly created E91 record as an emergency address for your Flowroute phone number, copy the following example PATCH request.
  2. curl https://api.flowroute.com/v2/numbers/12062011682/relationships/e911s/21793 -X PATCH -u accessKey:secretKey
    
                        
  3. Replace accessKey:secretKey with your API credentials.
  4. In the path parameter section of your cURL request right after numbers, https://api.flowroute.com/v2/numbers, replace the example phone number with the id of your long code or toll-free number and the example E911 ID after e911s with the id of the E911 address you want to assign to your phone number.
  5. Press Enter.