Create an Inbound Route

Use this endpoint to create a new inbound route. Routes can then be associated with phone numbers. Please see List Inbound Routes for the different service routes that you can associate with your Flowroute phone numbers.

Endpoint

POST /routes

Request Parameters

  • alias
    required

    Alias for the route.

  • route_type
    required

    Indicates the type of route: HOST, PSTN, URI, or SIP-REG for Voice, webhook for SMS, MMS, and DLRs. SIP-REG is the default name assigned to a voice route if none is assigned.

  • value
    required

    Value of the route, dependent on the route_type:

    • If HOST, the value must be an IP address or URL
      with an optional port number. For example, an IP address could be 24.239.23.40:5060 or a URL could be myphone.com. If no port is specified, the server will attempt to use DNS SRV records.

    • If PSTN, the value must be in E.164 format. e.g.,16476998778.

    • IfURI, the value must be formatted as protocol:user@domain[:port][;transport=<tcp/udp>.

      For example, sip:alice@atlanta.com, sip:16476998778@215.122.69.152:5060;transport=tcp, or sips:securecall@securedserver.com.

    • If webhook, it must follow the general rules for valid URLs.

Example Request

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

{
  "data": {
    "type": "route",
    "attributes": {
      "route_type": "webhook",
      "value": "https://api.example.com/sms_stuff",
      "alias": "message_route_5000"
    }
  }
}

                        

Example Request

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

{
  "route_type": "webhook",
  "value": "https://api.doug.com/sms_stuff",
  "alias": "message_route_5000"
}

                        

Example Request

curl -X POST https://api.flowroute.com/v2.1/routes -u accessKey:secretKey \
'Content-Type':'application/vnd.api+json' \
-d '{"route_type": "webhook", "value": "http://api.doug.com/sms_stuff", \
"alias": "message_route_5000"}'

                        

Example Response

201 CREATED

{
  "data": {
    "attributes": {
      "alias": "message_route_5000",
      "route_type": "webhook",
      "value": "https://api.example.com/sms_stuff"
    },
    "id": "92172",
    "links": {
      "self": "https://api.flowroute.com/v2.1/routes/92172"
    },
    "type": "route"
  }
}