Docs

Get call history

https://api.apifonica.com/v2/accounts/{accountSID}/calls

Overview

To get the call history for the account, make the GET request to /accounts/{accountSID}/calls.

The results can be narrowed by specifying filtering parameters.

REQUEST EXAMPLES

The following example demonstrates getting call logs.

curl –X GET https://api.apifonica.com/v2/accounts/{accountSID}/calls \
-u {accountSID}:{authToken}

RESPONSE EXAMPLE

{
  "limit": 20,
  "prev": null,
  "next": "https://api.apifonica.com/v2/accounts/{accountSID}/calls?next=4771",
  "calls": [
  {
      "call_sid": "{callSID}",
      "parent_call_sid": "{callSID}",
      "created": "Fri, 21 Apr 2017 13:01:25 +0000",
      "account_sid": "{accountSID}",
      "from": "358942417543",
      "to": "442038075273",
      "direction": "outbound",
      "status": "completed",
      "controller": "https://www.apifonica.com/maketestcall.xml",
      "method": "GET",
      "timeout": 15,
      "updated": "Fri, 21 Apr 2017 13:02:02 +0000",
      "started": "Fri, 21 Apr 2017 13:01:37 +0000",
      "ended": "Fri, 21 Apr 2017 13:01:43 +0000",
      "duration": 18,
      "price": 0.0294
      "record_sid": "rec23ed4a82-b7ee-31ff-b8dc-c89ea90d6d82",
      "tag": "MyClient_1"
      "channel": "number"
  },
 … ]
 }
ParameterDescription
limit

A parameter describing how many records are returned per page.

The default and maximum value is 20.

prev

URI to the previous page.

limit

URI to the next page.

next

A parameter describing how many records are returned per page.

calls

A list of calls.

calls/call_sid

Call identifier.

calls/parent_call_sid

Identifier of the parent call leg

calls/created

Call creation date. 'dateFormat' => 'Thu, 07 Jul 2016 10:15:53 +0000'

calls/account_sid

Account identifier.

calls/from

Caller’s phone number.

calls/to

Recipient’s phone number.

calls/direction

Call direction.

Either inbound or outbound.

calls/status

Call status.

One of the following: queued, initiated, ringing, answered, completed, no_answer, busy, rejected, failed, modified

See the Call Status section for more details

calls/controller

URL which used to make a request for an XML controller file.

calls/method

Method used to make a request.

calls/timeout

The number of seconds to wait for the answer of the 'to' number.

Important! The period starts when you send the request to API

calls/updated

Updated date.

calls/started

Call begin date and time. 'dateFormat' => 'Thu, 07 Jul 2016 10:15:53 +0000'

calls/ended

Call end date and time. 'dateFormat' => 'Thu, 07 Jul 2016 10:15:53 +0000'

calls/duration

Duration of the call in seconds.

calls/price

Cost of the call in EURO cents.

calls/record_sid

System identifier associated with the record file.

Notice: call status 'completed' does not indicate that the recording is ready for downloading. It will be ready after record_sid is available.

calls/tag

Optional string field; can be used for custom filtering of the calls

calls/channel

The call channel. The possible values are 'number' (for calling on local/mobile/SIP numbers), 'viber' (for calling on Viber).

RESPONSE FILTERING

To narrow the response results, specify filtering parameters in the GET request.

REQUEST EXAMPLE (WITH FILTERING)

The following curl request demonstrates getting a list of completed outbound calls.

curl –X GET https://api.apifonica.com/v2/accounts/{accountSID}/calls?direction=outbound&status=completed \
-u {accountSID}:{authToken}

FILTERING PARAMETERS

ParameterDescription
limit

A parameter describing how many records you want to return per page. The default and maximum value is 20.

prev

URI to the previous page.

next

URI to the next page.

call_sid

Call identifier.

created_after

Calls that were created after this date and time. 'dateFormat' => 'yyyy-mm - dd'

created_before

Calls that were created before this date and time. 'dateFormat' => 'yyyy-mm - dd'

account_sid

Account identifier.

to

Recipient’s phone number.

from

Caller’s phone number.

direction

Call direction.

Either inbound or outbound.

status

Call status.

One of the following: queued, initiated, ringing, answered, completed, no_answer, busy, rejected, failed, modified.

tag

Optional string field; can be used for custom filtering of the calls

channel

The call channel. The possible values are 'number' (for calling on local/mobile/SIP numbers), 'viber' (for calling on Viber)

CALL STATUS

Call events online statuses.
Please note, that not of all these statuses can be catched by GET request

ParameterDescription
queued

The call is ready and waiting in line before going out.

initiated

The call has been started

ringing

The call is currently ringing to the number 'to'.

answered

The call was answered and is currently in progress.

completed

The call was answered and has ended normally.

no_answer

The call ended without being answered.

canceled

The call was canceled by the initiating party before getting answered by the callee.

busy

The caller received a busy signal.

rejected

The call was canceled while queued or ringing.

failed

The call could not be completed as dialed, most likely because the phone number was non-existent

modified

The call was modified by API function Modify live call