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

# Create campaign

POST https://%7BYour_Space_Name%7D.signalwire.com/api/relay/rest/registry/beta/brands/{id}/campaigns
Content-Type: application/json

Submits a US 10-digit long code (10DLC) messaging use case under an existing brand, or imports an approved Campaign Service Provider campaign. Use it after brand registration and before assigning phone numbers. Once the campaign is ready, use [Create phone number assignment order](/docs/apis/rest/campaign-registry/phone-number-assignments/create-order) to bind project numbers to it.

#### 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/create-campaign

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

### Body (application/json)

This endpoint expects a Campaign Registry: Campaigns_create_campaign_Request.

- `Campaign Registry: Campaigns_create_campaign_Request`
  - CreateManagedCampaignRequest: CreateManagedCampaignRequest
  - CreatePartnerCampaignRequest: CreatePartnerCampaignRequest

## Response

### 201

The request has succeeded and a new resource has been created as a result.

- `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, nullable) — 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, nullable) — Campaign Verify token. Required if sms use case is POLITICAL_SECTION_527.
- `description` (string, optional, nullable) — A description for the campaign. Please use at least 40 characters.
- `sample1` (string, optional, nullable) — 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, nullable) — Sample 2.
- `sample3` (string, optional, nullable) — Sample 3.
- `sample4` (string, optional, nullable) — Sample 4.
- `sample5` (string, optional, nullable) — Sample 5.
- `dynamic_messages` (string, optional, nullable) — 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, nullable) — Please describe the call to action/message flow your intended recipients will experience.
- `opt_in_message` (string, optional, nullable) — Please share the message subscribers receive when they opt in.
- `opt_out_message` (string, optional, nullable) — Please share the message subscribers receive when they opt out.
- `help_message` (string, optional, nullable) — Please share the message subscribers receive when they request help.
- `opt_in_keywords` (string, optional, nullable) — Opt in keywords that subscribers can use.
- `opt_out_keywords` (string, optional, nullable) — Opt out keywords that subscribers can use.
- `help_keywords` (string, optional, nullable) — Help keywords that subscribers can use.
- `number_pooling_per_campaign` (string, optional, nullable) — If you will be using number pooling, please provide an explanation as to why it is needed.
- `direct_lending` (boolean, optional, nullable) — Will this campaign include content related to direct lending or other loan agreements?
- `embedded_link` (boolean, optional, nullable) — 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, nullable) — Are you using an embedded phone number (except the required HELP information contact phone number)?
- `age_gated_content` (boolean, optional, nullable) — Will this campaign include any age gated content as defined by carrier and CTA guidelines?
- `lead_generation` (boolean, optional, nullable) — Is there any intent of this campaign to generate leads?
- `csp_campaign_reference` (string, optional, nullable) — 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, nullable) — 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.

## Errors

### 422 Unprocessable Entity Error

The request contains invalid parameters. See errors for details.

- `errors` (list of Types.StatusCodes.RestApiErrorItem, required) — List of validation errors.

### 500 Internal Server Error

An internal server error occurred.

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

## Types

### CreateManagedCampaignRequest

Request body for creating a managed campaign. Used when the brand is a managed (non-CSP) brand.

- `name` (string, required) — A name for the campaign.
- `brand_id` (string, required) — The ID of the brand to associate with this campaign.
- `sms_use_case` (string, required) — An SMS Use Case category for the campaign.
- `description` (string, required) — A description for the campaign.
- `sample1` (string, required) — Sample message template/content.
- `sample2` (string, required) — Second sample message template/content.
- `message_flow` (string, required) — Please describe the call to action/message flow your intended recipients will experience.
- `opt_out_message` (string, required) — Please share the message subscribers receive when they opt out.
- `help_message` (string, required) — Please share the message subscribers receive when they request help.
- `number_pooling_required` (boolean, required) — Will 50 or more numbers be used with this single campaign?
- `direct_lending` (boolean, required) — Will this campaign include content related to direct lending or other loan agreements?
- `embedded_link` (boolean, required) — Will you be using an embedded link of any kind? Note that public URL shorteners (bitly, tinyurl) will not be accepted.
- `embedded_phone` (boolean, required) — Are you using an embedded phone number (except the required HELP information contact phone number)?
- `age_gated_content` (boolean, required) — Will this campaign include any age gated content as defined by carrier and CTA guidelines?
- `lead_generation` (boolean, required) — Is there any intent of this campaign to generate leads?
- `terms_and_conditions` (boolean, required) — I agree to the terms and conditions which do not allow me to use this campaign for affiliate marketing.
- `sub_use_cases` (list of string, optional) — A sub use case category. Required for MIXED (2-5 sub use cases) or LOW_VOLUME_MIXED (1-5 sub use cases) campaigns. Must not be provided for other use cases.
- `campaign_verify_token` (string, optional) — Campaign Verify token. Required if sms_use_case is POLITICAL_SECTION_527.
- `sample3` (string, optional) — Third sample message template/content.
- `sample4` (string, optional) — Fourth sample message template/content.
- `sample5` (string, optional) — Fifth sample message template/content.
- `dynamic_messages` (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.
- `opt_in_message` (string, optional) — Please share the message subscribers receive when they opt in.
- `opt_in_keywords` (string, optional) — Opt in keywords that subscribers can use. Must be comma-separated values with no spaces between keywords.
- `opt_out_keywords` (string, optional) — Opt out keywords that subscribers can use. Must be comma-separated values with no spaces between keywords.
- `help_keywords` (string, optional) — Help keywords that subscribers can use. Must be comma-separated values with no spaces between keywords.
- `number_pooling_per_campaign` (string, optional) — If you will be using number pooling, please provide an explanation as to why it is needed. Required if number_pooling_required is true.
- `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) — 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.

