> This page is for APIs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# List campaigns

GET https://%7BYour_Space_Name%7D.signalwire.com/api/relay/rest/registry/beta/brands/{id}/campaigns

Lists the US 10-digit long code (10DLC) messaging campaigns registered under one brand. Each campaign represents an approved messaging use case to which project phone numbers can be assigned. Use [Get campaign](/docs/apis/rest/campaign-registry/campaigns/retrieve-campaign) when you already have a campaign ID.

#### Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Messaging_ and _Numbers_.

[Learn more about API scopes](/docs/platform/your-signalwire-api-space).

Reference: https://signalwire.com/docs/apis/rest/campaign-registry/campaigns/list-campaigns

## Authentication

- `Authorization` header (basic auth, required) — SignalWire Basic Authentication using Project ID and API Token. The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password. Example: ``` Authorization: Basic base64(project_id:token) ```

## Request

### Path parameters

- `id` (string, required) — Unique ID of the brand.

### Query parameters

- `filter_name` (string, optional) — The name given to the campaign. Will return all Campaigns containing this value as a substring.
- `filter_state` (string, optional) — The state of the campaign in the registration process, such as pending or complete. Will return all campaigns with this value.

## Response

### 200

The request has succeeded.

- `links` (PaginationLinks, optional) — Pagination links.
- `data` (list of Campaign, optional) — List of campaigns.

## Errors

### 401 Unauthorized Error

Access is unauthorized.

- `error` (enum, required)
  - Allowed values: `Unauthorized`

### 404 Not Found Error

The server cannot find the requested resource.

- `error` (enum, required)
  - Allowed values: `Not Found`

### 500 Internal Server Error

An internal server error occurred.

- `error` (enum, required)
  - Allowed values: `Internal Server Error`

## Types

### PaginationLinks

Pagination links for list responses.

- `self` (string, required) — Link to the current page.
- `first` (string, required) — Link to the first page.
- `next` (string, optional) — Link to the next page. Only present when there are more results.
- `prev` (string, optional) — Link to the previous page. Only present when not on the first page.

### Campaign

Campaign model for 10DLC registration.

- `id` (string, required) — The unique identifier of the campaign.
- `name` (string, optional) — A name for the campaign.
- `state` (string, optional) — The current state of the campaign.
- `sms_use_case` (string, optional) — An SMS Use Case category for the campaign (2FA, ACCOUNT_NOTIFICATION, AGENTS_FRANCHISES, CARRIER_EXEMPT, CHARITY, CUSTOMER_CARE, DELIVERY_NOTIFICATION, EMERGENCY, FRAUD_ALERT, HIGHER_EDUCATION, K12_EDUCATION, LOW_VOLUME_MIXED, MARKETING, MIXED, POLITICAL, POLITICAL_SECTION_527, POLLING_VOTING, PROXY, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT, SOCIAL, SWEEPSTAKE, TRIAL, UCAAS_HIGH_VOLUME, UCAAS_LOW_VOLUME).
- `sub_use_cases` (list of string, optional) — A sub use case category for MIXED or LOW_VOLUME_MIXED campaigns (CUSTOMER_CARE, HIGHER_EDUCATION, POLLING_VOTING, PUBLIC_SERVICE_ANNOUNCEMENT, MARKETING, SECURITY_ALERT, 2FA, ACCOUNT_NOTIFICATION, DELIVERY_NOTIFICATION, FRAUD_ALERT).
- `campaign_verify_token` (string, optional) — Campaign Verify token. Required if sms use case is POLITICAL_SECTION_527.
- `description` (string, optional) — A description for the campaign. Please use at least 40 characters.
- `sample1` (string, optional) — Sample message template/content. At least two samples are required and up to five can be provided. Please use at least 20 characters.
- `sample2` (string, optional) — Sample 2.
- `sample3` (string, optional) — Sample 3.
- `sample4` (string, optional) — Sample 4.
- `sample5` (string, optional) — Sample 5.
- `dynamic_templates` (string, optional) — If your messaging content will be modified in any way beyond what you shared in your templates, please describe the nature of how the content will change.
- `message_flow` (string, optional) — Please describe the call to action/message flow your intended recipients will experience.
- `opt_in_message` (string, optional) — Please share the message subscribers receive when they opt in.
- `opt_out_message` (string, optional) — Please share the message subscribers receive when they opt out.
- `help_message` (string, optional) — Please share the message subscribers receive when they request help.
- `opt_in_keywords` (string, optional, default: START) — Opt in keywords that subscribers can use.
- `opt_out_keywords` (string, optional, default: STOP) — Opt out keywords that subscribers can use.
- `help_keywords` (string, optional, default: HELP) — Help keywords that subscribers can use.
- `number_pooling_required` (boolean, optional) — Will 50 or more numbers be used with this single campaign? If so, please enter true.
- `number_pooling_per_campaign` (string, optional) — If you will be using number pooling, please provide an explanation as to why it is needed.
- `direct_lending` (boolean, optional) — Will this campaign include content related to direct lending or other loan agreements?
- `embedded_link` (boolean, optional) — Will you be using an embedded link of any kind? Note that public URL shorteners (bitly, tinyurl) will not be accepted.
- `embedded_phone` (boolean, optional) — Are you using an embedded phone number (except the required HELP information contact phone number)?
- `age_gated_content` (boolean, optional) — Will this campaign include any age gated content as defined by carrier and CTA guidelines?
- `lead_generation` (boolean, optional) — Is there any intent of this campaign to generate leads?
- `csp_campaign_reference` (string, optional) — If you are your own Campaign Service Provider, what is the approved Campaign ID? (Mandatory for CSPs, otherwise please omit)
- `signalwire_contact_emails` (list of string, optional) — Email addresses SignalWire uses for registration correspondence about this campaign. Defaults to the brand's addresses, then the first administrator on the account.
- `status_callback_url` (string, optional) — Optional: Specify a URL to receive webhook notifications when your campaign's state changes. See the [10DLC status callback](/docs/apis/rest/webhooks/ten-dlc-status-callback) docs for the webhook payload.
- `created_at` (datetime, optional) — Timestamp when the campaign was created.
- `updated_at` (datetime, optional) — Timestamp when the campaign was last updated.

