# Outbound Phone Number Report Resource

## Overview

> \[!NOTE]
>
> **Not a HIPAA Eligible Service**
>
> Voice Insights Reports API is not a HIPAA Eligible Service and should not be used in workflows that are subject to HIPAA.

An **Outbound Phone Number Report** aggregates Voice Insights metrics for calls placed from a specific phone number handle.

## Outbound Phone Number Report Properties

<OperationTable
  type="body"
  data={{
    encodingType: "application/json",
    schema: {
      type: "object",
      properties: {
        handle: {
          type: "string",
          'x-twilio': {
            shortDescription: "Outbound caller.",
            pii: { handling: "standard", deleteSla: 30 },
          },
          description: "Outbound phone number handle represented in the report.",
        },
        total_calls: {
          type: "integer",
          description: "Total number of outbound calls made during the report period.",
        },
        call_answer_score: {
          type: "number",
          format: "float",
          description: "Score (0-100) representing how often outbound calls were answered.",
        },
        calls_by_device_type: {
          type: "object",
          additionalProperties: { type: "integer" },
          description: "Number of outbound calls placed per device type (voip, mobile, landline, unknown).",
          example: { voip: 150, mobile: 300, landline: 100, unknown: 50 },
        },
        answer_rate_device_type: {
          type: "object",
          additionalProperties: { type: "number", format: "float" },
          description: "Answer rate per device type (voip, mobile, landline, unknown).",
          example: { voip: 75, mobile: 80, landline: 70, unknown: 60 },
        },
        call_state_percentage: {
          type: "object",
          description: "Percentage of outbound calls by call state (completed, fail, busy, no-answer, canceled).",
          properties: {
            completed: {
              type: "number",
              format: "float",
              description: "Percentage of completed outbound calls.",
            },
            fail: {
              type: "number",
              format: "float",
              description: "Percentage of failed state outbound calls.",
            },
            busy: {
              type: "number",
              format: "float",
              description: "Percentage of busy state outbound calls that received a busy signal.",
            },
            noanswer: {
              type: "number",
              format: "float",
              description: "Percentage of outbound calls that were rejected or not answered.",
            },
            canceled: {
              type: "number",
              format: "float",
              description: "Percentage of canceled outbound calls which were hung up while it’s still ringing or in a queue.",
            },
          },
        },
        blocked_calls_by_carrier: {
          type: "array",
          description: "Associated metrics for completed outbound calls which are blocked by respective downstream carriers. Currently only the US carriers such as ATT, T-Mobile and Verizon provide this information.",
          items: {
            type: "object",
            properties: {
              country: { type: "string" },
              carriers: {
                type: "array",
                items: {
                  type: "object",
                  properties: {
                    carrier: { type: "string", description: "The name of Carrier." },
                    total_calls: {
                      type: "integer",
                      description: "Total outbound calls that were made by the carrier.",
                    },
                    blocked_calls: { type: "integer", description: "The number of calls blocked by the carrier." },
                    blocked_calls_percentage: {
                      type: "number",
                      format: "float",
                      description: "Percentage of blocked calls over total outbound calls under the carrier.",
                    },
                  },
                },
              },
            },
          },
        },
        silent_calls_percentage: {
          type: "number",
          format: "float",
          description: "Percentage of calls with silence tags over total calls. A silent tag is indicative of a connectivity issue or muted audio.",
        },
        short_duration_calls_percentage: {
          type: "number",
          format: "float",
          description: "Percentage of completed outbound calls under 10 seconds; More than 15% is typically low trust measured.",
        },
        long_duration_calls_percentage: {
          type: "number",
          format: "float",
          description: "Percentage of outbound calls lasting 60 seconds or longer.",
        },
        potential_robocalls_percentage: {
          type: "number",
          format: "float",
          description: "Percentage of completed outbound calls to unassigned or unallocated phone numbers.",
        },
        answering_machine_detection: {
          type: "object",
          description: "Associated answering machine detection enabled calls.",
          properties: {
            total_calls: {
              type: "integer",
              description: "The number of outbound calls with answering machine detection (AMD) enabled.",
            },
            answered_by_human_percentage: {
              type: "number",
              format: "float",
              description: "Percentage of calls marked as answered by a human.",
            },
            answered_by_machine_percentage: {
              type: "number",
              format: "float",
              description: "Percentage of calls marked as answered by a machine-related outcome.",
            },
          },
        },
      },
    },
  }}
