Skip to main content
POST
/
workspaces
/
{workspace}
/
templates
Create a template
curl --request POST \
  --url https://lancepilot.com/api/v3/workspaces/{workspace}/templates \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "login_otp_template",
  "language": "en",
  "category": "MARKETING",
  "header": null,
  "body": {
    "text": "<string>",
    "otp_code": "<string>",
    "variables": [
      "<string>"
    ]
  },
  "footer": "<string>",
  "buttons": [
    {
      "type": "URL",
      "text": "<string>",
      "phone_number": "<string>",
      "url": "<string>"
    }
  ],
  "unsubscribeButton": true,
  "blockButton": true
}'

Request Body Schema

FieldTypeRequiredDescription
namestringYesUnique template name (only lowercase + underscores).
languagestringYesLanguage code (e.g., en, bn).
categorystringYesOne of: MARKETING, UTILITY, AUTHENTICATION.
headerobject / nullNoTemplate header. Can be:
- null → No header
- text → Text header (max 60 chars)
- media → Media header (image/video/document).
bodyobjectYesMain message body. Supports variables ({{1}}, {{2}}).
body.textstringYesMessage text (max 1024 chars).
body.otp_codestringAuth onlyRequired for AUTHENTICATION templates (max 15 chars).
body.variablesarrayNoVariable placeholders (strings).
footerstringNoFooter text (max 60 chars, no emojis).
buttonsarrayNoInteractive buttons (URL, Phone, Quick Reply).
unsubscribeButtonbooleanNoWhether to show Unsubscribe option.
blockButtonbooleanNoWhether to show Block option.

Example Payloads for All type Template

Since JSON doesn’t support comments, Write it in pseudo-JSON with // comments. (You can later remove the comments for real JSON.)
{
  "name": "template_name",                  // required (unique, lowercase + underscores)
  "language": "en",                         // required
  "category": "MARKETING",                  // required: MARKETING | UTILITY | AUTHENTICATION

  // ----- HEADER -----
  // if header not needed => omit "header" or set to null
  // if header.type = "text" => send "header.text"
  // if header.type = "media" => send "header.media"

  "header": {
    "type": "text",                         // "text" OR "media" OR null
    "text": {                               // required if header.type = "text"
      "content": "Payment Receipt",         // required, max 60 chars
      "variables": []                       // optional, max 1 item
    },
    "media": {                              // required if header.type = "media"
      "type": "image",                      // image | video | document
      "file": "data:image/png;base64,..."   // required if header.type = "media"
    }
  },

  // ----- BODY -----
  "body": {
    "text": "Hello {{1}}, your OTP is {{2}}",   // required, max 1024 chars
    "otp_code": "{{2}}",                        // required ONLY when category = AUTHENTICATION
    "variables": ["John Doe", "123456"]         // required if variables exist in text
  },

  "footer": "Thank you for choosing us",        // optional, max 60 chars

  // ----- BUTTONS -----
  "buttons": [
    {
      "type": "URL",                            // required: URL | PHONE_NUMBER | QUICK_REPLY
      "text": "Visit Website",                  // required if type != PHONE_NUMBER
      "url": "https://example.com"              // required if type = URL
    },
    {
      "type": "PHONE_NUMBER",
      "phone_number": "+880123456789"           // required if type = PHONE_NUMBER
    },
    {
      "type": "QUICK_REPLY",
      "text": "Yes"                             // required if type = QUICK_REPLY
    }
  ],

  "unsubscribeButton": true,                    // optional, boolean
  "blockButton": false                          // optional, boolean
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workspace
string<uuid>
required

ID of the workspace.

Body

application/json
name
string
required
Example:

"login_otp_template"

language
string
required
Example:

"en"

category
enum<string>
required
Available options:
MARKETING,
UTILITY,
AUTHENTICATION
body
object
required
header
object | null

Option 2: Text Header

  • Option 1
  • Option 2
Maximum length: 60
buttons
object[]
unsubscribeButton
boolean
blockButton
boolean

Response

Template created successfully