Sending Campaigns
This endpoint triggers the sending process for a pre-existing campaign, initiating a background bulk email dispatch to all profiles associated with the specified campaignId.
Endpoint
POST /campaign/send
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | ✅ Yes |
Content-Type | application/json | ✅ Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
campaignId | String | ✅ Yes | The unique ID of the campaign to be sent. |
Examples
Request
- JavaScript
- Python
- C#
- PHP
- cURL
const response = await fetch("https://api.basicsengage.com/api/v0/dev/campaign/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <your-api-key>"
},
body: JSON.stringify({
campaignId: "64a55f123abcde1234567890"
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.basicsengage.com/api/v0/dev/campaign/send"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <your-api-key>"
}
data = {"campaignId": "64a55f123abcde1234567890"}
response = requests.post(url, headers=headers, json=data)
print(response.json())
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var url = "https://api.basicsengage.com/api/v0/dev/campaign/send";
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <your-api-key>");
var data = new StringContent(
"{\"campaignId\": \"64a55f123abcde1234567890\"}",
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync(url, data);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
<?php
$url = "https://api.basicsengage.com/api/v0/dev/campaign/send";
$headers = [
"Content-Type: application/json",
"Authorization: Bearer <your-api-key>"
];
$data = [
"campaignId" => "64a55f123abcde1234567890"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
curl -X POST "https://api.basicsengage.com/api/v0/dev/campaign/send" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-api-key>" \
-d '{
"campaignId": "64a55f123abcde1234567890"
}'
Responses
- 🟢 200
- 🔴 400
- 🔴 401
- 🔴 404
- 🔴 500
{
"status": "success",
"message": "Campaign queued successfully!"
}
{
"status": "error",
"message": "Missing required field: 'campaignId'"
}
{
"status": "error",
"message": "Invalid API Key"
}
{
"status": "error",
"message": "Campaign not found"
}
{
"status": "error",
"message": "Internal server error. Please try again later."
}