Open Context Protocol is live! 🚀 Read the launch post
listIncomingPhoneNumber

listIncomingPhoneNumber

Retrieve a list of incoming-phone-numbers belonging to the account used to make the request.

Details

  • Method: GET
  • Path: /2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json
  • Operation ID: ListIncomingPhoneNumber

Parameters

{
  "AccountSid": {
    "description": "The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resources to read.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "Beta": {
    "description": "Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "FriendlyName": {
    "description": "A string that identifies the IncomingPhoneNumber resources to read.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "PhoneNumber": {
    "description": "The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "phone-number"
  },
  "Origin": {
    "description": "Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "PageSize": {
    "description": "How many resources to return in each list page. The default is 50, and the maximum is 1000.",
    "required": false,
    "location": "query",
    "type": "integer",
    "format": "int64"
  },
  "Page": {
    "description": "The page index. This value is simply for client state.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "PageToken": {
    "description": "The page token. This is provided by the API.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "title": "ListIncomingPhoneNumberResponse",
  "type": "object",
  "properties": {
    "incoming_phone_numbers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "account_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^AC[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this IncomingPhoneNumber resource."
          },
          "address_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^AD[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the Address resource associated with the phone number."
          },
          "address_requirements": {
            "type": "string",
            "enum": [
              "none",
              "any",
              "local",
              "foreign"
            ],
            "description": "Whether the phone number requires an [Address](https://www.twilio.com/docs/usage/api/address) registered with Twilio. Can be: `none`, `any`, `local`, or `foreign`."
          },
          "api_version": {
            "type": "string",
            "nullable": true,
            "description": "The API version used to start a new TwiML session."
          },
          "beta": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the phone number is new to the Twilio platform. Can be: `true` or `false`."
          },
          "capabilities": {
            "type": "object",
            "format": "phone-number-capabilities",
            "x-class-extra-annotation": "@JsonInclude(JsonInclude.Include.NON_NULL)",
            "properties": {
              "mms": {
                "type": "boolean",
                "x-field-extra-annotation": "@JacksonXmlProperty(localName=\"MMS\")",
                "x-getter-extra-annotation": "@JacksonXmlProperty(localName=\"MMS\")"
              },
              "sms": {
                "type": "boolean",
                "x-field-extra-annotation": "@JacksonXmlProperty(localName=\"SMS\")",
                "x-getter-extra-annotation": "@JacksonXmlProperty(localName=\"SMS\")"
              },
              "voice": {
                "type": "boolean"
              },
              "fax": {
                "type": "boolean"
              }
            },
            "nullable": true,
            "description": "The set of Boolean properties that indicate whether a phone number can receive calls or messages.  Capabilities are  `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`."
          },
          "date_created": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format."
          },
          "date_updated": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format."
          },
          "friendly_name": {
            "type": "string",
            "nullable": true,
            "description": "The string that you assigned to describe the resource.",
            "x-twilio": {
              "pii": {
                "handling": "standard",
                "deleteSla": 30
              }
            }
          },
          "identity_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^RI[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations."
          },
          "phone_number": {
            "type": "string",
            "format": "phone-number",
            "nullable": true,
            "description": "The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number."
          },
          "origin": {
            "type": "string",
            "nullable": true,
            "description": "The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers."
          },
          "sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^PN[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The unique string that that we created to identify this IncomingPhoneNumber resource."
          },
          "sms_application_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^AP[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application."
          },
          "sms_fallback_method": {
            "type": "string",
            "format": "http-method",
            "enum": [
              "GET",
              "POST"
            ],
            "nullable": true,
            "description": "The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`."
          },
          "sms_fallback_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`."
          },
          "sms_method": {
            "type": "string",
            "format": "http-method",
            "enum": [
              "GET",
              "POST"
            ],
            "nullable": true,
            "description": "The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`."
          },
          "sms_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "The URL we call when the phone number receives an incoming SMS message."
          },
          "status_callback": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "The URL we call using the `status_callback_method` to send status information to your application."
          },
          "status_callback_method": {
            "type": "string",
            "format": "http-method",
            "enum": [
              "GET",
              "POST"
            ],
            "nullable": true,
            "description": "The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`."
          },
          "trunk_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^TK[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa."
          },
          "uri": {
            "type": "string",
            "nullable": true,
            "description": "The URI of the resource, relative to `https://api.twilio.com`."
          },
          "voice_receive_mode": {
            "type": "string",
            "enum": [
              "voice",
              "fax"
            ]
          },
          "voice_application_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^AP[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa."
          },
          "voice_caller_id_lookup": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`."
          },
          "voice_fallback_method": {
            "type": "string",
            "format": "http-method",
            "enum": [
              "GET",
              "POST"
            ],
            "nullable": true,
            "description": "The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`."
          },
          "voice_fallback_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`."
          },
          "voice_method": {
            "type": "string",
            "format": "http-method",
            "enum": [
              "GET",
              "POST"
            ],
            "nullable": true,
            "description": "The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`."
          },
          "voice_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set."
          },
          "emergency_status": {
            "type": "string",
            "enum": [
              "Active",
              "Inactive"
            ],
            "description": "The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country."
          },
          "emergency_address_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^AD[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the emergency address configuration that we use for emergency calling from this phone number."
          },
          "emergency_address_status": {
            "type": "string",
            "enum": [
              "registered",
              "unregistered",
              "pending-registration",
              "registration-failure",
              "pending-unregistration",
              "unregistration-failure"
            ],
            "description": "The status of address registration with emergency services. A registered emergency address will be used during handling of emergency calls from this number."
          },
          "bundle_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^BU[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations."
          },
          "status": {
            "type": "string",
            "nullable": true
          }
        }
      }
    },
    "end": {
      "type": "integer"
    },
    "first_page_uri": {
      "format": "uri",
      "type": "string"
    },
    "next_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "page": {
      "type": "integer"
    },
    "page_size": {
      "type": "integer"
    },
    "previous_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "start": {
      "type": "integer"
    },
    "uri": {
      "format": "uri",
      "type": "string"
    }
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('twilio')

# Call this tool
result = await agent.call_tool('listIncomingPhoneNumber', {
    # Add required parameters here
})