Phone Number Campaigns API

Phone number campaign assignment API

Create New Phone Number Campaign

Assign an individual phone number to campaign.

SecuritybearerAuth
Request
Request Body schema: application/json
required
campaignId
required
string (Campaignid)

The ID of the campaign you want to link to the specified phone number.

phoneNumber
required
string (Phonenumber)

The phone number you want to link to a specified campaign.

Responses
200

Successful Response

Response Schema: application/json
campaignId
required
string (Campaignid)
createdAt
required
string <date-time> (Createdat)
phoneNumber
required
string (Phonenumber)
updatedAt
required
string <date-time> (Updatedat)
post/phoneNumberCampaign
Request samples
application/json
{
  • "campaignId": "4b300178-131c-d902-d54e-72d90ba1620j",
  • "phoneNumber": "+18005550199"
}
Response samples
application/json
{
  • "campaignId": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "phoneNumber": "string",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Retrieve All Phone Number Campaigns

Retrieve all of your organization's phone number/campaign assignments.

SecuritybearerAuth
Request
query Parameters
recordsPerPage
any (Recordsperpage)
Default: 10
page
any (Page)
Default: 1
Responses
200

Successful Response

Response Schema: application/json
page
required
integer (Page)
required
Array of objects (Records)
totalRecords
required
integer (Totalrecords)
get/phoneNumberCampaign
Request samples
# install http://docs.python-requests.org/en/master/
import requests

url = 'https://api.telnyx.com/10dlc/phoneNumberCampaign'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer API_TOKEN'
}
response = requests.request('get', url, headers=headers)
print(response.text)
Response samples
application/json
{
  • "page": 0,
  • "records": [
    • {
      • "campaignId": "string",
      • "createdAt": "2019-08-24T14:15:22Z",
      • "phoneNumber": "string",
      • "updatedAt": "2019-08-24T14:15:22Z"
      }
    ],
  • "totalRecords": 0
}

Get Single Phone Number Campaign

Retrieve an individual phone number/campaign assignment by phoneNumber.

SecuritybearerAuth
Request
path Parameters
phoneNumber
required
string (Phonenumber)
Responses
200

Successful Response

Response Schema: application/json
campaignId
required
string (Campaignid)
createdAt
required
string <date-time> (Createdat)
phoneNumber
required
string (Phonenumber)
updatedAt
required
string <date-time> (Updatedat)
get/phoneNumberCampaign/{phoneNumber}
Request samples
# install http://docs.python-requests.org/en/master/
import requests

url = 'https://api.telnyx.com/10dlc/phoneNumberCampaign/{phoneNumber}'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer API_TOKEN'
}
response = requests.request('get', url, headers=headers)
print(response.text)
Response samples
application/json
{
  • "campaignId": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "phoneNumber": "string",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Update Phone Number Campaign

This endpoint allows you to assign a different campaign to a supplied phoneNumber.

SecuritybearerAuth
Request
path Parameters
phoneNumber
required
string (Phonenumber)
Request Body schema: application/json
required
campaignId
required
string (Campaignid)
Responses
200

Successful Response

Response Schema: application/json
campaignId
required
string (Campaignid)
createdAt
required
string <date-time> (Createdat)
phoneNumber
required
string (Phonenumber)
updatedAt
required
string <date-time> (Updatedat)
put/phoneNumberCampaign/{phoneNumber}
Request samples
application/json
{
  • "campaignId": "string"
}
Response samples
application/json
{
  • "campaignId": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "phoneNumber": "string",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Delete Phone Number Campaign

This endpoint allows you to remove a campaign assignment from the supplied phoneNumber.

SecuritybearerAuth
Request
path Parameters
phoneNumber
required
any (Phonenumber)
Responses
200

Successful Response

Response Schema: application/json
campaignId
required
string (Campaignid)
createdAt
required
string <date-time> (Createdat)
phoneNumber
required
string (Phonenumber)
updatedAt
required
string <date-time> (Updatedat)
delete/phoneNumberCampaign/{phoneNumber}
Request samples
# install http://docs.python-requests.org/en/master/
import requests

url = 'https://api.telnyx.com/10dlc/phoneNumberCampaign/{phoneNumber}'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer API_TOKEN'
}
response = requests.request('delete', url, headers=headers)
print(response.text)
Response samples
application/json
{
  • "campaignId": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "phoneNumber": "string",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Retrieve All Phone Number Campaigns

SecuritybearerAuth
Request
query Parameters
recordsPerPage
any (Recordsperpage)
Default: 20
page
any (Page)
Default: 1
Responses
200

Successful Response

Response Schema: application/json
any
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
get/phone_number_campaigns
Request samples
Response samples
application/json
null

Create New Phone Number Campaign

SecuritybearerAuth
Request
Request Body schema: application/json
required
campaignId
required
string (Campaignid)

The ID of the campaign you want to link to the specified phone number.

phoneNumber
required
string (Phonenumber)

The phone number you want to link to a specified campaign.

Responses
200

Successful Response

Response Schema: application/json
any
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
post/phone_number_campaigns
Request samples
application/json
{
  • "campaignId": "4b300178-131c-d902-d54e-72d90ba1620j",
  • "phoneNumber": "+18005550199"
}
Response samples
application/json
null

Delete Phone Number Campaign

SecuritybearerAuth
Request
path Parameters
phoneNumber
required
string (Phonenumber)
Responses
200

Successful Response

Response Schema: application/json
any
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
delete/phone_number_campaigns/{phoneNumber}
Request samples
Response samples
application/json
null

Get Single Phone Number Campaign

SecuritybearerAuth
Request
path Parameters
phoneNumber
required
string (Phonenumber)
Responses
200

Successful Response

Response Schema: application/json
any
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
get/phone_number_campaigns/{phoneNumber}
Request samples
Response samples
application/json
null

Create New Phone Number Campaign

SecuritybearerAuth
Request
Request Body schema: application/json
required
campaignId
required
string (Campaignid)

The ID of the campaign you want to link to the specified phone number.

phoneNumber
required
string (Phonenumber)

The phone number you want to link to a specified campaign.

Responses
200

Successful Response

Response Schema: application/json
any
422

Validation Error

Response Schema: application/json
Array of objects (Detail)
Array
required
Array of strings or integers (Location)
msg
required
string (Message)
type
required
string (Error Type)
put/phone_number_campaigns/{phoneNumber}
Request samples
application/json
{
  • "campaignId": "4b300178-131c-d902-d54e-72d90ba1620j",
  • "phoneNumber": "+18005550199"
}
Response samples
application/json
null