Telnyx Phone Number Campaigns API

Phone number campaign assignment

OpenAPI Specification

telnyx-phone-number-campaigns-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 Campaigns 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: Phone number campaign assignment
  name: Phone Number Campaigns
paths:
  /10dlc/phone_number_campaigns:
    get:
      operationId: GetAllPhoneNumberCampaigns
      parameters:
      - in: query
        name: recordsPerPage
        required: false
        schema:
          default: 20
          title: Recordsperpage
          type: integer
      - in: query
        name: page
        required: false
        schema:
          default: 1
          title: Page
          type: integer
      - $ref: '#/components/parameters/10dlc_FilterConsolidated'
      - description: Specifies the sort order for results. If not given, results are sorted by createdAt in descending order.
        example: -phoneNumber
        in: query
        name: sort
        required: false
        schema:
          default: -createdAt
          description: Specifies the sort order for results. If not given, results are sorted by created_at in descending order.
          enum:
          - assignmentStatus
          - -assignmentStatus
          - createdAt
          - -createdAt
          - phoneNumber
          - -phoneNumber
          title: Sort
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumberCampaignPaginated'
          description: Successful Response
        4XX:
          $ref: '#/components/responses/10dlc_GenericErrorResponse'
      summary: List phone number campaigns
      tags:
      - Phone Number Campaigns
      x-latency-category: responsive
    post:
      operationId: CreatePhoneNumberCampaign
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PhoneNumberCampaignCreate'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumberCampaign'
          description: Successful Response
        4XX:
          $ref: '#/components/responses/10dlc_GenericErrorResponse'
      summary: Create New Phone Number Campaign
      tags:
      - Phone Number Campaigns
      x-latency-category: responsive
  /10dlc/phone_number_campaigns/{phoneNumber}:
    delete:
      description: This endpoint allows you to remove a campaign assignment from the supplied `phoneNumber`.
      operationId: DeletePhoneNumberCampaign
      parameters:
      - in: path
        name: phoneNumber
        required: true
        schema:
          title: Phonenumber
          type: string
      responses:
        '200':
          $ref: '#/components/responses/SinglePhoneNumberCampaign'
        4XX:
          $ref: '#/components/responses/10dlc_GenericErrorResponse'
      summary: Delete Phone Number Campaign
      tags:
      - Phone Number Campaigns
      x-latency-category: responsive
    get:
      description: Retrieve an individual phone number/campaign assignment by `phoneNumber`.
      operationId: GetSinglePhoneNumberCampaign
      parameters:
      - in: path
        name: phoneNumber
        required: true
        schema:
          title: Phonenumber
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumberCampaign'
          description: Successful Response
        4XX:
          $ref: '#/components/responses/10dlc_GenericErrorResponse'
      summary: Get Single Phone Number Campaign
      tags:
      - Phone Number Campaigns
      x-latency-category: responsive
    put:
      operationId: PutPhoneNumberCampaign
      parameters:
      - in: path
        name: phoneNumber
        required: true
        schema:
          title: Phonenumber
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PhoneNumberCampaignCreate'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumberCampaign'
          description: Successful Response
        4XX:
          $ref: '#/components/responses/10dlc_GenericErrorResponse'
      summary: Create New Phone Number Campaign
      tags:
      - Phone Number Campaigns
      x-latency-category: responsive
components:
  schemas:
    10dlc_Error:
      properties:
        code:
          type: string
        detail:
          type: string
        source:
          properties:
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
          type: object
        title:
          type: string
      required:
      - code
      - title
      type: object
    PhoneNumberCampaignCreate:
      properties:
        campaignId:
          description: The ID of the campaign you want to link to the specified phone number.
          example: 4b300178-131c-d902-d54e-72d90ba1620j
          title: Campaignid
          type: string
        phoneNumber:
          description: The phone number you want to link to a specified campaign.
          example: '+18005550199'
          title: Phonenumber
          type: string
      required:
      - phoneNumber
      - campaignId
      title: PhoneNumberCampaignCreate
      type: object
    10dlc_Errors:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/10dlc_Error'
          type: array
      type: object
    PhoneNumberCampaign:
      properties:
        assignmentStatus:
          description: The assignment status of the number.
          enum:
          - FAILED_ASSIGNMENT
          - PENDING_ASSIGNMENT
          - ASSIGNED
          - PENDING_UNASSIGNMENT
          - FAILED_UNASSIGNMENT
          example: ASSIGNED
          title: AssignmentStatus
          type: string
        brandId:
          description: Brand ID. Empty if the number is associated to a shared campaign.
          example: 7ba705b7-22af-493f-addc-ac04b7ca071c
          title: BrandId
          type: string
        campaignId:
          description: 'For shared campaigns, this is the TCR campaign ID, otherwise it is the campaign ID '
          title: Campaignid
          type: string
        createdAt:
          example: '2021-03-08T17:57:48.801186'
          title: Createdat
          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
        phoneNumber:
          example: '+18005550199'
          title: Phonenumber
          type: string
        tcrBrandId:
          description: TCR's alphanumeric ID for the brand.
          example: BBRAND1
          title: TcrBrandId
          type: string
        tcrCampaignId:
          description: TCR's alphanumeric ID for the campaign.
          example: CCAMPA1
          title: TcrCampaignid
          type: string
        telnyxCampaignId:
          description: Campaign ID. Empty if the number is associated to a shared campaign.
          example: 3008dd9f-66d7-40e0-bf23-bf2d8d1a96ba
          title: Telnyxcampaignid
          type: string
        updatedAt:
          example: '2021-03-08T17:57:48.801186'
          title: Updatedat
          type: string
      required:
      - phoneNumber
      - campaignId
      - createdAt
      - updatedAt
      title: PhoneNumberCampaign
      type: object
    PhoneNumberCampaignPaginated:
      properties:
        page:
          title: Page
          type: integer
        records:
          items:
            $ref: '#/components/schemas/PhoneNumberCampaign'
          title: Records
          type: array
        totalRecords:
          title: Totalrecords
          type: integer
      required:
      - records
      - page
      - totalRecords
      title: PhoneNumberCampaignPaginated
      type: object
  parameters:
    10dlc_FilterConsolidated:
      description: 'Consolidated filter parameter (deepObject style). Originally: filter[telnyx_campaign_id], filter[telnyx_brand_id], filter[tcr_campaign_id], filter[tcr_brand_id]'
      explode: true
      in: query
      name: filter
      schema:
        properties:
          tcr_brand_id:
            description: Filter results by the TCR Brand id
            example: BRANDID
            type: string
          tcr_campaign_id:
            description: Filter results by the TCR Campaign id
            example: CAMPID3
            type: string
          telnyx_brand_id:
            description: Filter results by the Telnyx Brand id
            example: f3575e15-32ce-400e-a4c0-dd78800c20b0
            format: uuid
            type: string
          telnyx_campaign_id:
            description: Filter results by the Telnyx Campaign id
            example: f3575e15-32ce-400e-a4c0-dd78800c20b0
            format: uuid
            type: string
        type: object
      style: deepObject
  responses:
    SinglePhoneNumberCampaign:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PhoneNumberCampaign'
      description: Successful Response
    10dlc_GenericErrorResponse:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/10dlc_Errors'
      description: Generic response error
  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