> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # List voice logs GET https://%7BYour_Space_Name%7D.signalwire.com/api/voice/logs Lists historical voice activity in the project across supported call types. Use it for usage reporting, billing review, and troubleshooting, not live call control. Place or control calls through [Send call commands](/docs/apis/rest/calls/call-commands) or the Compatibility Calls API instead. #### Permissions The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Voice_. [Learn more about API scopes](/docs/platform/your-signalwire-api-space). Reference: https://signalwire.com/docs/apis/rest/voice-logs/list-voice-logs ## Authentication - `Authorization` header (basic auth, required) — SignalWire Basic Authentication using Project ID and API Token. The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password. Example: ``` Authorization: Basic base64(project_id:token) ``` ## Request ### Query parameters - `include_deleted` (boolean, optional, default: false) — Include logs for deleted activity. - `created_before` (string, optional) — Return logs for activity prior to this date. - `created_on` (string, optional) — Return logs for activity on this date. - `created_after` (string, optional) — Return logs for activity after this date. - `page_number` (integer, optional, default: 0) — Page number to return. Requires `page_token` for values greater than 0. - `page_size` (integer, optional, default: 50) — Specify the number of results to return on a single page. The default page size is `50` and the maximum is `1000`. - `page_token` (string, optional) — Token for cursor-based pagination. Required when `page_number` is greater than 0. ## Response ### 200 The request has succeeded. - `links` (Voice.LogPaginationResponse, required) — Pagination links - `data` (list of Voice.VoiceLog, required) — Array of voice log entries ## Errors ### 400 Bad Request Error The request is invalid. - `error` (enum, required) - Allowed values: `Bad Request` ### 401 Unauthorized Error Access is unauthorized. - `error` (enum, required) - Allowed values: `Unauthorized` ### 422 Unprocessable Entity Error The request contains invalid parameters. See errors for details. - `errors` (list of Types.StatusCodes.RestApiErrorItem, required) — List of validation errors. ### 500 Internal Server Error An internal server error occurred. - `error` (enum, required) - Allowed values: `Internal Server Error` ## Types ### Voice.LogPaginationResponse Pagination links for voice log list responses - `self` (string, required) — URL of the current page. - `first` (string, required) — URL of the first page. - `next` (string, optional) — URL of the next page. Absent on the last page. - `prev` (string, optional) — URL of the previous page. Absent on the first page. ### Voice.VoiceLog A voice log entry. The specific fields present depend on the `type` value. Discarded logs return only `id`, `discarded_at`, and `created_at`. ### Types.StatusCodes.RestApiErrorItem Details about a specific error. - `type` (string, required) — The category of error. - `code` (string, required) — A specific error code. - `message` (string, required) — A description of what caused the error. - `url` (string, required) — A link to documentation about this error. - `attribute` (string, optional, nullable) — The request parameter that caused the error, if applicable. ### Voice.RelayVoiceLog Voice log for Compatibility and Relay call types. Returned when `type` is `laml_call`, `relay_pstn_call`, `relay_sip_call`, or `relay_webrtc_call`. - `id` (string, required) — A unique identifier for the log. - `from` (string, required) — The origin phone number. - `to` (string, required) — The destination phone number. - `source` (enum, required) — Source of this log entry. - Allowed values: `dialogflow`, `laml`, `realtime_api` - `charge` (double, required) — The charge in dollars. - `charge_details` (list of Voice.ChargeDetail, required) — Details on charges associated with this log. - `created_at` (datetime, required) — Date and time when the call entry was created. - `type` (enum, required) — Type of this log entry. - Allowed values: `laml_call`, `relay_pstn_call`, `relay_sip_call`, `relay_webrtc_call` - `url` (string, required, nullable) — URL for the resource associated with this log entry. Present for LAML calls, null for Relay calls. - `direction` (enum, required) — The direction of the voice activity. - Allowed values: `inbound`, `outbound`, `outbound-api`, `outbound-dial` - `status` (enum, required) — The status of the voice activity. - Allowed values: `queued`, `initiated`, `ringing`, `in-progress`, `busy`, `failed`, `no-answer`, `canceled`, `completed`, `ended`, `answered`, `created`, `ending`, `joined` - `duration` (integer, required, nullable) — The duration of the voice activity in seconds. - `duration_ms` (integer, required, nullable) — The duration of the voice activity in milliseconds. - `billing_ms` (integer, required, nullable) — The billable duration of the voice activity in milliseconds. - `parent_id` (string, required, nullable) — Parent log identifier for related call entries. ### Voice.VideoRoomVoiceLog Voice log for audio legs in a Video Room. Returned when `type` is `video_room_pstn_leg` or `video_room_sip_leg`. - `id` (string, required) — A unique identifier for the log. - `from` (string, required) — The origin phone number. - `to` (string, required) — The destination phone number. - `source` (enum, required) — Source of this log entry. - Allowed values: `dialogflow`, `laml`, `realtime_api` - `charge` (double, required) — The charge in dollars. - `charge_details` (list of Voice.ChargeDetail, required) — Details on charges associated with this log. - `created_at` (datetime, required) — Date and time when the call entry was created. - `type` (enum, required) — Type of this log entry. - Allowed values: `video_room_pstn_leg`, `video_room_sip_leg` - `url` (any, required) — Always null for this call type. - `direction` (enum, required) — The direction of the voice activity. - Allowed values: `inbound`, `outbound`, `outbound-api`, `outbound-dial` - `status` (enum, required) — The status of the voice activity. - Allowed values: `queued`, `initiated`, `ringing`, `in-progress`, `busy`, `failed`, `no-answer`, `canceled`, `completed`, `ended`, `answered`, `created`, `ending`, `joined` - `duration` (integer, required, nullable) — The duration of the voice activity in seconds. - `duration_ms` (integer, required, nullable) — The duration of the voice activity in milliseconds. ### Voice.DialogflowVoiceLog Voice log for Dialogflow call types. Returned when `type` is `dialogflow_call`. - `id` (string, required) — A unique identifier for the log. - `from` (string, required) — The origin phone number. - `to` (string, required) — The destination phone number. - `source` (enum, required) — Source of this log entry. - Allowed values: `dialogflow`, `laml`, `realtime_api` - `charge` (double, required) — The charge in dollars. - `charge_details` (list of Voice.ChargeDetail, required) — Details on charges associated with this log. - `created_at` (datetime, required) — Date and time when the call entry was created. - `type` (enum, required) — Type of this log entry. - Allowed values: `dialogflow_call` - `url` (any, required) — Always null for this call type. - `status` (enum, required) — The status of the voice activity. - Allowed values: `queued`, `initiated`, `ringing`, `in-progress`, `busy`, `failed`, `no-answer`, `canceled`, `completed`, `ended`, `answered`, `created`, `ending`, `joined` - `duration` (integer, required, nullable) — The duration of the voice activity in seconds. ### Voice.FabricVoiceLog Voice log for Fabric Subscriber Device call types. Returned when `type` is `fabric_subscriber_device_leg`. - `id` (string, required) — A unique identifier for the log. - `from` (string, required) — The origin phone number. - `to` (string, required) — The destination phone number. - `source` (enum, required) — Source of this log entry. - Allowed values: `dialogflow`, `laml`, `realtime_api` - `charge` (double, required) — The charge in dollars. - `charge_details` (list of Voice.ChargeDetail, required) — Details on charges associated with this log. - `created_at` (datetime, required) — Date and time when the call entry was created. - `type` (enum, required) — Type of this log entry. - Allowed values: `fabric_subscriber_device_leg` - `url` (any, required) — Always null for this call type. - `direction` (enum, required) — The direction of the voice activity. - Allowed values: `inbound`, `outbound`, `outbound-api`, `outbound-dial` - `status` (enum, required, nullable) — The status of the voice activity. Always null for this call type. - Allowed values: `queued`, `initiated`, `ringing`, `in-progress`, `busy`, `failed`, `no-answer`, `canceled`, `completed`, `ended`, `answered`, `created`, `ending`, `joined` ### Voice.DiscardedVoiceLog A discarded/deleted voice log entry. Returned when the log has been deleted. Only present when `include_deleted` is `true`. - `id` (string, required) — A unique identifier for the log. - `discarded_at` (datetime, required) — Date and time when the log was discarded. - `created_at` (datetime, required) — Date and time when the log was originally created. ### Voice.ChargeDetail Details on charges associated with this log. - `description` (string, required) — Description for this charge. - `charge` (double, required) — Charged amount. ## Examples ### Phone call **Response** ```json { "links": { "self": "https://example.signalwire.com/api/voice/logs?page_number=0&page_size=50", "first": "https://example.signalwire.com/api/voice/logs?page_size=50" }, "data": [ { "billing_ms": 60000, "charge": 0.01, "charge_details": [], "created_at": "2024-05-06T12:20:00Z", "direction": "inbound", "duration": 9, "duration_ms": 9638, "from": "+12065551212", "id": "b7182dc2-00f3-40e4-a5ce-20f164b329df", "parent_id": null, "source": "realtime_api", "status": "completed", "to": "+12065553434", "type": "relay_pstn_call", "url": null } ] } ``` **SDK Code** ```python Phone call import requests url = "https://{your_space_name}.signalwire.com/api/voice/logs" response = requests.get(url, auth=("", "")) print(response.json()) ``` ```javascript Phone call const url = 'https://{your_space_name}.signalwire.com/api/voice/logs'; const credentials = btoa(":"); const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Phone call package main import ( "fmt" "net/http" "io" ) func main() { url := "https://{your_space_name}.signalwire.com/api/voice/logs" req, _ := http.NewRequest("GET", url, nil) req.SetBasicAuth("", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Phone call require 'uri' require 'net/http' url = URI("https://{your_space_name}.signalwire.com/api/voice/logs") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request.basic_auth("", "") response = http.request(request) puts response.read_body ``` ```java Phone call import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://{your_space_name}.signalwire.com/api/voice/logs") .basicAuth("", "") .asString(); ``` ```php Phone call request('GET', 'https://{your_space_name}.signalwire.com/api/voice/logs', [ 'headers' => [ ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp Phone call using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://{your_space_name}.signalwire.com/api/voice/logs"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift Phone call import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = ["Authorization": "Basic \(credentials)"] let request = NSMutableURLRequest(url: NSURL(string: "https://{your_space_name}.signalwire.com/api/voice/logs")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### WhatsApp call **Response** ```json { "links": { "self": "https://example.signalwire.com/api/voice/logs?page_number=0&page_size=50", "first": "https://example.signalwire.com/api/voice/logs?page_size=50" }, "data": [ { "billing_ms": 60000, "charge": 0.01, "charge_details": [], "created_at": "2024-05-06T12:20:00Z", "direction": "inbound", "duration": 42, "duration_ms": 42310, "from": "+15551234567", "id": "7c1f6c1e-3b2a-4d9e-9f0b-2a6c8e5d4f31", "parent_id": null, "source": "realtime_api", "status": "completed", "to": "whatsapp:+15557654321", "type": "relay_pstn_call", "url": null } ] } ``` **SDK Code** ```python WhatsApp call import requests url = "https://{your_space_name}.signalwire.com/api/voice/logs" response = requests.get(url, auth=("", "")) print(response.json()) ``` ```javascript WhatsApp call const url = 'https://{your_space_name}.signalwire.com/api/voice/logs'; const credentials = btoa(":"); const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go WhatsApp call package main import ( "fmt" "net/http" "io" ) func main() { url := "https://{your_space_name}.signalwire.com/api/voice/logs" req, _ := http.NewRequest("GET", url, nil) req.SetBasicAuth("", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby WhatsApp call require 'uri' require 'net/http' url = URI("https://{your_space_name}.signalwire.com/api/voice/logs") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request.basic_auth("", "") response = http.request(request) puts response.read_body ``` ```java WhatsApp call import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://{your_space_name}.signalwire.com/api/voice/logs") .basicAuth("", "") .asString(); ``` ```php WhatsApp call request('GET', 'https://{your_space_name}.signalwire.com/api/voice/logs', [ 'headers' => [ ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp WhatsApp call using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://{your_space_name}.signalwire.com/api/voice/logs"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift WhatsApp call import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = ["Authorization": "Basic \(credentials)"] let request = NSMutableURLRequest(url: NSURL(string: "https://{your_space_name}.signalwire.com/api/voice/logs")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```