> ## Documentation Index
> Fetch the complete documentation index at: https://plivo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Register a campaign

> Register a 10DLC messaging campaign and submit for carrier approval

This API lets you register a campaign using a preexisting brand.

#### API Endpoint

```text POST theme={null}
https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/
```

### Arguments

<table><tbody><tr><td><strong>campaign\_alias<br />string<br />required</strong></td><td>A friendly name for your campaign. This name appears on the Plivo console.</td></tr><tr><td><strong>brand\_id<br />string<br />required</strong></td><td>ID of the for which campaign creation request is being submitted.</td></tr><tr><td><strong>vertical<br />string<br />required</strong></td><td>Indicates the industry specific to the message use case.<p>Allowed values: `PROFESSIONAL`, `REAL_ESTATE`, `HEALTHCARE`,`HUMAN_RESOURCES`, `ENERGY`, `ENTERTAINMENT`, `RETAIL`, `TRANSPORTATION`, `AGRICULTURE`, `INSURANCE`, `POSTAL`, `EDUCATION`, `HOSPITALITY`, `FINANCIAL`, `POLITICAL`, `GAMBLING`, `LEGAL`, `CONSTRUCTION`, `NGO`,`MANUFACTURING`, `GOVERNMENT`, `TECHNOLOGY`,`COMMUNICATION`</p></td></tr><tr><td><strong>description<br />string<br />required</strong></td><td>A brief description of the campaign and how it’s relevant to your business — minimum of 40 characters.</td></tr><tr><td><strong>usecase<br />string<br />required</strong></td><td>Indicates your messaging use case.<p>Allowed values: `2FA`, `ACCOUNT_NOTIFICATION`, `CUSTOMER_CARE`, `DELIVERY_NOTIFICATION`, `FRAUD_ALERT`, `HIGHER_EDUCATION`, `LOW_VOLUME`, `MARKETING`, `MIXED`, `POLLING_VOTING`, `PUBLIC_SERVICE_ANNOUNCEMENT`, `SECURITY_ALERT`, `STARTER`.</p><p>STARTER brands can only use `STARTER` as their use case.</p><p> </p></td></tr><tr><td><strong>sample1<br />string<br />required</strong></td><td>The content of a sample message that you will send through this campaign. You must provide at least two samples, each with a minimum of 20 characters.</td></tr><tr><td><strong>sample2<br />string<br />required</strong></td><td>The content of the second sample message.</td></tr><tr><td><strong>subscriber\_optin<br />boolean<br />required</strong></td><td>A confirmation that you are collecting and processing customer opt-ins.<p>Allowed value: `true`</p></td></tr><tr><td><strong>subscriber\_optout<br />boolean<br />required</strong></td><td>A confirmation that you are collecting and processing customer opt-outs.<p>Allowed value: `true`</p></td></tr><tr><td><strong>subscriber\_help<br />boolean<br />required</strong></td><td>A confirmation that you have implemented a message reply that tells customers how they can contact the message sender when they reply with the “HELP” keyword.<p>Allowed value: `true`</p></td></tr><tr><td><strong>direct\_lending<br />boolean<br />required</strong></td><td>Indicates whether this campaign includes content related to direct lending or other loan arrangements.<p>Allowed values: `true`, `false`</p></td></tr><tr><td><strong>embedded\_link<br />boolean<br />required</strong></td><td>Indicates whether embedded links are being used. Operators do not accept public URL shorteners.<p>Allowed values: `true`, `false`</p></td></tr><tr><td><strong>embedded\_phone<br />boolean<br />required</strong></td><td>Indicates whether the campaign is using an embedded phone number other than the required HELP contact number.<p>Allowed values: `true`, `false`</p></td></tr><tr><td><strong>age\_gated<br />boolean<br />required</strong></td><td>Indicates whether the campaign includes any age-gated content as defined by operator and CTIA guidelines.<p>Allowed values: `true`, `false`</p></td></tr><tr><td><strong>affiliate\_marketing<br />boolean<br />required</strong></td><td>Indicates whether affiliate marketing was used in the construction of this campaign.<p>Allowed values: `true`, `false`</p></td></tr><tr><td><strong>sub\_usecases<br />list</strong></td><td>Only applicable when use case is `STARTER`, `MIXED`, or `LOW_VOLUME`. Indicates two to five comma-separated use cases.<p>Allowed values: `2FA`, `ACCOUNT_NOTIFICATION`,`CUSTOMER_CARE`, `DELIVERY_NOTIFICATION`, `FRAUD_ALERT`, `HIGHER_EDUCATION`, `MARKETING`, `POLLING_VOTING`, `PUBLIC_SERVICE_ANNOUNCEMENT`, `SECURITY_ALERT`</p></td></tr><tr><td><strong>message\_flow <br />string<br />required</strong></td><td>Describes how a customer opts in to a campaign, thereby giving consent to the sender to send messages. The message flow must be clear and inform customers about the nature of the campaign. If a campaign supports multiple opt-in mechanisms, you must mention all of them here.<p>Check <a href="https://docs.plivo.com/docs/messaging/a2p-10dlc/registration-guidelines">documentation</a> for samples.</p></td></tr><tr><td><strong>help\_message <br />string<br />required</strong></td><td>Indicates the response to the HELP keyword. It may include the brand name and support contact information.<p>Check <a href="https://docs.plivo.com/docs/messaging/a2p-10dlc/registration-guidelines">documentation</a> for samples.</p></td></tr><tr><td><strong>optout\_message <br />string<br />required</strong></td><td>Indicates the response to the STOP keyword. It must include acknowledgement of the opt-out request and confirmation that no further messages will be sent, and may include the brand name.<p>Check <a href="https://docs.plivo.com/docs/messaging/a2p-10dlc/registration-guidelines">documentation</a> for samples.</p></td></tr><tr><td><strong>optin\_message<br />string</strong></td><td>Message sent to subscribers to confirm their opt-in to the campaign.</td></tr><tr><td><strong>optin\_keywords<br />string</strong></td><td>Opt-in keywords associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.</td></tr><tr><td><strong>help\_keywords<br />string</strong></td><td>Help keywords associated with the campaign, in all capital letters. If more than one, provide a comma-separated list with no special characters or embedded spaces.</td></tr><tr><td><strong>url<br />string</strong></td><td>The fully qualified URL to which status update callbacks for the message should be sent.</td></tr><tr><td><strong>method<br />string</strong></td><td>The HTTP method to be used when calling the URL defined above.<p>Allowed values: `GET`, `POST`<br />Defaults to `POST`</p></td></tr></tbody></table>

