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

# List toll-free campaigns

> List all toll-free campaigns for an account with cursor-based pagination.



## OpenAPI

````yaml GET /accounts/{account_id}/toll_free_campaigns
openapi: 3.1.1
info:
  title: Surge
  version: '1.0'
servers:
  - url: https://api.surge.app
security:
  - authorization: []
paths:
  /accounts/{account_id}/toll_free_campaigns:
    get:
      tags:
        - Toll-Free Campaigns
      summary: List toll-free campaigns
      description: >-
        List all toll-free campaigns for an account with cursor-based
        pagination.
      operationId: ListTollFreeCampaigns
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            description: The account ID to list toll-free campaigns for.
            example: acct_01j9a43avnfqzbjfch6pygv1td
            type: string
        - in: query
          name: after
          required: false
          schema:
            description: >-
              Cursor for forward pagination. Use the next_cursor from a previous
              response.
            type: string
        - in: query
          name: before
          required: false
          schema:
            description: >-
              Cursor for backward pagination. Use the previous_cursor from a
              previous response.
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TollFreeCampaignList'
          description: List of toll-free campaigns
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Error
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Surge from '@surgeapi/node';

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

            // Automatically fetches more pages as needed.
            for await (const tollFreeCampaign of client.tollFreeCampaigns.list(
              'acct_01j9a43avnfqzbjfch6pygv1td',
            )) {
              console.log(tollFreeCampaign.id);
            }
        - lang: Python
          source: |-
            import os
            from surge import Surge

            client = Surge(
                api_key=os.environ.get("SURGE_API_KEY"),  # This is the default and can be omitted
            )
            page = client.toll_free_campaigns.list(
                account_id="acct_01j9a43avnfqzbjfch6pygv1td",
            )
            page = page.data[0]
            print(page.id)
        - lang: Ruby
          source: >-
            require "surge_api"


            surge = SurgeAPI::Client.new(api_key: "My API Key")


            page =
            surge.toll_free_campaigns.list("acct_01j9a43avnfqzbjfch6pygv1td")


            puts(page)
components:
  schemas:
    TollFreeCampaignList:
      title: TollFreeCampaignList
      description: A paginated list of toll-free campaigns
      properties:
        data:
          description: The list of toll-free campaigns
          items:
            $ref: '#/components/schemas/TollFreeCampaign'
          type: array
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - data
        - pagination
      type: object
    ErrorResponse:
      title: ErrorResponse
      description: An error response
      example:
        error:
          message: The requested resource could not be found.
          type: not_found
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
      type: object
    TollFreeCampaign:
      title: TollFreeCampaign
      description: A toll-free campaign registration for a phone number.
      properties:
        consent_flows:
          items:
            $ref: '#/components/schemas/TollFreeCampaignConsentFlow'
          type: array
        description:
          type:
            - string
            - 'null'
        id:
          description: The toll-free campaign ID
          type: string
        includes:
          items:
            enum:
              - age_gated
            type: string
          type: array
        message_samples:
          items:
            type: string
          type: array
        phone_number_id:
          description: The toll-free phone number ID
          type: string
        privacy_policy_url:
          format: uri
          type:
            - string
            - 'null'
        status:
          description: The current status of the toll-free campaign.
          enum:
            - active
            - canceled
            - created
            - in_review
            - rejected
          type: string
        terms_and_conditions_url:
          format: uri
          type:
            - string
            - 'null'
        use_cases:
          items:
            enum:
              - two_factor_authentication
              - account_notification
              - customer_care
              - charity
              - delivery_notification
              - fraud_alert
              - event
              - higher_education
              - k12_education
              - marketing
              - polling_voting
              - political
              - public_service_announcement
              - security_alert
            type: string
          type: array
      required:
        - id
        - phone_number_id
        - status
        - use_cases
        - description
        - message_samples
        - includes
        - privacy_policy_url
        - terms_and_conditions_url
        - consent_flows
      type: object
    Pagination:
      title: Pagination
      description: Cursor-based pagination information
      example:
        next_cursor: g3QAAAABZAACaWRtAAAAGnBuXzAxamtzY2s5eDdkeW0wZnBxZjdjYmRyeQ==
        previous_cursor: null
      properties:
        next_cursor:
          description: Cursor for the next page of results. Null if there is no next page.
          type:
            - string
            - 'null'
        previous_cursor:
          description: >-
            Cursor for the previous page of results. Null if there is no
            previous page.
          type:
            - string
            - 'null'
      type: object
    Error:
      title: Error
      description: An error response
      example:
        message: The requested resource was not found.
        type: not_found
      properties:
        detail:
          additionalProperties: true
          description: Additional details about the error.
          type: object
        message:
          description: A human-readable error message.
          example: The requested resource was not found.
          type: string
        type:
          description: A unique error code.
          example: not_found
          type: string
      required:
        - type
        - message
      type: object
    TollFreeCampaignConsentFlow:
      title: TollFreeCampaignConsentFlow
      description: A consent flow returned on toll-free campaign responses.
      oneOf:
        - properties:
            script:
              type: string
            type:
              enum:
                - verbal
              type: string
          required:
            - type
            - script
          type: object
        - properties:
            form_url:
              format: uri
              type: string
            type:
              enum:
                - web_form
              type: string
          required:
            - type
            - form_url
          type: object
        - properties:
            screenshot:
              properties:
                reason:
                  enum:
                    - behind_login
                    - under_construction
                    - other
                  type: string
                reason_other:
                  maxLength: 500
                  minLength: 1
                  type: string
              required:
                - reason
              type: object
            type:
              enum:
                - web_form
              type: string
          required:
            - type
            - screenshot
          type: object
        - properties:
            keywords:
              items:
                maxLength: 70
                pattern: ^[a-zA-Z0-9]+$
                type: string
              maxItems: 1
              type: array
            type:
              enum:
                - text
              type: string
          required:
            - type
          type: object
        - properties:
            type:
              enum:
                - paper_form
              type: string
          required:
            - type
          type: object
      type: object
  securitySchemes:
    authorization:
      bearerFormat: Surge API token
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.