> ## 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.

# Create toll-free campaign

> Create a toll-free campaign and submit it for Surge review.



## OpenAPI

````yaml POST /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:
    post:
      tags:
        - Toll-Free Campaigns
      summary: Create a toll-free campaign
      description: Creates a toll-free campaign and submits it for Surge review.
      operationId: CreateTollFreeCampaign
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            description: The account for which the toll-free campaign should be created.
            example: acct_01j9a43avnfqzbjfch6pygv1td
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TollFreeCampaignParams'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TollFreeCampaign'
          description: Created toll-free campaign
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Phone number already has a toll-free campaign
        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
            });


            const tollFreeCampaign = await
            client.tollFreeCampaigns.create('acct_01j9a43avnfqzbjfch6pygv1td', {
              consent_flows: [{ script: 'xxxxxxxxxxxxxxxxxxxx', type: 'verbal' }],
              description: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
              message_samples: ['string'],
              phone_number_id: 'phone_number_id',
              privacy_policy_url: 'https://example.com',
              terms_and_conditions_url: 'https://example.com',
              use_cases: ['two_factor_authentication'],
            });


            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
            )
            toll_free_campaign = client.toll_free_campaigns.create(
                account_id="acct_01j9a43avnfqzbjfch6pygv1td",
                consent_flows=[{
                    "script": "xxxxxxxxxxxxxxxxxxxx",
                    "type": "verbal",
                }],
                description="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                message_samples=["string"],
                phone_number_id="phone_number_id",
                privacy_policy_url="https://example.com",
                terms_and_conditions_url="https://example.com",
                use_cases=["two_factor_authentication"],
            )
            print(toll_free_campaign.id)
        - lang: Ruby
          source: |-
            require "surge_api"

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

            toll_free_campaign = surge.toll_free_campaigns.create(
              "acct_01j9a43avnfqzbjfch6pygv1td",
              consent_flows: [{script: "xxxxxxxxxxxxxxxxxxxx", type: :verbal}],
              description: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
              message_samples: ["string"],
              phone_number_id: "phone_number_id",
              privacy_policy_url: "https://example.com",
              terms_and_conditions_url: "https://example.com",
              use_cases: [:two_factor_authentication]
            )

            puts(toll_free_campaign)
components:
  schemas:
    TollFreeCampaignParams:
      title: TollFreeCampaignParams
      description: Parameters for creating a toll-free campaign through Surge
      properties:
        consent_flows:
          items:
            oneOf:
              - properties:
                  script:
                    maxLength: 2000
                    minLength: 20
                    type: string
                  type:
                    enum:
                      - verbal
                    type: string
                required:
                  - type
                  - script
                type: object
              - properties:
                  form_url:
                    format: uri
                    type: string
                  owner:
                    enum:
                      - brand
                      - platform
                    type: string
                  screenshot:
                    properties:
                      reason:
                        enum:
                          - behind_login
                          - under_construction
                          - other
                        type: string
                      reason_other:
                        maxLength: 500
                        minLength: 1
                        type: string
                      urls:
                        items:
                          format: uri
                          type: string
                        maxItems: 5
                        minItems: 1
                        type: array
                    required:
                      - urls
                      - reason
                    type: object
                  type:
                    enum:
                      - web_form
                    type: string
                required:
                  - type
                  - owner
                type: object
              - properties:
                  file_urls:
                    items:
                      format: uri
                      type: string
                    maxItems: 5
                    minItems: 1
                    type: array
                  keywords:
                    items:
                      maxLength: 70
                      pattern: ^[a-zA-Z0-9]+$
                      type: string
                    maxItems: 1
                    type: array
                  type:
                    enum:
                      - text
                    type: string
                required:
                  - type
                  - file_urls
                type: object
              - properties:
                  file_urls:
                    items:
                      format: uri
                      type: string
                    maxItems: 5
                    minItems: 1
                    type: array
                  type:
                    enum:
                      - paper_form
                    type: string
                required:
                  - type
                  - file_urls
                type: object
          maxItems: 1
          minItems: 1
          type: array
        description:
          description: An explanation of how the toll-free number will be used.
          maxLength: 500
          minLength: 40
          type: string
        includes:
          items:
            enum:
              - age_gated
            type: string
          type: array
          uniqueItems: true
        message_samples:
          items:
            maxLength: 1000
            type: string
          maxItems: 1
          minItems: 1
          type: array
        phone_number_id:
          description: The toll-free phone number to register.
          type: string
        privacy_policy_url:
          format: uri
          maxLength: 255
          type: string
        terms_and_conditions_url:
          format: uri
          maxLength: 255
          type: string
        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
          minItems: 1
          type: array
      required:
        - phone_number_id
        - use_cases
        - description
        - message_samples
        - privacy_policy_url
        - terms_and_conditions_url
        - consent_flows
      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
    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
    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
    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
  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.