### Returns

api\_id for the request, unique campaign\_id, and success message

<RequestExample>
  ```py Python theme={null}
  import sys
  sys.path.append("../plivo-python")
  import plivo

  client = plivo.RestClient("<auth_id>", "<auth_token>")
  sub_usecase = ["CUSTOMER_CARE", "2FA"]
  response = client.campaign.create(
      brand_id="<brand_id>",
      campaign_alias="campaign_sample message",
      vertical="INSURANCE",
      usecase="MIXED",
      sub_usecases=sub_usecase,
      description="Campaign description is a mandatory parameter, minimum 40 characters",
      embedded_link=False,
      embedded_phone=False,
      age_gated=False,
      subscriber_optin=True,
      subscriber_optout=True,
      subscriber_help=True,
      affiliate_marketing=False,
      sample1="Sample message 1 should have a minimum of 20 characters",
      sample2="Sample message 2 should have a minimum of 20 characters",
      url="https://<yoursite>.com/test",
      method="POST",
      message_flow="Message flow is a mandatory parameter, minimum 40 characters",
      help_keywords="HELP,INFO,MORE",
      help_message="Help message is a mandatory parameter, minimum 20 characters",
      optin_keywords="YES,SUBSCRIBE",
      optin_message="Opt-in message should have a minimum of 20 characters",
      optout_keywords="NO,STOP",
      optout_message="Opt-out message should have a minimum of 20 characters",
  )
  print(response)
  ```

  ```ruby Ruby theme={null}
  require "rubygems"
  require "/etc/plivo-ruby/lib/plivo.rb"
  include Plivo

  api = RestClient.new("<auth_id>", "<auth_token>")

  begin# Create Campaign
  response = api.campaign.create(brand_id: "<brand_id>",
      campaign_alias: "rubytest-1",
      vertical: "ENTERTAINMENT",
      usecase: "MIXED",
      sub_usecases: ["2FA", "MARKETING"],
      description: "Campaign description should have minimum of 40 characters",
      direct_lending: false,
      affiliate_marketing: false,
      embedded_link: false,
      embedded_phone: false,
      age_gated: false,
      subscriber_optin: true,
      subscriber_optout: true,
      subscriber_help: true,
      sample1: "Sample message 1 should have a inimum of 20 characters",
      sample2: "Sample message 2 should have a minimum of 20 characters",
      url: "<https://<yourdomain>.com/create_campaign_status/>",
      method: "POST",
      message_flow: "Message flow is a mandatory parameter, minimum 40 characters",
      help_keywords: "HELP,INFO,MORE",
      help_message: "Help message is a mandatory parameter, minimum 20 characters",
      optin_keywords: "YES,SUBSCRIBE",
      optin_message: "Opt-in message should have a minimum of 20 characters",
      optout_keywords: "NO,STOP",
      optout_message: "Opt-out message should have a minimum of 20 characters",
  )
  puts response
  rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
  end
  ```

  ```js Node theme={null}
  let plivo = require('plivo');
  let fs = require('fs');

  let client = new plivo.Client("<auth_id>", "<auth_token>");
  var callback = {"url":"http://plivobin.non-prod.plivops.com/xvm5fsxv", "method":"POST", "optout_keywords":"NO,STOP", "optin_keywords":"YES,SUBSCRIBE", "help_keywords":"HELP,INFO,MORE", "optin_message":"Opt-in message should have a minimum of 20 characters"}
  console.log('test');
  client.campaign.create("<brand_id>","all 7 fields optional","INSURANCE","MIXED",[
      "CUSTOMER_CARE",
      "2FA"
  ],"sample description text should 40 character following attributes that were specified at the time", false,false,false,false,true,true,true,true, "Sample message 1 should have a minimum of 20 characters", "Sample message 2 should have a minimum of 20 characters","Message flow is a mandatory parameter, minimum 40 characters ","Help message is a mandatory parameter, minimum 20 characters","Opt-out message should have a minimum of 20 characters", callback )
   .then(function (response) {
      console.log(JSON.stringify(response));
  }).catch(function (error) {
    console.log("err");
    console.log(error);
   });
  ```

  ```php PHP theme={null}
  <?php
  require '/etc/plivo-php/vendor/autoload.php';
  use Plivo\RestClient;
  $client = new RestClient("<auth_id>", "<auth_token>");
  $client
      ->client
      ->setTimeout(60);
  try
  {
      $callback = array(
          "url" => "https://<yourdomain>.com/tendlc_status/",
          "method" => "POST",
          "optout_keywords" => "optout,keyword",
          "help_keywords" => "helpkeywords",
          "optin_keywords" => "optinkeywords",
          "optin_message" => "In case you want to use optin"
      );
      $res = $client
          ->campaign
          ->create("<brand_id>", "campaign name sample", "INSURANCE", "MIXED", ["CUSTOMER_CARE", "2FA"], "sample description text should be 40 characters", False, False, False, False, True, True, True, true, "sample test - 1 description text should be 40 characters ", "sample test 2 description text should be 40 characters ", "message_flow description text should be 40 characters", "help_message description text should be 40 characters", "optout_message description text should be 40 characters", $callback);
      print_r($res);
  }
  catch(PlivoRestException $ex)
  {
      print_r($ex);
  }
  ?>
  ```

  ```java Java theme={null}
  package com.plivo.examples;

  import com.plivo.api.Plivo;
  import com.plivo.api.models.campaign.Campaign;
  import com.plivo.api.models.campaign.CampaignCreateResponse;

  public class GetCampaign {
    public static void main(String[] args) {
      Plivo.init("<auth_id>", "<auth_token>");

      try {
        String[] sub_usecase = new String[] {
          "2FA",
          "MARKETING"
        };
        CampaignCreateResponse response = Campaign.creator("<brand_id>",
          "java campaign",
          "ENTERTAINMENT",
          "MIXED",
          sub_usecase,
          "description",
          false,
          false,
          false,
          false,
          false,
          true,
          true,
          true,
          "sample message 1",
          "sample message 2",
          "http://plivobin.non-prod.plivops.com/y27a0hy2",
          "POST",
          "sample message_flow text",
          "sample help_message text",
          "sample optout_message text",
          "YES,SUBSCRIBE",
          "sample optin_message text",
          "NO,STOP",
          "HELP,INFO,MORE").create();
        System.out.println(response);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
  ```

  ```csharp .NET theme={null}
  using System;
  using System.Collections.Generic;
  using Plivo;
  using Plivo.Exception;

  namespace dotnet_project {
    class Ten_dlc {
      static void Main(string[] args) {

        var api = new PlivoApi("<auth_id>", "<auth_token>");

        // Create Campaign
        string[] sub_usecase = {
          "CUSTOMER_CARE",
          "2FA"
        };

        Console.WriteLine("Create Campaign");
        try {
          var response = api.Campaign.Create(
            campaign_alias: "camapaign_ren_1",
            description: "Dotnet_Test_Ren",
            brand_id: "BHXDNDJ",
            vertical: "INSURANCE",
            usecase: "MIXED",
            embedded_link: false,
            embedded_phone: false,
            direct_lending: false,
            age_gated: false,
            affiliate_marketing: false,
            subscriber_optin: true,
            subscriber_optout: true,
            subscriber_help: true,
            sample1: "sample message 1",
            sample2: "sample message 2",
            message_flow: "",
            help_message: "empty case for message flow",
            optout_message: "test optout message",
            sub_usecases: sub_usecase,
            url: "https://<yourdomain>.com/tendlc_status/",
            method: "POST",
            optin_keywords: "",
            optin_message: "In case you want to use optin",
            optout_keywords: "stop, info",
            help_keywords: "HELP,info,more"
          );
          Console.WriteLine(response);
        } catch (PlivoRestException e) {
          Console.WriteLine("Exception: " + e.Message);
        }

      }
    }
  }
  ```

  ```go Go theme={null}
  package main

  import (
          "fmt"

          "github.com/plivo/plivo-go/v7"
  )

  func main() {
          client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
          if err != nil {
                  fmt.Print("Error", err.Error())
                  return
          }
          campaignAlias := "campaign name sample"
          embeddedLink := false
          embeddedPhone := false
          ageGated := false
          directLending := false
          subUsecases := []string{"CUSTOMER_CARE", "2FA"}
          sample1 := "Sample message 1 should have a minimum of 20 characters"
          sample2 := "Sample message 2 should have a minimum of 20 characters"
          response, err := client.Campaign.Create(plivo.CampaignCreationParams{
                  BrandID:          "<brand_id>",
                  CampaignAlias:    &campaignAlias,
                  Vertical:         "INSURANCE",
                  Usecase:          "MIXED",
                  SubUsecases:      &subUsecases,
                  Description:      "Campaign description should have minimum of 40 characters",
                  EmbeddedLink:     &embeddedLink,
                  EmbeddedPhone:    &embeddedPhone,
                  AgeGated:         &ageGated,
                  DirectLending:    &directLending,
                  SubscriberOptin:  true,
                  SubscriberOptout: true,
                  SubscriberHelp:   true,
                  Sample1:          &sample1,
                  Sample2:          &sample2,
                  MessageFlow:      "Message flow is a mandatory parameter, minimum 40 characters",
                  HelpKeywords:     "HELP,INFO,MORE",
                  HelpMessage:      "Help message is a mandatory parameter, minimum 20 characters",
                  OptinKeywords:    "YES,SUBSCRIBE",
                  OptinMessage:     "Opt-in message should have a minimum of 20 characters",
                  OptoutKeywords:   "NO,STOP",
                  OptoutMessage:    "Opt-out message should have a minimum of 20 characters",
          },
  )
  if err != nil {
          fmt.Print("Error", err.Error())
          return
  }
  fmt.Printf("Response: %#v\n", response)
  }
  ```

  ```sh cURL theme={null}
  curl -i --user auth_id:auth_token \
      -H "Content-Type: application/json" \
      -d '{
              "brand_id": "{brand_id}",
              "vertical": "INSURANCE",
              "usecase": "MIXED",
              "sub_usecases":["2FA","ACCOUNT_NOTIFICATION", "CUSTOMER_CARE", "DELIVERY_NOTIFICATION", "FRAUD_ALERT"],
              "description": "OTP registration",
              "direct_lending": true,
              "affiliate_marketing": false,
              "embedded_link": false,
              "embedded_phone": false,
              "age_gated": false,
              "subscriber_optin": true,
              "subscriber_optout": true,
              "subscriber_help": true,
              "sample1": "Your OTP is 1234",
              "sample2": "Your order {ID} is out for delivery",
              "url": "https://<yourdomain>.com/tendlc_status/",
              "method": "POST"
          }' \
      https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/
  ```
</RequestExample>

### Response

```json theme={null}
{
    "apiId": "a640fba2-3b14-11ed-95d8-0242ac110004",
    "campaignId": "CVWMV6V",
    "message": "Request to create campaign was received and is being processed."
}
```
