Purchase a Phone Number

Use this endpoint to purchase a phone number from available Flowroute inventory.

Endpoint

POST /numbers/:id

Path Parameter

  • id
    integer required

    Phone number to purchase. The number must be in 11-digit E.164 format with the first digit being the country code 1; e.g. 12061231234.

Response Fields

On success, the HTTP status code in the response header is 200 OK and the response body contains a phone number object in JSON format. On error, the header status code is an error code and the response body contains an array of error objects.

  • data
    object

    Phone number object composed of the following:

    • attributes
      object

      Object composed of attributes defined in "List Account Phone Numbers".

    • id
      integer

      ID of the phone number object which is equal to its value.

    • links
      object

      Links object pointing to the phone number's URI. For example, https://api.flowroute.com/v2/numbers/16502390214.

    • relationships
      object

      Object desribing the different relationships your phone number can have such as CNAM Presets, e911 Addresses, and Primary and Failover Routes all of which are represented as individual JSON objects.

    • type
      string

      This will always be number.

  • included
    array

    An array of route objects associated with the phone number that you have purchased.

    • attributes
      object

      Route object composed of the following properties:

      • alias string- Alias for the route.

      • route_type string- Indicates the type of route: host, number, uri, or sip-reg. sip-reg is the default route type assigned to a phone number's primary voice route which you can change via Update Primary Voice Route for a Phone Number. To create a new route to be assigned to your newly purchased phone number, see Create an Inbound Route.

      • value stringValue that the route was set to.

    • id
      integer

      ID of the default route object for your newly purchased phone number.

    • links
      object

      Links object pointing to the route's URI. For example, https://api.flowroute.com/v2/routes/0.

    • type
      string

      This will always be route.

  • links
    string

    Links object pointing to the purchased phone number's URI. For example, https://api.flowroute.com/v2/numbers/16502390214.

Example Request

POST /v2/numbers/16502390214 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

		

Example Request

curl -X POST https://api.flowroute.com/v2/numbers/16502390214 -u accessKey:secretKey

		

Example Response

201 CREATED

{
  "data": {
    "attributes": {
      "alias": null,
      "cnam_lookups_enabled": true,
      "number_type": "standard",
      "rate_center": "millbrae",
      "state": "ca",
      "value": "16502390214"
    },
    "id": "16502390214",
    "links": {
      "self": "https://api.flowroute.com/v2/numbers/16502390214"
    },
    "relationships": {
      "cnam_preset": {
        "data": null
      },
      "e911_address": {
        "data": null
      },
      "failover_route": {
        "data": null
      },
      "primary_route": {
        "data": {
          "id": "0",
          "type": "route"
        }
      }
    },
    "type": "number"
  },
  "included": [
    {
      "attributes": {
        "alias": "sip-reg",
        "route_type": "sip-reg",
        "value": null
      },
      "id": "0",
      "links": {
        "self": "https://api.flowroute.com/v2/routes/0"
      },
      "type": "route"
    }
  ],
  "links": {
    "self": "https://api.flowroute.com/v2/numbers/16502390214"
  }
}

				

404 NOT FOUND

{
  "errors": [
    {
      "detail": "Number: 6391723423456 is not purchasable.",
      "id": "78b36546-600e-4bc0-8797-dd1177edeb1a",
      "status": 404
    }
  ]
}