> ## 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 phone number campaigns



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/messaging-10dlc/phone-number-campaigns.yml get /10dlc/phone_number_campaigns
openapi: 3.1.0
info:
  title: Telnyx 10DLC Phone Number Campaigns API
  version: 2.0.0
  description: API for 10DLC phone number campaign assignments.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /10dlc/phone_number_campaigns:
    get:
      tags:
        - Phone Number Campaigns
      summary: List phone number campaigns
      operationId: GetAllPhoneNumberCampaigns
      parameters:
        - required: false
          schema:
            title: Recordsperpage
            default: 20
            type: integer
          name: recordsPerPage
          in: query
        - required: false
          schema:
            title: Page
            default: 1
            type: integer
          name: page
          in: query
        - $ref: '#/components/parameters/10dlc_FilterConsolidated'
        - name: sort
          required: false
          schema:
            title: Sort
            description: >-
              Specifies the sort order for results. If not given, results are
              sorted by created_at in descending order.
            type: string
            enum:
              - assignmentStatus
              - '-assignmentStatus'
              - createdAt
              - '-createdAt'
              - phoneNumber
              - '-phoneNumber'
            default: '-createdAt'
          description: >-
            Specifies the sort order for results. If not given, results are
            sorted by createdAt in descending order.
          example: '-phoneNumber'
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumberCampaignPaginated'
        4XX:
          $ref: '#/components/responses/10dlc_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
            });


            // Automatically fetches more pages as needed.

            for await (const phoneNumberCampaign of
            client.messaging10dlc.phoneNumberCampaigns.list()) {
              console.log(phoneNumberCampaign.campaignId);
            }
        - 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.messaging_10dlc.phone_number_campaigns.list()
            page = page.records[0]
            print(page.campaign_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.Messaging10dlc.PhoneNumberCampaigns.List(context.TODO(), telnyx.Messaging10dlcPhoneNumberCampaignListParams{})\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.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListPage;

            import
            com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListParams;


            public final class Main {
                private Main() {}

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

                    PhoneNumberCampaignListPage page = client.messaging10dlc().phoneNumberCampaigns().list();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            page = telnyx.messaging_10dlc.phone_number_campaigns.list

            puts(page)
        - lang: CLI
          source: |-
            telnyx messaging-10dlc:phone-number-campaigns list \
              --api-key 'My API Key'
components:
  parameters:
    10dlc_FilterConsolidated:
      name: filter
      in: query
      style: deepObject
      explode: true
      description: >-
        Consolidated filter parameter (deepObject style). Originally:
        filter[telnyx_campaign_id], filter[telnyx_brand_id],
        filter[tcr_campaign_id], filter[tcr_brand_id]
      schema:
        type: object
        properties:
          telnyx_campaign_id:
            type: string
            format: uuid
            example: f3575e15-32ce-400e-a4c0-dd78800c20b0
            description: Filter results by the Telnyx Campaign id
          telnyx_brand_id:
            type: string
            format: uuid
            example: f3575e15-32ce-400e-a4c0-dd78800c20b0
            description: Filter results by the Telnyx Brand id
          tcr_campaign_id:
            type: string
            example: CAMPID3
            description: Filter results by the TCR Campaign id
          tcr_brand_id:
            type: string
            example: BRANDID
            description: Filter results by the TCR Brand id
  schemas:
    PhoneNumberCampaignPaginated:
      title: PhoneNumberCampaignPaginated
      required:
        - records
        - page
        - totalRecords
      type: object
      properties:
        records:
          title: Records
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumberCampaign'
        page:
          title: Page
          type: integer
        totalRecords:
          title: Totalrecords
          type: integer
    PhoneNumberCampaign:
      title: PhoneNumberCampaign
      required:
        - phoneNumber
        - campaignId
        - createdAt
        - updatedAt
      type: object
      properties:
        phoneNumber:
          title: Phonenumber
          type: string
          example: '+18005550199'
        brandId:
          description: Brand ID. Empty if the number is associated to a shared campaign.
          title: BrandId
          type: string
          example: 7ba705b7-22af-493f-addc-ac04b7ca071c
        tcrBrandId:
          description: TCR's alphanumeric ID for the brand.
          title: TcrBrandId
          type: string
          example: BBRAND1
        campaignId:
          description: >-
            For shared campaigns, this is the TCR campaign ID, otherwise it is
            the campaign ID 
          title: Campaignid
          type: string
        tcrCampaignId:
          description: TCR's alphanumeric ID for the campaign.
          title: TcrCampaignid
          type: string
          example: CCAMPA1
        telnyxCampaignId:
          description: Campaign ID. Empty if the number is associated to a shared campaign.
          title: Telnyxcampaignid
          type: string
          example: 3008dd9f-66d7-40e0-bf23-bf2d8d1a96ba
        assignmentStatus:
          description: The assignment status of the number.
          title: AssignmentStatus
          enum:
            - FAILED_ASSIGNMENT
            - PENDING_ASSIGNMENT
            - ASSIGNED
            - PENDING_UNASSIGNMENT
            - FAILED_UNASSIGNMENT
          example: ASSIGNED
          type: string
        failureReasons:
          description: >-
            Extra info about a failure to assign/unassign a number. Relevant
            only if the assignmentStatus is either FAILED_ASSIGNMENT or
            FAILED_UNASSIGNMENT
          type: string
        createdAt:
          title: Createdat
          type: string
          example: '2021-03-08T17:57:48.801186'
        updatedAt:
          title: Updatedat
          type: string
          example: '2021-03-08T17:57:48.801186'
    10dlc_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/10dlc_Error'
      type: object
    10dlc_Error:
      required:
        - code
        - title
      type: object
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
  responses:
    10dlc_GenericErrorResponse:
      description: Generic response error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/10dlc_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````