> ## 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 all phone number blocks

> Returns a list of all phone number blocks of a porting order.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/porting-phone-numbers.yml get /porting_orders/{porting_order_id}/phone_number_blocks
openapi: 3.1.0
info:
  title: Telnyx Porting Phone Numbers API
  version: 2.0.0
  description: API for porting phone numbers, blocks, extensions, and configurations.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /porting_orders/{porting_order_id}/phone_number_blocks:
    get:
      tags:
        - Porting Orders
      summary: List all phone number blocks
      description: Returns a list of all phone number blocks of a porting order.
      operationId: listPortingPhoneNumberBlocks
      parameters:
        - name: porting_order_id
          in: path
          description: Identifies the Porting Order associated with the phone number blocks
          required: true
          schema:
            type: string
            format: uuid
        - $ref: '#/components/parameters/porting-order_FilterConsolidated'
        - $ref: '#/components/parameters/porting-order_PageConsolidated'
        - name: sort
          in: query
          style: deepObject
          explode: true
          description: >-
            Consolidated sort parameter (deepObject style). Originally:
            sort[value]
          schema:
            type: object
            properties:
              value:
                type: string
                enum:
                  - '-created_at'
                  - created_at
                example: created_at
                description: >-
                  Specifies the sort order for results. If not given, results
                  are sorted by created_at in descending order
      responses:
        '200':
          $ref: '#/components/responses/ListPortingPhoneNumberBlocks'
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '422':
          description: Unprocessable entity. Check message field in response for details.
      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
            });


            // Automatically fetches more pages as needed.

            for await (const portingPhoneNumberBlock of
            client.portingOrders.phoneNumberBlocks.list(
              '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
            )) {
              console.log(portingPhoneNumberBlock.id);
            }
        - 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
            )
            page = client.porting_orders.phone_number_blocks.list(
                porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            page = page.data[0]
            print(page.id)
        - 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\tpage, err := client.PortingOrders.PhoneNumberBlocks.List(\n\t\tcontext.TODO(),\n\t\t\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n\t\ttelnyx.PortingOrderPhoneNumberBlockListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\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.portingorders.phonenumberblocks.PhoneNumberBlockListPage;

            import
            com.telnyx.sdk.models.portingorders.phonenumberblocks.PhoneNumberBlockListParams;


            public final class Main {
                private Main() {}

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

                    PhoneNumberBlockListPage page = client.portingOrders().phoneNumberBlocks().list("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            page =
            telnyx.porting_orders.phone_number_blocks.list("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")


            puts(page)
        - lang: CLI
          source: |-
            telnyx porting-orders:phone-number-blocks list \
              --api-key 'My API Key' \
              --porting-order-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e
components:
  parameters:
    porting-order_FilterConsolidated:
      name: filter
      in: query
      style: deepObject
      explode: true
      description: >-
        Consolidated filter parameter (deepObject style). Originally:
        filter[porting_order_id], filter[support_key], filter[status],
        filter[phone_number], filter[activation_status],
        filter[portability_status]
      schema:
        type: object
        properties:
          porting_order_id:
            type: array
            items:
              type: string
              format: uuid
              example: f3575e15-32ce-400e-a4c0-dd78800c20b0
            description: Filter results by a list of porting order ids
          support_key:
            oneOf:
              - type: string
                example: sr_a12345
                description: Filter by exact support key match (eq operation)
              - type: array
                items:
                  type: string
                  example: sr_a12345
                description: Filter by multiple support keys (in operation)
            description: >-
              Filter results by support key(s). Originally:
              filter[support_key][eq], filter[support_key][in][]
          status:
            oneOf:
              - type: string
                enum:
                  - draft
                  - in-process
                  - submitted
                  - exception
                  - foc-date-confirmed
                  - cancel-pending
                  - ported
                  - cancelled
                example: in-process
                description: Filter by single status
              - type: array
                items:
                  type: string
                  enum:
                    - draft
                    - in-process
                    - submitted
                    - exception
                    - foc-date-confirmed
                    - cancel-pending
                    - ported
                    - cancelled
                example:
                  - in-process
                  - submitted
                description: Filter by multiple statuses (in operation)
            description: >-
              Filter porting orders by status(es). Originally: filter[status],
              filter[status][in][]
          phone_number:
            type: array
            items:
              type: string
              example: '+12003151212'
            description: Filter results by a list of phone numbers
          activation_status:
            $ref: '#/components/schemas/PortingOrderActivationStatus'
            description: Filter results by activation status
          portability_status:
            $ref: '#/components/schemas/PortabilityStatus'
            description: Filter results by portability status
    porting-order_PageConsolidated:
      name: page
      in: query
      style: deepObject
      explode: true
      description: >-
        Consolidated page parameter (deepObject style). Originally: page[size],
        page[number]
      schema:
        type: object
        properties:
          size:
            type: integer
            minimum: 1
            maximum: 250
            default: 20
            description: The size of the page
          number:
            type: integer
            minimum: 1
            default: 1
            description: The page number to load
  responses:
    ListPortingPhoneNumberBlocks:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  $ref: '#/components/schemas/PortingPhoneNumberBlock'
              meta:
                $ref: '#/components/schemas/PaginationMeta'
  schemas:
    PortingOrderActivationStatus:
      type: string
      description: Activation status
      enum:
        - New
        - Pending
        - Conflict
        - Cancel Pending
        - Failed
        - Concurred
        - Activate RDY
        - Disconnect Pending
        - Concurrence Sent
        - Old
        - Sending
        - Active
        - Cancelled
      example: Active
    PortabilityStatus:
      type: string
      description: >-
        Specifies whether Telnyx is able to confirm portability this number in
        the United States & Canada. International phone numbers are provisional
        by default.
      enum:
        - pending
        - confirmed
        - provisional
      example: confirmed
    PortingPhoneNumberBlock:
      type: object
      properties:
        id:
          description: Uniquely identifies this porting phone number block.
          type: string
          format: uuid
          example: f24151b6-3389-41d3-8747-7dd8c681e5e2
          readOnly: true
        country_code:
          description: >-
            Specifies the country code for this porting phone number block. It
            is a two-letter ISO 3166-1 alpha-2 country code.
          type: string
          example: DE
        phone_number_type:
          description: Specifies the phone number type for this porting phone number block.
          type: string
          example: local
          enum:
            - landline
            - local
            - mobile
            - national
            - shared_cost
            - toll_free
        phone_number_range:
          description: >-
            Specifies the phone number range for this porting phone number
            block.
          type: object
          properties:
            start_at:
              description: >-
                Specifies the start of the phone number range for this porting
                phone number block.
              type: string
              pattern: ^\+\d{7,15}$
              example: '+4930244999901'
            end_at:
              description: >-
                Specifies the end of the phone number range for this porting
                phone number block.
              type: string
              pattern: ^\+\d{7,15}$
              example: '+4930244999910'
        activation_ranges:
          description: >-
            Specifies the activation ranges for this porting phone number block.
            The activation range must be within the phone number range and
            should not overlap with other activation ranges.
          type: array
          items:
            type: object
            properties:
              start_at:
                description: >-
                  Specifies the start of the activation range. Must be greater
                  or equal the start of the phone number range.
                type: string
                pattern: ^\+\d{7,15}$
                example: '+4930244999901'
              end_at:
                description: >-
                  Specifies the end of the activation range. It must be no more
                  than the end of the phone number range.
                type: string
                pattern: ^\+\d{7,15}$
                example: '+4930244999910'
        record_type:
          type: string
          example: porting_phone_number_block
          description: Identifies the type of the resource.
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the resource was created.
          example: '2021-03-19T10:07:15.527Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: >-
            ISO 8601 formatted date indicating when the resource was last
            updated.
          example: '2021-03-19T10:07:15.527Z'
          readOnly: true
    PaginationMeta:
      type: object
      properties:
        total_pages:
          type: integer
          example: 3
        total_results:
          type: integer
          example: 55
        page_number:
          type: integer
          example: 2
        page_size:
          type: integer
          example: 25
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````