NAV Navbar

Introduction

This is the documentation for the Phonewagon API. Currently, you can query companies, campaigns, and calls using the API.

Requests are rate-limited at 50 requests per minute.

Authentication

To authorize, use this code:

curl -u client-id:client-secret
     "https://dev.phonewagon.com/resource_name?query-params"

Make sure to fill in the client ID and secret for your account.

Phonewagon provides a client ID and secret for each account to authorize API requests.

You can find your ID and secret under the "Credentials" tab in Account Settings.

The ID and secret must be supplied as the basic auth username and password in each API request. The client id should be the username and the client secret should be the password.

Companies

Fetch companies for an account

curl -u client-id:client-secret
     "https://dev.phonewagon.com/companies"

Example response:

{
  "companies": [
    {
      "id": 1001,
      "name": "Phonewagon"
    },
    {
      "id": 9812,
      "name": "Jake's rake company"
    }
  ]
}

This endpoint retrieves all companies.

HTTP Request

GET https://dev.phonewagon.com/companies

Campaigns

Fetch campaigns for a company

curl -u client-id:client-secret
     "https://dev.phonewagon.com/campaigns?company_id=COMPANY-ID"

Example response:


{
  "campaigns": [
    {
      "id": "s2212",
      "name": "Facebook"
    }
  ]
}

This endpoint retrieves all campaigns for a company.

HTTP Request

GET https://dev.phonewagon.com/campaigns?company_id=<COMPANY_ID>

Calls

Query calls for an account

curl -u client-id:client-secret
     "https://dev.phonewagon.com/calls?campaign_id=s2212&end_time=1573072575990&page_size=1"

Example response:

{
  "calls": [
    {
      "account_id": 696,
      "ad_position": "",
      "campaign_name": "Dummy name",
      "company_id": 1386,
      "contact_name": "Bronx        Ny",
      "device": "",
      "direction": "inbound",
      "duration": 54,
      "fbclid": "",
      "from_number": "+19295559999",
      "gclid": ""
      "id": 6315,
      "is_first_time_caller": false,
      "keyword": "",
      "landing_page": "http://tommy123.com/staging.html",
      "match_type": "",
      "msclkid": "",
      "network": "",
      "recording_url": "https://core-api.phonewagon.com/call-recordings/CA9d0462dd32f10134829dde342c1ec85c/file?cb=1575395046734",
      "referral_value": "http://yahoo.com/yahoo.html",
      "sid": "CA9d0462dd32f10134829dde342c1ec85c",
      "start_time": 1575322416000,
      "status": "completed",
      "to_number": "+18445551234",
      "unbounce_page_id": "",
      "unbounce_variant_id": "",
      "unbounce_visitor_id": "",
      "user_source": "Yahoo organic",
      "utm_campaign": "",
      "utm_content": "",
      "utm_medium": "",
      "utm_source": "",
      "utm_term": "",
    }
  ],
  "next": "https://dev.phonewagon.com/calls?page_size=1&start_time=0&end_time=1575322415999&"
}

No parameters are required. If none are supplied, the endpoint will return all of the calls for an account.

Pagination

The endpoint is capped at returning 1000 call records. You can decrease this cap by supplying the page_size param. If there are more records that fulfill the query, the endpoint will include a next key in the response. This can be use to get the next "page" of records for the query. To get all the records for a query, keep requesting the successive next urls until one is not supplied.

HTTP Request

GET https://dev.phonewagon.com/calls?query-params

URL Parameters

Parameter Type Required? Default Notes
company_id integer no Returned from /companies endpoint
start_time integer no 0 Epoch time in milliseconds
end_time integer no Current time Epoch time in milliseconds
page_size integer no 1000 Will truncate to 1000 if greater than 1000
campaign_id string no Returned from /campaigns endpoint