### CreatePartnerCampaignRequest

Request body for creating a partner/CSP campaign. Used when the brand is a CSP (self-registered) brand.

- `name` (string, required) — A name for the campaign.
- `brand_id` (string, required) — The ID of the brand to associate with this campaign. Must be a CSP/partner brand.
- `csp_campaign_reference` (string, required) — The approved Campaign ID from TCR. Required for CSP/self-registered campaigns.
- `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) — 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.

### Types.StatusCodes.RestApiErrorItem

Details about a specific error.

- `type` (string, required) — The category of error.
- `code` (string, required) — A specific error code.
- `message` (string, required) — A description of what caused the error.
- `url` (string, required) — A link to documentation about this error.
- `attribute` (string, optional, nullable) — The request parameter that caused the error, if applicable.

## Examples

**Request**

```json
{
  "age_gated_content": false,
  "brand_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "description": "This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.",
  "direct_lending": false,
  "embedded_link": false,
  "embedded_phone": false,
  "help_message": "For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.",
  "lead_generation": false,
  "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.",
  "name": "My Campaign",
  "number_pooling_required": false,
  "opt_out_message": "You have successfully been opted out. Reply START to opt back in at any time.",
  "sample1": "Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.",
  "sample2": "Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.",
  "sms_use_case": "MARKETING",
  "terms_and_conditions": true
}
```

**Response**

```json
{
  "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_messages": "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_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"

payload = {
    "age_gated_content": False,
    "brand_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "description": "This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.",
    "direct_lending": False,
    "embedded_link": False,
    "embedded_phone": False,
    "help_message": "For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.",
    "lead_generation": False,
    "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.",
    "name": "My Campaign",
    "number_pooling_required": False,
    "opt_out_message": "You have successfully been opted out. Reply START to opt back in at any time.",
    "sample1": "Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.",
    "sample2": "Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.",
    "sms_use_case": "MARKETING",
    "terms_and_conditions": True
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, 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: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"age_gated_content":false,"brand_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6","description":"This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.","direct_lending":false,"embedded_link":false,"embedded_phone":false,"help_message":"For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.","lead_generation":false,"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.","name":"My Campaign","number_pooling_required":false,"opt_out_message":"You have successfully been opted out. Reply START to opt back in at any time.","sample1":"Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.","sample2":"Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.","sms_use_case":"MARKETING","terms_and_conditions":true}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"age_gated_content\": false,\n  \"brand_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"description\": \"This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.\",\n  \"direct_lending\": false,\n  \"embedded_link\": false,\n  \"embedded_phone\": false,\n  \"help_message\": \"For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.\",\n  \"lead_generation\": false,\n  \"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.\",\n  \"name\": \"My Campaign\",\n  \"number_pooling_required\": false,\n  \"opt_out_message\": \"You have successfully been opted out. Reply START to opt back in at any time.\",\n  \"sample1\": \"Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.\",\n  \"sample2\": \"Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.\",\n  \"sms_use_case\": \"MARKETING\",\n  \"terms_and_conditions\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<project_id>", "<api_token>")
	req.Header.Add("Content-Type", "application/json")

	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::Post.new(url)