/>

## Create Outbound Phone Numbers Report properties

> \[!NOTE]
>
> A Voice Insights Report will be available for 5 days after it is created.

```json
{"type":"object","refName":"insights.v2.create_report_response","modelName":"insights_v2_create_report_response","properties":{"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","description":"The unique SID identifier of the Account."},"report_id":{"type":"string","description":"The report identifier as Voice Insights Report TTID."},"status":{"type":"string","enum":["created","running","completed"],"description":"The status of the report.","refName":"report_status","modelName":"report_status"},"request_meta":{"type":"object","refName":"report_metadata","modelName":"report_metadata","properties":{"start_time":{"type":"string","format":"date-time","description":"Start time of the report"},"end_time":{"type":"string","format":"date-time","description":"End time of the report"},"filters":{"type":"array","default":[],"description":"Filter values applied to the report","items":{"type":"object","refName":"report_filter","modelName":"report_filter","properties":{"key":{"type":"string","description":"The name of the filter\n'call_state', 'call_direction', 'call_type', 'twilio_regions', 'caller_country_code', 'callee_country_code', 'silent'\n"},"values":{"type":"array","description":"List of supported filter values for the field name","items":{"type":"string"}}}}}}},"url":{"type":"string","format":"uri","nullable":true,"description":"The URL of this resource."}}}
```

## Create Outbound Phone Number Reports

`POST https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound`

### Request body parameters

```json
{"schema":{"type":"object","refName":"insights.v2.create_phone_numbers_report_request","modelName":"insights_v2_create_phone_numbers_report_request","properties":{"time_range":{"type":"object","properties":{"start_time":{"type":"string","format":"date-time","description":"Start time of the report","example":"2024-01-01T00:00:00Z","x-twilio":{"shortDescription":"Start time of the report"}},"end_time":{"type":"string","format":"date-time","description":"End time of the report","example":"2024-01-07T00:00:00Z","x-twilio":{"shortDescription":"Start time of the report"}}}},"filters":{"type":"array","items":{"type":"object","refName":"phone_number_report_filter","modelName":"phone_number_report_filter","properties":{"key":{"type":"string","description":"The name of the filter\n"},"values":{"type":"array","description":"List of supported filter values for the field name","items":{"type":"string"}}}}},"size":{"type":"integer","default":1000,"minimum":1,"maximum":6000,"description":"The number of max available top Phone Numbers to generate."}}},"encodingType":"application/json","conditionalParameterMap":{}}
```

The recent 7 days report can be created without any parameters.

Create Outbound Phone Number Reports

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createOutboundPhoneNumbersReport() {
  const outbound = await client.insights.v2.outbound().create();

  console.log(outbound.accountSid);
}

createOutboundPhoneNumbersReport();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
from twilio.rest.insights.v2 import OutboundPhoneNumbersReportList

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

outbound = client.insights.v2.outbound().create()