## Examples

**Response**

```json
{
  "links": {
    "self": "string",
    "first": "string",
    "next": "string",
    "prev": "string"
  },
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "My Campaign",
      "state": "pending",
      "sms_use_case": "MARKETING",
      "sub_use_cases": [
        "string"
      ],
      "campaign_verify_token": "string",
      "description": "string",
      "sample1": "this is a sample message your customer might receive",
      "sample2": "this is a sample message your customer might receive",
      "sample3": "string",
      "sample4": "string",
      "sample5": "string",
      "dynamic_templates": "string",
      "message_flow": "Users will opt in to receive messages from their doctor through a written form and we will send them an opt in message. Appointment reminders will then be sent ahead of their appointments.",
      "opt_in_message": "Thanks for subscribing. Reply STOP to cancel at any time.",
      "opt_out_message": "You have successfully been opted out. Reply START to opt back in at any time.",
      "help_message": "You have successfully been opted out. Reply SUBSCRIBE to opt back in at any time.",
      "opt_in_keywords": "Start,Subscribe,Opt In",
      "opt_out_keywords": "Stop,Opt Out,Unsubscribe",
      "help_keywords": "Help,Support,Request Call",
      "number_pooling_required": true,
      "number_pooling_per_campaign": "We have customer reps in every state and they each need their own number with local area code.",
      "direct_lending": true,
      "embedded_link": false,
      "embedded_phone": false,
      "age_gated_content": true,
      "lead_generation": true,
      "csp_campaign_reference": "1231231",
      "signalwire_contact_emails": [
        "campaign_registrations@example.com"
      ],
      "status_callback_url": "https://example.com/handle_callback",
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns"

response = requests.get(url, auth=("<project_id>", "<api_token>"))

print(response.json())
```

```javascript
const url = 'https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns';
const credentials = btoa("<project_id>:<api_token>");

const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns"

	req, _ := http.NewRequest("GET", url, nil)

	req.SetBasicAuth("<project_id>", "<api_token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request.basic_auth("<project_id>", "<api_token>")

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns")
  .basicAuth("<project_id>", "<api_token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns', [
  'headers' => [
  ],
    'auth' => ['<project_id>', '<api_token>'],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns");
client.Authenticator = new HttpBasicAuthenticator("<project_id>", "<api_token>");
var request = new RestRequest(Method.GET);

IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<project_id>:<api_token>".utf8).base64EncodedString()

let headers = ["Authorization": "Basic \(credentials)"]

let request = NSMutableURLRequest(url: NSURL(string: "https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```