> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List available phone numbers



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/searching.yml get /available_phone_numbers
openapi: 3.1.0
info:
  title: Telnyx Phone Number Search API
  version: 2.0.0
  description: API for searching available phone numbers.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /available_phone_numbers:
    get:
      tags:
        - Phone Number Search
      summary: List available phone numbers
      operationId: ListAvailablePhoneNumbers
      parameters:
        - name: filter
          in: query
          style: deepObject
          explode: true
          description: >-
            Consolidated filter parameter (deepObject style). Originally:
            filter[phone_number], filter[locality], filter[administrative_area],
            filter[country_code], filter[national_destination_code],
            filter[rate_center], filter[phone_number_type], filter[features],
            filter[limit], filter[best_effort], filter[quickship],
            filter[reservable], filter[exclude_held_numbers]
          schema:
            type: object
            properties:
              phone_number:
                type: object
                description: Filter phone numbers by pattern matching.
                properties:
                  starts_with:
                    type: string
                    description: >-
                      Filter numbers starting with a pattern (excludes NDC if
                      used with `national_destination_code` filter).
                  ends_with:
                    type: string
                    description: >-
                      Filter numbers ending with a pattern (excludes NDC if used
                      with `national_destination_code` filter).
                  contains:
                    type: string
                    description: >-
                      Filter numbers containing a pattern (excludes NDC if used
                      with `national_destination_code` filter).
                additionalProperties: false
              locality:
                type: string
                description: Filter phone numbers by city.
              administrative_area:
                type: string
                description: Find numbers in a particular US state or CA province.
              country_code:
                type: string
                description: Filter phone numbers by country.
              national_destination_code:
                type: string
                description: Filter by the national destination code of the number.
              rate_center:
                type: string
                description: >-
                  Filter phone numbers by rate center. This filter is only
                  applicable to USA and Canada numbers.
              phone_number_type:
                type: string
                enum:
                  - local
                  - toll_free
                  - mobile
                  - national
                  - shared_cost
                description: Filter phone numbers by number type.
              features:
                type: array
                items:
                  type: string
                  enum:
                    - sms
                    - mms
                    - voice
                    - fax
                    - emergency
                    - hd_voice
                    - international_sms
                    - local_calling
                description: Filter phone numbers with specific features.
              limit:
                type: integer
                description: Limits the number of results.
              best_effort:
                type: boolean
                description: >-
                  Filter to determine if best effort results should be included.
                  Only available in USA/CANADA.
              quickship:
                type: boolean
                description: >-
                  Filter to exclude phone numbers that need additional time
                  after to purchase to activate. Only applicable for +1
                  toll_free numbers.
              reservable:
                type: boolean
                description: >-
                  Filter to ensure only numbers that can be reserved are
                  included in the results.
              exclude_held_numbers:
                type: boolean
                description: >-
                  Filter to exclude phone numbers that are currently on
                  hold/reserved for your account.
      responses:
        '200':
          $ref: '#/components/responses/ListAvailablePhoneNumbersResponse'
        '400':
          $ref: '#/components/responses/numbers_BadRequestResponse'
        '401':
          $ref: '#/components/responses/numbers_UnauthorizedResponse'
        '404':
          $ref: '#/components/responses/numbers_NotFoundResponse'
        '422':
          $ref: '#/components/responses/numbers_UnprocessableEntity'
        '500':
          $ref: '#/components/responses/numbers_GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const availablePhoneNumbers = await
            client.availablePhoneNumbers.list();


            console.log(availablePhoneNumbers.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            available_phone_numbers = client.available_phone_numbers.list()
            print(available_phone_numbers.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tavailablePhoneNumbers, err := client.AvailablePhoneNumbers.List(context.TODO(), telnyx.AvailablePhoneNumberListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", availablePhoneNumbers.Data)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.availablephonenumbers.AvailablePhoneNumberListParams;

            import
            com.telnyx.sdk.models.availablephonenumbers.AvailablePhoneNumberListResponse;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    AvailablePhoneNumberListResponse availablePhoneNumbers = client.availablePhoneNumbers().list();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            available_phone_numbers = telnyx.available_phone_numbers.list

            puts(available_phone_numbers)
        - lang: CLI
          source: |-
            telnyx available-phone-numbers list \
              --api-key 'My API Key'
components:
  responses:
    ListAvailablePhoneNumbersResponse:
      description: Successful response with a list of available phone numbers.
      content:
        application/json:
          schema:
            type: object
            title: List Available Phone Numbers Response
            properties:
              data:
                type: array
                items:
                  $ref: '#/components/schemas/AvailablePhoneNumber'
              meta:
                $ref: '#/components/schemas/AvailablePhoneNumbersMetadata'
              metadata:
                $ref: '#/components/schemas/AvailablePhoneNumbersMetadata'
    numbers_BadRequestResponse:
      description: >-
        Bad request, the request was unacceptable, often due to missing a
        required parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
    numbers_UnauthorizedResponse:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
          examples:
            Authentication Failed:
              value:
                errors:
                  - code: '10009'
                    title: Authentication failed
                    detail: Could not understand the provided credentials.
                    meta:
                      url: https://developers.telnyx.com/docs/overview/errors/10009
    numbers_NotFoundResponse:
      description: The requested resource doesn't exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
    numbers_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
    numbers_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
  schemas:
    AvailablePhoneNumber:
      type: object
      properties:
        record_type:
          type: string
          example: available_phone_number
          enum:
            - available_phone_number
        phone_number:
          type: string
          example: '+19705555098'
        vanity_format:
          type: string
        best_effort:
          type: boolean
          description: >-
            Specifies whether the phone number is an exact match based on the
            search criteria or not.
          example: false
        quickship:
          type: boolean
          description: >-
            Specifies whether the phone number can receive calls immediately
            after purchase or not.
          example: true
        reservable:
          type: boolean
          description: >-
            Specifies whether the phone number can be reserved before purchase
            or not.
          example: true
        region_information:
          type: array
          items:
            $ref: '#/components/schemas/RegionInformation'
        cost_information:
          $ref: '#/components/schemas/CostInformation'
        features:
          type: array
          items:
            $ref: '#/components/schemas/Feature'
      example:
        record_type: available_phone_number
        phone_number: '+19705555098'
        vanity_format: ''
        best_effort: false
        quickship: true
        reservable: true
        region_information:
          - region_type: country_code
            region_name: US
        cost_information:
          upfront_cost: '3.21'
          monthly_cost: '6.54'
          currency: USD
        features:
          - name: sms
          - name: voice
    AvailablePhoneNumbersMetadata:
      type: object
      example:
        total_results: 100
        best_effort_results: 50
      properties:
        total_results:
          type: integer
          example: 1
        best_effort_results:
          type: integer
          example: 0
    numbers_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/numbers_Error'
      type: object
    RegionInformation:
      properties:
        region_type:
          type: string
          example: country_code
          enum:
            - country_code
            - rate_center
            - state
            - location
        region_name:
          type: string
          example: US
      example:
        region_type: country_code
        region_name: US
      type: object
    CostInformation:
      type: object
      properties:
        upfront_cost:
          type: string
          example: '3.21'
        monthly_cost:
          type: string
          example: '6.54'
        currency:
          type: string
          description: The ISO 4217 code for the currency.
          example: USD
      example:
        upfront_cost: '3.21'
        monthly_cost: '6.54'
        currency: USD
    Feature:
      properties:
        name:
          type: string
          example: sms
      example:
        name: sms
      type: object
    numbers_Error:
      properties:
        code:
          type: string
          example: '10007'
        title:
          type: string
          example: Unexpected error
        detail:
          type: string
          example: An unexpected error occured.
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
              example: /base
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          properties:
            url:
              type: string
              description: URL with additional information on the error.
              example: https://developers.telnyx.com/docs/overview/errors/10015
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````