Telnyx Phone Number Search API

Number search

OpenAPI Specification

telnyx-phone-number-search-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: support@telnyx.com
  description: Telnyx provides global communications and connectivity APIs for developers — including SIP trunking, programmable voice, SMS, MMS, WhatsApp Business Messaging, Call Control, Fax, Wireless (IoT & eSIM), Phone Numbers (DID provisioning & porting), Emergency Services, and Network APIs for private interconnects and edge connectivity. Build, scale, and manage voice, messaging, and data networks with Telnyx's carrier-grade global infrastructure and API-first platform.
  title: Telnyx Access Tokens Phone Number Search API
  version: 2.0.0
  x-endpoint-cost: light
servers:
- description: Version 2.0.0 of the Telnyx API
  url: https://api.telnyx.com/v2
security:
- bearerAuth: []
tags:
- description: Number search
  name: Phone Number Search
paths:
  /available_phone_number_blocks:
    get:
      operationId: ListAvailablePhoneNumberBlocks
      parameters:
      - description: 'Consolidated filter parameter (deepObject style). Originally: filter[locality], filter[country_code], filter[national_destination_code], filter[phone_number_type]'
        explode: true
        in: query
        name: filter
        schema:
          properties:
            country_code:
              description: Filter phone numbers by country.
              type: string
            locality:
              description: Filter phone numbers by city.
              type: string
            national_destination_code:
              description: Filter by the national destination code of the number.
              type: string
            phone_number_type:
              description: Filter phone numbers by number type.
              enum:
              - local
              - toll_free
              - mobile
              - national
              - shared_cost
              type: string
          type: object
        style: deepObject
      responses:
        '200':
          $ref: '#/components/responses/ListAvailablePhoneNumbersBlockResponse'
        '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'
      summary: List available phone number blocks
      tags:
      - Phone Number Search
      x-latency-category: responsive
  /available_phone_numbers:
    get:
      operationId: ListAvailablePhoneNumbers
      parameters:
      - 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]'
        explode: true
        in: query
        name: filter
        schema:
          properties:
            administrative_area:
              description: Find numbers in a particular US state or CA province.
              type: string
            best_effort:
              description: Filter to determine if best effort results should be included. Only available in USA/CANADA.
              type: boolean
            country_code:
              description: Filter phone numbers by country.
              type: string
            exclude_held_numbers:
              description: Filter to exclude phone numbers that are currently on hold/reserved for your account.
              type: boolean
            features:
              description: Filter phone numbers with specific features.
              items:
                enum:
                - sms
                - mms
                - voice
                - fax
                - emergency
                - hd_voice
                - international_sms
                - local_calling
                type: string
              type: array
            limit:
              description: Limits the number of results.
              type: integer
            locality:
              description: Filter phone numbers by city.
              type: string
            national_destination_code:
              description: Filter by the national destination code of the number.
              type: string
            phone_number:
              additionalProperties: false
              description: Filter phone numbers by pattern matching.
              properties:
                contains:
                  description: Filter numbers containing a pattern (excludes NDC if used with `national_destination_code` filter).
                  type: string
                ends_with:
                  description: Filter numbers ending with a pattern (excludes NDC if used with `national_destination_code` filter).
                  type: string
                starts_with:
                  description: Filter numbers starting with a pattern (excludes NDC if used with `national_destination_code` filter).
                  type: string
              type: object
            phone_number_type:
              description: Filter phone numbers by number type.
              enum:
              - local
              - toll_free
              - mobile
              - national
              - shared_cost
              type: string
            quickship:
              description: Filter to exclude phone numbers that need additional time after to purchase to activate. Only applicable for +1 toll_free numbers.
              type: boolean
            rate_center:
              description: Filter phone numbers by rate center. This filter is only applicable to USA and Canada numbers.
              type: string
            reservable:
              description: Filter to ensure only numbers that can be reserved are included in the results.
              type: boolean
          type: object
        style: deepObject
      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'
      summary: List available phone numbers
      tags:
      - Phone Number Search
      x-endpoint-cost: heavy
      x-group-parameters: 'true'
      x-latency-category: responsive
