Query CDRs

Creates a new Call Detail (CDR) Export request.

Using this API makes a request to the Flowroute servers to build an aggregated report of calls in your account based on and filtered by the query parameters you specify. You can specify any combination of query parameters in your request. If the system is unable to parse your parameters, it will issue an error. You can either refine your parameters or contact customer support to request a new search feature.

If specified, the system will POST a status update to the callback_url you specifiy. See the section on Flowroute Notifications.

Endpoint

POST /cdrs/exports

Body Parameters

  • data
    required

    Data object composed of the following:

    • type
      required

      This will always be cdrexport.

    • attributes
      required

      Object composed of the following route attributes:

      • callback_url

        A publicly available HTTP endpoint that will be notified when a change in request happens. For more information about these messages, see the Flowroute Notifications section.

      • filter_parameters
        required

        A JSON object describing the parameters to use when filtering the data available.

        • start_call_start_time
          datetime required

          Return all records that begin at or after the specified UTC value.

        • start_call_end_time
          datetime required

          Return all records that begin before the specified UTC value.

        • number_aliases
          array

          Only include records with the number_alias containing an exact match.

        • number_aliases_contains
          array

          Only include records with the number_alias containing a partial match.

        • destination_numbers
          array

          Only include records with destination number matches one of these entries.

        • callerid_numbers
          array

          Only include records where the callerid number matches one of these entries w/wo ‘+’.

        • custom_x_tags
          array

          Used to filter the records with 'X-Tag' references in the SIP header against the list provided.

        • caller_ip
          string

          Restrict records to those from a specific IP address.

        • duration_greater_than
          number

          Return records whose duration is longer than the value specified (in seconds).

        • duration_less_than
          number

          Return records whose duration is shorter than the value specified (in seconds)

        • cost_greater_than
          float

          Return records whose cost subtotal is greater than the value specified (in dollars).

        • cost_less_than
          float

          Return records whose cost subtotal is less than the value specified (in dollars).

        • destination_countries_included
          array

          Only include the specified countries (see County Codes for a list of valid entries).

        • destination_countries_excluded
          array

          Exclude the countries listed (see County Codes for a list of valid entries).

        • tollfree_only
          boolean

          If True, restrict records to Toll Free numbers only with False being the default value if not specified

        • direction
          string

          May be either 'inbound' or 'outbound'.

        • exclude_cancelled
          boolean

          If True, excludes calls with status of 'cancelled' with False being the default value if not specified

        • destination_prefix
          array

          Only include records with numbers whose destination number prefix matches one of the entries it the specified list.

        • callerid_prefix
          array

          Only include record with numbers whose calling number prefix matches one of the entries it the specified list.

Response Fields

On success, the HTTP status code in the response header is 202 Accepted and the response body contains a request 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

    Route object composed of the following:

    • attributes
      object

      Object composed of attributes described above.

    • id
      integer

      ID of the newly created route object.

    • type
      string

      This will always be cdrexport.

  • links
    object

    Links object pointing to your newly created CDR request. For example, https://api.flowroute.com/v2/cdrs/exports/98396.

Example Request

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

{
  "data": {
    "type": "cdrexport",
    "attributes": {
      "callback_url": "https://myserver.com/cdrs",
      "filter_parameters": {
        "start_call_start_time": "2019-01-01 00:00:00",
        "start_call_end_time": "2019-02-01 00:00:00",
        "number_aliases": ["Office 221", "Office 888"]
      }
    }
  }
}

                        

Example Request

curl https://api.flowroute.com/v2/cdrs/exports -X POST -u accessKey:secretKey \
 -d '{"data": {"type":"cdrexport", "attributes": { \
    "callback_url": "https://myserver.com/cdrs",\
    "filter_parameters": {"start_call_start_time": "2019-01-01 00:00:00",\
    "start_call_end_time": "2019-02-01 00:00:00", \
    "number_aliases": ["Office 221", "Office 888"]}}}}' \
-H 'Content-Type':'application/vnd.api+json'

                        

Example Responses

201 CREATED

 
{
  "data": {
    "type": "cdrexport",
    "id": "38647",
    "links": {
        "self": "https://api.flowroute.com/v2/cdrs/exports/38647"
      },
    "attributes": {
      "number_aliases": [
        "Office 221",
        "Office 888"
      ],
      "start_call_start_time": "2019-01-01 00:00:00",
      "start_call_end_time": "2019-02-01 00:00:00",
      "callback_url": "https://myserver.com/cdrs",
      "status": "processing",
      "download_url": None,
      "requested_at": "2019-03-18T16:43:00+00:00",
      "created_at": "2019-03-18T16:43:01+03:00",
      "expires_at": None,
      "total_cost": None,
      "call_subtotal": None,
      "connect_fees": None,
      "cnamlookup_fees": None,
      "usf_fees": None,
      "ccrf": None,
      "billed_minutes": None,
      "filter_parameters": {
        "number_aliases": [
          "Office 221",
          "Office 888"
        ],
      }
    }
  }
}

            

422 UNPROCESSABLE ENTITY

{
  "errors": [
    {
      "detail": "Invalid value: start_call_start_time is improperly formatted.",
      "id": "f3a378a2-60ac-42d6-8915-bbd5cf2229bf",
      "status": 422
    }
  ]
}