Retrieve details of all calls

    This method allows you to retrieve details of all completed calls. The maximum number of results that can be fetched with a single API call is 20.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Call/

    Arguments

    subaccount optional

    The ID of the subaccount in case you would like to retrieve only calls made from a specific subaccount.

    call_direction optional

    The direction of the call in case you would like to filter results by call direction. The valid values are ‘inbound’ and ‘outbound’

    from_number optional

    The number from which the calls were made in case you would like to filter results by the number from which the call was made. You can filter the details by using the exact number or the desired prefix

    to_number optional

    The destination number to which the calls were made in case you would like to filter results by destination called.You can filter the details by using the exact number or the desired prefix

    parent_call_uuid optional

    Set this request parameter to the Call UUID of an A-Leg to fetch all the B-Legs associated with it.

    bill_duration optional

    Filter the results according to billed duration. The value of billed duration is in seconds. The filter can be used in one of the following five forms:

    • bill_duration: Input the exact value. E.g., to filter out calls that were exactly three minutes long, use bill_duration=180

    • bill_duration__gt: gt stands for greater than. E.g., to filter out calls that were more than two hours in duration bill_duration__gt=7200

    • bill_duration__gte: gte stands for greater than or equal to. E.g., to filter out calls that were two hours or more in duration bill_duration__gte=7200

    • bill_duration__lt: lt stands for lesser than. E.g., to filter out calls that were less than seven minutes in duration bill_duration__lt=420

    • bill_duration__lte: lte stands for lesser than or equal to. E.g., to filter out calls that were two hours or less in duration bill_duration__lte=7200

    end_time optional

    Filter calls by their completion time. The filter can be used in the following five forms:

    • end_time: The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended at 2012-03-21 11:47[:30], use end_time=2012-03-21 11:47[:30]

    • end_time__gt: gt stands for greater than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after 2012-03-21 11:47, use end_time__gt=2012-03-21 11:47

    • end_time__gte: gte stands for greater than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after or exactly at 2012-03-21 11:47[:30], use end_time__gte=2012-03-21 11:47[:30]

    • end_time__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before 2012-03-21 11:47, use end_time__lt=2012-03-21 11:47

    • end_time__lte: lte stands for lesser than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before or exactly at 2012-03-21 11:47[:30], use end_time__lte=2012-03-21 11:47[:30]

    Note: The above filters can be combined to get calls that ended in a particular time range. When no end_time filter is specified, a default search window of last 7 days is applied. When only end_time__[gt|gte] or end_time__[lt|lte] is specified, a search window of 30 days from/to the specified end_time__[gt|gte] / end_time__[lt|lte] is applied. The timestamps need to be UTC timestamps.
    hangup_cause_code optional

    Use this argument to retrieve calls that were hung up with a specific hangup cause. Refer to this guide for a comprehensive list of hangup causes and sources.

    hangup_source optional

    Use this argument to retrieve calls that were hung up by a specific hangup source. Refer to this guide for a comprehensive list of hangup causes and sources.

    limit optional

    Limits the number of results retrieved. The maximum it can be set to is 20. The default value is 20 as well.

    offset optional

    Denotes the number of value items by which the results should be offset. E.g., If the result contains a 1000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results.

    Returns

    Returns the call objects which match the filters specified in the request.

    Response

    HTTP Status Code: 200

    {
    	"api_id": "8299d094-dc72-11e5-b56c-22000ae90795",
    	"meta": {
    		"limit": 20,
    		"next": null,
    		"offset": 0,
    		"previous": null,
    		"total_count": 4
    	},
    	"objects": [
    		{
    			"answer_time": "2015-07-26 15:45:02+05:30",
    			"api_id": "06ae0f8f-dc72-11e5-b56c-22000ae90795",
    			"bill_duration": 924,
    			"billed_duration": 960,
    			"call_direction": "outbound",
    			"call_duration": 924,
    			"call_uuid": "eba53b9e-8fbd-45c1-9444-696d2172fbc8",
    			"end_time": "2015-07-26 15:45:14+05:30",
    			"from_number": "+14158572518",
    			"initiation_time": "2015-07-26 15:44:49+05:30",
    			"parent_call_uuid": null,
    			"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Call/eba53b9e-8fbd-45c1-9444-696d2172fbc8/",
    			"to_number": "14153268174",
    			"total_amount": "0.13600",
    			"total_rate": "0.00850"
    		},
    		{
    			"answer_time": "2015-07-26 16:45:02+05:30",
    			"api_id": "06ae0f8f-dc72-11e5-b56c-22000ae90795",
    			"bill_duration": 924,
    			"billed_duration": 960,
    			"call_direction": "outbound",
    			"call_duration": 924,
    			"call_uuid": "eba53b9e-8fbd-45c1-9444-696d2172fbc8",
    			"end_time": "2015-07-26 16:45:14+05:30",
    			"from_number": "+14158572518",
    			"initiation_time": "2015-07-26 16:44:49+05:30",
    			"parent_call_uuid": null,
    			"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Call/eba53b9e-8fbd-45c1-9444-696d2172fbc8/",
    			"to_number": "14153268174",
    			"total_amount": "0.13600",
    			"total_rate": "0.00850"
    		}
    	]
    }
    

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    
    import plivo
    
    client = plivo.RestClient()
    
    response = client.calls.list(
        limit=5,
        offset=0, )
    print(response)
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    #
    # Example for Call List
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN")
    
    begin
      response = api.calls.list(
        limit: 5,
        offset: 0
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    // Example for Call list
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
        // As the auth_id and auth_token are unspecified, Plivo will fetch them from the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables.
        var client = new plivo.Client();
        client.calls.list(
            {
                limit: 5,
                offset: 0,
            },
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    <?php
    /**
     * Example for Call list
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
    
    try {
        $response = $client->calls->list(
            [
            	'limit' => 5,
            	'offset' => 2
            ]
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r(ex);
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    
    package com.plivo.api.samples.call;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.call.Call;
    import com.plivo.api.models.base.ListResponse;
    
    /**
    * Example for Call list
    */
    class CallList {
        public static void main(String [] args) {
            Plivo.init();
            try {
                ListResponse<Call> response = Call.lister()
                    .limit(5)
                    .offset(0)
                    .list();
    
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    /**
     * Example for Call List
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
                try
                {
                    var response = api.Call.List(
                        limit:5,
                        offset:0
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    
    1
    2
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
      https://api.plivo.com/v1/Account/{auth_id}/Call/
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    // Example for Call list
    package main
    
    import "fmt"
    import "github.com/plivo/plivo-go"
     
    func main() {
    	client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	response, err := client.Calls.List(
    		plivo.CallListParams{
    			Limit: 5,
    			Offset: 0,
    		},
    	)
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    }