components:
  schemas:
    AvailablePhoneNumber:
      example:
        best_effort: false
        cost_information:
          currency: USD
          monthly_cost: '6.54'
          upfront_cost: '3.21'
        features:
        - name: sms
        - name: voice
        phone_number: '+19705555098'
        quickship: true
        record_type: available_phone_number
        region_information:
        - region_name: US
          region_type: country_code
        reservable: true
        vanity_format: ''
      properties:
        best_effort:
          description: Specifies whether the phone number is an exact match based on the search criteria or not.
          example: false
          type: boolean
        cost_information:
          $ref: '#/components/schemas/CostInformation'
        features:
          items:
            $ref: '#/components/schemas/Feature'
          type: array
        phone_number:
          example: '+19705555098'
          type: string
        quickship:
          description: Specifies whether the phone number can receive calls immediately after purchase or not.
          example: true
          type: boolean
        record_type:
          enum:
          - available_phone_number
          example: available_phone_number
          type: string
        region_information:
          items:
            $ref: '#/components/schemas/RegionInformation'
          type: array
        reservable:
          description: Specifies whether the phone number can be reserved before purchase or not.
          example: true
          type: boolean
        vanity_format:
          type: string
      type: object
    RegionInformation:
      example:
        region_name: US
        region_type: country_code
      properties:
        region_name:
          example: US
          type: string
        region_type:
          enum:
          - country_code
          - rate_center
          - state
          - location
          example: country_code
          type: string
      type: object
    CostInformation:
      example:
        currency: USD
        monthly_cost: '6.54'
        upfront_cost: '3.21'
      properties:
        currency:
          description: The ISO 4217 code for the currency.
          example: USD
          type: string
        monthly_cost:
          example: '6.54'
          type: string
        upfront_cost:
          example: '3.21'
          type: string
      type: object
    AvailablePhoneNumberBlock:
      example:
        cost_information:
          currency: USD
          monthly_cost: '6.54'
          upfront_cost: '3.21'
        features:
        - name: sms
        - name: voice
        phone_number: '+19705555000'
        range: 10
        record_type: available_phone_number_block
        region_information:
        - region_name: US
          region_type: country_code
      properties:
        cost_information:
          $ref: '#/components/schemas/CostInformation'
        features:
          items:
            $ref: '#/components/schemas/Feature'
          type: array
        phone_number:
          example: '+19705555000'
          type: string
        range:
          example: 10
          type: integer
        record_type:
          enum:
          - available_phone_number_block
          example: available_phone_number_block
          type: string
        region_information:
          items:
            $ref: '#/components/schemas/RegionInformation'
          type: array
      type: object
    AvailablePhoneNumbersMetadata:
      example:
        best_effort_results: 50
        total_results: 100
      properties:
        best_effort_results:
          example: 0
          type: integer
        total_results:
          example: 1
          type: integer
      type: object
    Feature:
      example:
        name: sms
      properties:
        name:
          example: sms
          type: string
      type: object
    numbers_Errors:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/numbers_Error'
          type: array
      type: object
    numbers_Error:
      properties:
        code:
          example: '10007'
          type: string
        detail:
          example: An unexpected error occured.
          type: string
        meta:
          properties:
            url:
              description: URL with additional information on the error.
              example: https://developers.telnyx.com/docs/overview/errors/10015
              type: string
          type: object
        source:
          properties:
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              example: /base
              type: string
          type: object
        title:
          example: Unexpected error
          type: string
      type: object
  responses:
    ListAvailablePhoneNumbersResponse:
      content:
        application/json:
          schema:
            properties:
              data:
                items:
                  $ref: '#/components/schemas/AvailablePhoneNumber'
                type: array
              meta:
                $ref: '#/components/schemas/AvailablePhoneNumbersMetadata'
              metadata:
                $ref: '#/components/schemas/AvailablePhoneNumbersMetadata'
            title: List Available Phone Numbers Response
            type: object
      description: Successful response with a list of available phone numbers.
    numbers_UnauthorizedResponse:
      content:
        application/json:
          examples:
            Authentication Failed:
              value:
                errors:
                - code: '10009'
                  detail: Could not understand the provided credentials.
                  meta:
                    url: https://developers.telnyx.com/docs/overview/errors/10009
                  title: Authentication failed
          schema:
            $ref: '#/components/schemas/numbers_Errors'
      description: Unauthorized
    numbers_UnprocessableEntity:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
      description: Unprocessable entity. Check the 'detail' field in response for details.
    numbers_NotFoundResponse:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
      description: The requested resource doesn't exist.
    ListAvailablePhoneNumbersBlockResponse:
      content:
        application/json:
          schema:
            properties:
              data:
                items:
                  $ref: '#/components/schemas/AvailablePhoneNumberBlock'
                type: array
              meta:
                $ref: '#/components/schemas/AvailablePhoneNumbersMetadata'
            title: List Available Phone Numbers Blocks Response
            type: object
      description: Successful response with a list of available phone numbers blocks.
    numbers_GenericErrorResponse:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
      description: Unexpected error
    numbers_BadRequestResponse:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
      description: Bad request, the request was unacceptable, often due to missing a required parameter.
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    branded-calling_bearerAuth:
      description: API key passed as a Bearer token in the Authorization header
      scheme: bearer
      type: http
    oauthClientAuth:
      description: OAuth 2.0 authentication for Telnyx API and MCP integrations
      flows:
        authorizationCode:
          authorizationUrl: https://api.telnyx.com/v2/oauth/authorize
          refreshUrl: https://api.telnyx.com/v2/oauth/token
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
        clientCredentials:
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
      type: oauth2
    outbound-voice-profiles_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
    pronunciation-dicts_bearerAuth:
      description: Telnyx API v2 key. Obtain from https://portal.telnyx.com
      scheme: bearer
      type: http
    stored-payment-transactions_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http