Menu

Expand
Rate this page:

Retrieve Call Logs with Node.js

In this guide we’ll show you how to how to retrieve information about in progress and completed calls from your Twilio account. The code snippets in this guide are written using modern JavaScript language features in Node.js version 6 or higher and make use of the Twilio Node.js SDK.

Let's get started!

The first thing we will need are your account credentials.

Retrieve your Twilio account credentials

First, you'll need to get your Twilio account credentials. They consist of your AccountSid and your Auth Token. They can be found on the home page of the console.

Retrieve Your Twilio Credentials

With our account credentials, we can us the Twilio Node.js module to retrieve Twilio call logs.

Retrieving call logs

You can use Twilio’s REST API to retrieve logs about the phone calls to and from your Twilio account. If you just want to check a couple logs, however, you should try looking at the voice logs in your Twilio console first.

To list all phone calls for your Twilio account, just call client.calls.list().

The list method automatically handles paging for you, eagerly fetching all records and paging under the hood. For more information, visit the Node.js Helper Library page.

Loading Code Sample...
        
        

        List All Calls Example

        You can also filter the results. This example only returns phone calls to the phone number "+15558675309" which had a call status of "busy" but you can filter on other call properties as well.

        Loading Code Sample...
              
              

              Retrieve Busy Calls To Specific Number Example

              Finally, if you just want to retrieve information about a specific call you can get that CallSid directly.

              Loading Code Sample...
                    
                    

                    Retrieve Call By Id Example

                    Where to next?

                    We just learned how to retrieve Twilio call logs using JavaScript. Check out our tutorials to see full implementations of Twilio Voice in Node.js with Express.

                    David Prothero Rob Spectre Ricky Robinett Kevin Whinnery Kat King Andrew Baker Jose Oliveros Sarah Stringer Daniel Erazo Brianna DelValle Diego Villavicencio
                    Rate this page:

                    Need some help?

                    We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                    Loading Code Sample...
                          
                          
                          

                          Thank you for your feedback!

                          Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                          Sending your feedback...
                          🎉 Thank you for your feedback!
                          Something went wrong. Please try again.

                          Thanks for your feedback!

                          thanks-feedback-gif