request.basic_auth("<project_id>", "<api_token>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"age_gated_content\": false,\n  \"brand_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"description\": \"This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.\",\n  \"direct_lending\": false,\n  \"embedded_link\": false,\n  \"embedded_phone\": false,\n  \"help_message\": \"For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.\",\n  \"lead_generation\": false,\n  \"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.\",\n  \"name\": \"My Campaign\",\n  \"number_pooling_required\": false,\n  \"opt_out_message\": \"You have successfully been opted out. Reply START to opt back in at any time.\",\n  \"sample1\": \"Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.\",\n  \"sample2\": \"Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.\",\n  \"sms_use_case\": \"MARKETING\",\n  \"terms_and_conditions\": true\n}"

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.post("https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns")
  .basicAuth("<project_id>", "<api_token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"age_gated_content\": false,\n  \"brand_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"description\": \"This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.\",\n  \"direct_lending\": false,\n  \"embedded_link\": false,\n  \"embedded_phone\": false,\n  \"help_message\": \"For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.\",\n  \"lead_generation\": false,\n  \"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.\",\n  \"name\": \"My Campaign\",\n  \"number_pooling_required\": false,\n  \"opt_out_message\": \"You have successfully been opted out. Reply START to opt back in at any time.\",\n  \"sample1\": \"Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.\",\n  \"sample2\": \"Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.\",\n  \"sms_use_case\": \"MARKETING\",\n  \"terms_and_conditions\": true\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://{your_space_name}.signalwire.com/api/relay/rest/registry/beta/brands/id/campaigns', [
  'body' => '{
  "age_gated_content": false,
  "brand_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "description": "This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.",
  "direct_lending": false,
  "embedded_link": false,
  "embedded_phone": false,
  "help_message": "For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.",
  "lead_generation": false,
  "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.",
  "name": "My Campaign",
  "number_pooling_required": false,
  "opt_out_message": "You have successfully been opted out. Reply START to opt back in at any time.",
  "sample1": "Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.",
  "sample2": "Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.",
  "sms_use_case": "MARKETING",
  "terms_and_conditions": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    '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.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"age_gated_content\": false,\n  \"brand_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"description\": \"This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.\",\n  \"direct_lending\": false,\n  \"embedded_link\": false,\n  \"embedded_phone\": false,\n  \"help_message\": \"For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.\",\n  \"lead_generation\": false,\n  \"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.\",\n  \"name\": \"My Campaign\",\n  \"number_pooling_required\": false,\n  \"opt_out_message\": \"You have successfully been opted out. Reply START to opt back in at any time.\",\n  \"sample1\": \"Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.\",\n  \"sample2\": \"Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.\",\n  \"sms_use_case\": \"MARKETING\",\n  \"terms_and_conditions\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "age_gated_content": false,
  "brand_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "description": "This campaign sends appointment reminders to patients who have opted in to receive notifications from their healthcare provider.",
  "direct_lending": false,
  "embedded_link": false,
  "embedded_phone": false,
  "help_message": "For help, contact support@example.com or call 1-800-555-0123. Reply STOP to unsubscribe.",
  "lead_generation": false,
  "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.",
  "name": "My Campaign",
  "number_pooling_required": false,
  "opt_out_message": "You have successfully been opted out. Reply START to opt back in at any time.",
  "sample1": "Hi John, this is a reminder that your appointment is tomorrow at 2pm. Reply STOP to unsubscribe.",
  "sample2": "Your prescription is ready for pickup at Main St Pharmacy. Reply STOP to unsubscribe.",
  "sms_use_case": "MARKETING",
  "terms_and_conditions": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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 = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```