List Campaigns
Retrieve a list of campaigns associated with a supplied brandId.
GET
/
10dlc
/
campaign
JavaScript
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 campaignListResponse of client.messaging10dlc.campaign.list({
brandId: 'brandId',
})) {
console.log(campaignListResponse.ageGated);
}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.campaign.list(
brand_id="brandId",
)
page = page.records[0]
print(page.age_gated)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Messaging10dlc.Campaign.List(context.TODO(), telnyx.Messaging10dlcCampaignListParams{
BrandID: "brandId",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignListPage;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CampaignListParams params = CampaignListParams.builder()
.brandId("brandId")
.build();
CampaignListPage page = client.messaging10dlc().campaign().list(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.messaging_10dlc.campaign.list(brand_id: "brandId")
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->messaging10dlc->campaign->list(
brandID: 'brandId',
page: 0,
recordsPerPage: 0,
sort: 'assignedPhoneNumbersCount',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messaging-10dlc:campaign list \
--api-key 'My API Key' \
--brand-id brandIdcurl --request GET \
--url https://api.telnyx.com/v2/10dlc/campaign \
--header 'Authorization: Bearer <token>'{
"records": [
{
"ageGated": true,
"autoRenewal": true,
"billedDate": "<string>",
"brandId": "d2ca9d69-641b-4131-83fa-5d0744f4c8a9",
"brandDisplayName": "ABC Mobile",
"campaignId": "823d6b1a-6ed6-41a3-9c50-c8ff41b682ba",
"tcrBrandId": "BBRAND1",
"tcrCampaignId": "CCAMP1",
"createDate": "<string>",
"cspId": "<string>",
"description": "<string>",
"directLending": true,
"embeddedLink": true,
"embeddedPhone": true,
"helpKeywords": "<string>",
"helpMessage": "<string>",
"messageFlow": "<string>",
"mock": true,
"nextRenewalOrExpirationDate": "<string>",
"numberPool": true,
"optinKeywords": "<string>",
"optinMessage": "<string>",
"optoutKeywords": "<string>",
"optoutMessage": "<string>",
"referenceId": "<string>",
"resellerId": "<string>",
"sample1": "<string>",
"sample2": "<string>",
"sample3": "<string>",
"sample4": "<string>",
"sample5": "<string>",
"status": "<string>",
"subUsecases": [
"<string>"
],
"subscriberHelp": true,
"subscriberOptin": true,
"subscriberOptout": true,
"termsAndConditions": true,
"usecase": "<string>",
"vertical": "<string>",
"webhookURL": "https://example.com/webhook",
"webhookFailoverURL": "https://example.com/failover-webhook",
"isTMobileRegistered": true,
"isTMobileSuspended": true,
"isTMobileNumberPoolingEnabled": true,
"failureReasons": "<string>",
"campaignStatus": "TCR_ACCEPTED",
"privacyPolicyLink": "<string>",
"termsAndConditionsLink": "<string>",
"embeddedLinkSample": "<string>",
"assignedPhoneNumbersCount": 3
}
],
"page": 123,
"totalRecords": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Filter results by brand id.
The 1-indexed page number to get. The default value is 1.
The amount of records per page, limited to between 1 and 500 inclusive. The default value is 10.
Specifies the sort order for results. If not given, results are sorted by createdAt in descending order. Specifies the sort order for results. If not given, results are sorted by created_at in descending order.
Available options:
assignedPhoneNumbersCount, -assignedPhoneNumbersCount, campaignId, -campaignId, createdAt, -createdAt, status, -status, tcrCampaignId, -tcrCampaignId Was this page helpful?
⌘I
JavaScript
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 campaignListResponse of client.messaging10dlc.campaign.list({
brandId: 'brandId',
})) {
console.log(campaignListResponse.ageGated);
}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.campaign.list(
brand_id="brandId",
)
page = page.records[0]
print(page.age_gated)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Messaging10dlc.Campaign.List(context.TODO(), telnyx.Messaging10dlcCampaignListParams{
BrandID: "brandId",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignListPage;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CampaignListParams params = CampaignListParams.builder()
.brandId("brandId")
.build();
CampaignListPage page = client.messaging10dlc().campaign().list(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.messaging_10dlc.campaign.list(brand_id: "brandId")
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->messaging10dlc->campaign->list(
brandID: 'brandId',
page: 0,
recordsPerPage: 0,
sort: 'assignedPhoneNumbersCount',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messaging-10dlc:campaign list \
--api-key 'My API Key' \
--brand-id brandIdcurl --request GET \
--url https://api.telnyx.com/v2/10dlc/campaign \
--header 'Authorization: Bearer <token>'{
"records": [
{
"ageGated": true,
"autoRenewal": true,
"billedDate": "<string>",
"brandId": "d2ca9d69-641b-4131-83fa-5d0744f4c8a9",
"brandDisplayName": "ABC Mobile",
"campaignId": "823d6b1a-6ed6-41a3-9c50-c8ff41b682ba",
"tcrBrandId": "BBRAND1",
"tcrCampaignId": "CCAMP1",
"createDate": "<string>",
"cspId": "<string>",
"description": "<string>",
"directLending": true,
"embeddedLink": true,
"embeddedPhone": true,
"helpKeywords": "<string>",
"helpMessage": "<string>",
"messageFlow": "<string>",
"mock": true,
"nextRenewalOrExpirationDate": "<string>",
"numberPool": true,
"optinKeywords": "<string>",
"optinMessage": "<string>",
"optoutKeywords": "<string>",
"optoutMessage": "<string>",
"referenceId": "<string>",
"resellerId": "<string>",
"sample1": "<string>",
"sample2": "<string>",
"sample3": "<string>",
"sample4": "<string>",
"sample5": "<string>",
"status": "<string>",
"subUsecases": [
"<string>"
],
"subscriberHelp": true,
"subscriberOptin": true,
"subscriberOptout": true,
"termsAndConditions": true,
"usecase": "<string>",
"vertical": "<string>",
"webhookURL": "https://example.com/webhook",
"webhookFailoverURL": "https://example.com/failover-webhook",
"isTMobileRegistered": true,
"isTMobileSuspended": true,
"isTMobileNumberPoolingEnabled": true,
"failureReasons": "<string>",
"campaignStatus": "TCR_ACCEPTED",
"privacyPolicyLink": "<string>",
"termsAndConditionsLink": "<string>",
"embeddedLinkSample": "<string>",
"assignedPhoneNumbersCount": 3
}
],
"page": 123,
"totalRecords": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
}
}
]
}