print(outbound.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Insights.V2;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var outbound = await OutboundResource.CreateAsync();

        Console.WriteLine(outbound.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.insights.v2.Outbound;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Outbound outbound = Outbound.creator().create();

        System.out.println(outbound.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	insights "github.com/twilio/twilio-go/rest/insights/v2"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &insights.CreateOutboundPhoneNumbersReportParams{}

	resp, err := client.InsightsV2.CreateOutboundPhoneNumbersReport(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(resp.AccountSid)
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;
use Twilio\Rest\Insights\V2\OutboundPhoneNumbersReportModels;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$outbound = $twilio->insights->v2->outbound()->create();

print $outbound->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

outbound = @client
           .insights
           .v2
           .outbound
           .create

puts outbound.account_sid
```

```bash
# This endpoint is not currently supported by the Twilio CLI. You can open an issue to request it on https://github.com/twilio/twilio-cli/issues
  # For an alternative low-code solution, check out https://www.twilio.com/docs/openapi/using-twilio-postman-collections
```

```bash
curl -X POST "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "report_id": "voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av",
  "status": "created",
  "request_meta": {
    "start_time": "2024-11-01T00:00:00Z",
    "end_time": "2024-11-07T00:00:00Z",
    "filters": []
  },
  "url": "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound/voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av"
}
```

Generate outbound reports for a specific period by providing the `time_range` parameter.

Create Outbound Phone Number Reports with Date Time Range

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createOutboundPhoneNumbersReport() {
  const outbound = await client.insights.v2.outbound().create({
    time_range: {
      start_datetime: "2024-10-15T00:00:00Z",
      end_datetime: "2024-11-07T00:00:00Z",
    },
  });

  console.log(outbound.accountSid);
}

createOutboundPhoneNumbersReport();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
from twilio.rest.insights.v2 import OutboundPhoneNumbersReportList

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

outbound = client.insights.v2.outbound().create(
    insights_v2_create_phone_numbers_report_request=OutboundPhoneNumbersReportList.InsightsV2CreatePhoneNumbersReportRequest(
        {
            "time_range": OutboundPhoneNumbersReportList.InsightsV2CreatePhoneNumbersReportRequestTimeRange(
                {
                    "start_datetime": "2024-10-15T00:00:00Z",
                    "end_datetime": "2024-11-07T00:00:00Z",
                }
            )
        }
    )
)

print(outbound.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Insights.V2;
using System.Threading.Tasks;
using System.Collections.Generic;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var outbound = await OutboundResource.CreateAsync(
            insightsV2CreatePhoneNumbersReportRequest: new OutboundResource
                .InsightsV2CreatePhoneNumbersReportRequest.Builder()
                .WithTimeRange(
                    new OutboundResource.InsightsV2CreatePhoneNumbersReportRequestTimeRange
                        .Builder()
                        .WithStartDatetime("2024-10-15T00:00:00Z")
                        .WithEndDatetime("2024-11-07T00:00:00Z")
                        .Build())
                .Build());

        Console.WriteLine(outbound.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import java.util.HashMap;
import com.twilio.Twilio;
import com.twilio.rest.insights.v2.Outbound;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        Outbound.InsightsV2CreatePhoneNumbersReportRequestTimeRange timeRange =
            new Outbound.InsightsV2CreatePhoneNumbersReportRequestTimeRange();
        timeRange.setStartDatetime("2024-10-15T00:00:00Z");
        timeRange.setEndDatetime("2024-11-07T00:00:00Z");

        Outbound.InsightsV2CreatePhoneNumbersReportRequest insightsV2CreatePhoneNumbersReportRequest =
            new Outbound.InsightsV2CreatePhoneNumbersReportRequest();
        insightsV2CreatePhoneNumbersReportRequest.setTimeRange(insightsV2CreatePhoneNumbersReportRequestTimeRange);

        Outbound outbound = Outbound.creator(insightsV2CreatePhoneNumbersReportRequest).create();

        System.out.println(outbound.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	insights "github.com/twilio/twilio-go/rest/insights/v2"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &insights.CreateOutboundPhoneNumbersReportParams{}
	params.SetInsightsV2CreatePhoneNumbersReportRequest(insights.insights_v2_create_phone_numbers_report_request{
		TimeRange: insights.InsightsV2CreatePhoneNumbersReportRequestTimeRange{
			StartDatetime: "2024-10-15T00:00:00Z",
			EndDatetime:   "2024-11-07T00:00:00Z",
		},
	})

	resp, err := client.InsightsV2.CreateOutboundPhoneNumbersReport(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(resp.AccountSid)
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;
use Twilio\Rest\Insights\V2\OutboundPhoneNumbersReportModels;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$outbound = $twilio->insights->v2->outbound()->create(
    OutboundPhoneNumbersReportModels::createInsightsV2CreatePhoneNumbersReportRequest(
        [
            "timeRange" => OutboundPhoneNumbersReportModels::createInsightsV2CreatePhoneNumbersReportRequestTimeRange(
                [
                    "startDatetime" => "2024-10-15T00:00:00Z",
                    "endDatetime" => "2024-11-07T00:00:00Z",
                ]
            ),
        ]
    )
);

print $outbound->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

outbound = @client
           .insights
           .v2
           .outbound
           .create(
             insights_v2_create_phone_numbers_report_request: {
               'time_range' => {
                 'start_datetime' => '2024-10-15T00:00:00Z',
                 'end_datetime' => '2024-11-07T00:00:00Z'
               }
             }
           )

puts outbound.account_sid
```

```bash
# This endpoint is not currently supported by the Twilio CLI. You can open an issue to request it on https://github.com/twilio/twilio-cli/issues
  # For an alternative low-code solution, check out https://www.twilio.com/docs/openapi/using-twilio-postman-collections
```

```bash
INSIGHTS_V2_CREATE_PHONE_NUMBERS_REPORT_REQUEST_OBJ=$(cat << EOF
{
  "time_range": {
    "start_datetime": "2024-10-15T00:00:00Z",
    "end_datetime": "2024-11-07T00:00:00Z"
  }
}
EOF
)
curl -X POST "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound" \
--json "$INSIGHTS_V2_CREATE_PHONE_NUMBERS_REPORT_REQUEST_OBJ" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "report_id": "voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av",
  "status": "created",
  "request_meta": {
    "start_time": "2024-11-01T00:00:00Z",
    "end_time": "2024-11-07T00:00:00Z",
    "filters": []
  },
  "url": "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound/voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av"
}
```

Generate a specific number of outbound reports by providing the `size` parameter.

Create Outbound Phone Number Reports with Specific Size

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createOutboundPhoneNumbersReport() {
  const outbound = await client.insights.v2.outbound().create({
    time_range: {
      start_datetime: "2024-10-15T00:00:00Z",
      end_datetime: "2024-11-07T00:00:00Z",
    },
    size: 100,
  });

  console.log(outbound.accountSid);
}

createOutboundPhoneNumbersReport();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
from twilio.rest.insights.v2 import OutboundPhoneNumbersReportList

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

outbound = client.insights.v2.outbound().create(
    insights_v2_create_phone_numbers_report_request=OutboundPhoneNumbersReportList.InsightsV2CreatePhoneNumbersReportRequest(
        {
            "time_range": OutboundPhoneNumbersReportList.InsightsV2CreatePhoneNumbersReportRequestTimeRange(
                {
                    "start_datetime": "2024-10-15T00:00:00Z",
                    "end_datetime": "2024-11-07T00:00:00Z",
                }
            ),
            "size": 100,
        }
    )
)

print(outbound.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Insights.V2;
using System.Threading.Tasks;
using System.Collections.Generic;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var outbound = await OutboundResource.CreateAsync(
            insightsV2CreatePhoneNumbersReportRequest: new OutboundResource
                .InsightsV2CreatePhoneNumbersReportRequest.Builder()
                .WithTimeRange(
                    new OutboundResource.InsightsV2CreatePhoneNumbersReportRequestTimeRange
                        .Builder()
                        .WithStartDatetime("2024-10-15T00:00:00Z")
                        .WithEndDatetime("2024-11-07T00:00:00Z")
                        .Build())
                .WithSize(100)
                .Build());

        Console.WriteLine(outbound.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import java.util.HashMap;
import com.twilio.Twilio;
import com.twilio.rest.insights.v2.Outbound;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        Outbound.InsightsV2CreatePhoneNumbersReportRequestTimeRange timeRange =
            new Outbound.InsightsV2CreatePhoneNumbersReportRequestTimeRange();
        timeRange.setStartDatetime("2024-10-15T00:00:00Z");
        timeRange.setEndDatetime("2024-11-07T00:00:00Z");

        Outbound.InsightsV2CreatePhoneNumbersReportRequest insightsV2CreatePhoneNumbersReportRequest =
            new Outbound.InsightsV2CreatePhoneNumbersReportRequest();
        insightsV2CreatePhoneNumbersReportRequest.setTimeRange(insightsV2CreatePhoneNumbersReportRequestTimeRange);
        insightsV2CreatePhoneNumbersReportRequest.setSize(100);

        Outbound outbound = Outbound.creator(insightsV2CreatePhoneNumbersReportRequest).create();

        System.out.println(outbound.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	insights "github.com/twilio/twilio-go/rest/insights/v2"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &insights.CreateOutboundPhoneNumbersReportParams{}
	params.SetInsightsV2CreatePhoneNumbersReportRequest(insights.insights_v2_create_phone_numbers_report_request{
		TimeRange: insights.InsightsV2CreatePhoneNumbersReportRequestTimeRange{
			StartDatetime: "2024-10-15T00:00:00Z",
			EndDatetime:   "2024-11-07T00:00:00Z",
		},
		Size: 100,
	})

	resp, err := client.InsightsV2.CreateOutboundPhoneNumbersReport(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(resp.AccountSid)
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;
use Twilio\Rest\Insights\V2\OutboundPhoneNumbersReportModels;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$outbound = $twilio->insights->v2->outbound()->create(
    OutboundPhoneNumbersReportModels::createInsightsV2CreatePhoneNumbersReportRequest(
        [
            "timeRange" => OutboundPhoneNumbersReportModels::createInsightsV2CreatePhoneNumbersReportRequestTimeRange(
                [
                    "startDatetime" => "2024-10-15T00:00:00Z",
                    "endDatetime" => "2024-11-07T00:00:00Z",
                ]
            ),
            "size" => 100,
        ]
    )
);

print $outbound->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

outbound = @client
           .insights
           .v2
           .outbound
           .create(
             insights_v2_create_phone_numbers_report_request: {
               'time_range' => {
                 'start_datetime' => '2024-10-15T00:00:00Z',
                 'end_datetime' => '2024-11-07T00:00:00Z'
               },
               'size' => 100
             }
           )

puts outbound.account_sid
```

```bash
# This endpoint is not currently supported by the Twilio CLI. You can open an issue to request it on https://github.com/twilio/twilio-cli/issues
  # For an alternative low-code solution, check out https://www.twilio.com/docs/openapi/using-twilio-postman-collections
```

```bash
INSIGHTS_V2_CREATE_PHONE_NUMBERS_REPORT_REQUEST_OBJ=$(cat << EOF
{
  "time_range": {
    "start_datetime": "2024-10-15T00:00:00Z",
    "end_datetime": "2024-11-07T00:00:00Z"
  },
  "size": 100
}
EOF
)
curl -X POST "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound" \
--json "$INSIGHTS_V2_CREATE_PHONE_NUMBERS_REPORT_REQUEST_OBJ" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "report_id": "voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av",
  "status": "created",
  "request_meta": {
    "start_time": "2024-11-01T00:00:00Z",
    "end_time": "2024-11-07T00:00:00Z",
    "filters": []
  },
  "url": "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound/voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av"
}
```

## Fetch Outbound Phone Number Reports

`GET https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound/{reportId}`

### Path parameters

```json
[{"name":"reportId","in":"path","description":"A unique Report Id.","schema":{"type":"string"},"required":true}]
```

### Query parameters

```json
[{"name":"PageSize","in":"query","description":"How many resources to return in each list page.","schema":{"type":"integer","format":"int64","minimum":1,"maximum":1000}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

Fetch Outbound Phone Number Reports

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function listOutboundPhoneNumbersReport() {
  const outbounds = await client.insights.v2
    .outbound("voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av")
    .list({ limit: 20 });

  outbounds.forEach((o) => console.log(o.handle));
}

listOutboundPhoneNumbersReport();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

outbounds = client.insights.v2.outbound(
    "voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av"
).list(limit=20)

for record in outbounds:
    print(record.handle)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Insights.V2;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var outbounds = await OutboundResource.ReadAsync(
            pathReportId: "voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av", limit: 20);

        foreach (var record in outbounds) {
            Console.WriteLine(record.Handle);
        }
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.insights.v2.Outbound;
import com.twilio.base.ResourceSet;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<Outbound> outbounds =
            Outbound.reader("voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av").limit(20).read();

        for (Outbound record : outbounds) {
            System.out.println(record.getHandle());
        }
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	insights "github.com/twilio/twilio-go/rest/insights/v2"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &insights.ListOutboundPhoneNumbersReportParams{}
	params.SetLimit(20)

	resp, err := client.InsightsV2.ListOutboundPhoneNumbersReport("voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			fmt.Println(resp[record].Handle)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$outbounds = $twilio->insights->v2
    ->outbound("voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av")
    ->read(20);

foreach ($outbounds as $record) {
    print $record->handle;
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

outbounds = @client
            .insights
            .v2
            .outbound('voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av')
            .list(limit: 20)

outbounds.each do |record|
   puts record.handle
end
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:insights:v2:voice:reports:phone-numbers:outbound:list \
   --report-id voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av
```

```bash
curl -X GET "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound/voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "meta": {
    "page": 0,
    "page_size": 50,
    "first_page_url": "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound/voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av?PageSize=50&Page=0",
    "previous_page_url": null,
    "url": "https://insights.twilio.com/v2/Voice/Reports/PhoneNumbers/Outbound/voiceinsights_report_01jmzm99cte5rrbbhv8bctd4av?PageSize=50&Page=0",
    "next_page_url": null,
    "key": "reports"
  },
  "reports": []
}
```
