Campaigns
A campaign is a message sequence that Telegram accounts send to contacts on a schedule.
#The Campaign object
Campaign: a sequence of messages that Telegram accounts send to contacts.
Attributes
objectstringObject type, alwayscampaign.idstring (uuid)Campaign ID.workspace_idstring (uuid)Workspace the campaign belongs to.namestringCampaign name.statusstringCampaign status. An unknown value is returned asunknown. Values:draftscheduledactivepausedstoppedcompletedarchivedlaunchingfailedpaused_no_creditsunknownfirst_message_modestringWhere the first message comes from. Alwaystemplatein v1: from the campaign template.accepts_api_leadsbooleanWhether the campaign accepts contacts through the API. Alwaysfalsein v1.reasonobjectWhy the campaign is not sending messages right now, if known.Child attributes
reason_codestringReason code. Values:noneschedule_windowdaily_limitqueue_pendingtelegram_waitaccount_unavailableaccount_restrictedcampaign_pausedsubscription_inactivemanual_holdautomation_stoppedservice_unavailableunknownreason_observed_atstring (date-time) or nullWhen the reason was recorded.nullif unknown.next_attempt_atstring (date-time) or nullWhen the next attempt is expected.nullif the time is unknown.requires_customer_actionboolean or nullWhether someone needs to act in Meliora for sending to resume.nullif unknown.
created_atstring (date-time)When the campaign was created.observed_atstring (date-time)Time the server read the data.
Campaign
{
"object": "campaign",
"id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"name": "Example campaign",
"status": "active",
"first_message_mode": "template",
"accepts_api_leads": false,
"reason": {
"reason_code": "none",
"reason_observed_at": null,
"next_attempt_at": null,
"requires_customer_action": null
},
"created_at": "2026-10-20T08:00:00.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
}#List campaigns
GET/v1/campaigns
Campaigns in the key's scope, oldest first by created_at.
Parameters
- Number of objects to return per page. From 1 to 100. Defaults to
50. - The
next_cursorvalue from the previous response. Other filters must match the first request. - Only objects in this workspace.
- Only campaigns with this status. Values:
draftscheduledactivepausedstoppedcompletedarchivedlaunchingfailedpaused_no_creditsunknown
Response
A list: object, data (an array of Campaign objects), has_more, next_cursor. See Pagination.
Endpoint-specific errors
cursor_mismatch: The cursor is corrupted, was issued for a different route or filters, or the key's permissions and scope have changed.scope_required: The key does not have permission for this read. Texts also require "Message text" to be enabled.not_found: The object was not found or is outside the key's scope. An unknown path also returns 404.cursor_expired: The cursor expired: 15 minutes for lists, 30 days for the event feed.
Common errors are described in Errors.
Request
curl -G https://api.melioralab.io/v1/campaigns \
-H "Authorization: Bearer $MELIORA_API_KEY" \
-d workspace_id=3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43 \
-d status=activeconst url = new URL('https://api.melioralab.io/v1/campaigns');
url.searchParams.set('workspace_id', '3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43');
url.searchParams.set('status', 'active');
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.MELIORA_API_KEY}` },
});
if (!res.ok) throw new Error(`Meliora API: ${res.status}`);
const body = await res.json();import os
import requests
resp = requests.get(
"https://api.melioralab.io/v1/campaigns",
headers={"Authorization": f"Bearer {os.environ['MELIORA_API_KEY']}"},
params={"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43", "status": "active"},
timeout=15,
)
resp.raise_for_status()
body = resp.json()Response
{
"object": "list",
"data": [
{
"object": "campaign",
"id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"name": "Example campaign",
"status": "active",
"first_message_mode": "template",
"accepts_api_leads": false,
"reason": {
"reason_code": "none",
"reason_observed_at": null,
"next_attempt_at": null,
"requires_customer_action": null
},
"created_at": "2026-10-20T08:00:00.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
},
{
"object": "campaign",
"id": "6e3a9c15-2b7d-4f80-9a64-3c1d8e5f7b29",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"name": "Follow-up",
"status": "paused",
"first_message_mode": "template",
"accepts_api_leads": false,
"reason": {
"reason_code": "campaign_paused",
"reason_observed_at": "2026-10-25T16:40:00.000Z",
"next_attempt_at": null,
"requires_customer_action": true
},
"created_at": "2026-10-22T11:15:00.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
}
],
"has_more": true,
"next_cursor": "v1.k1.Qm9hcmRfMWZ4.c3RyaWN0bHlfb3BhcXVl.dGFnX2V4YW1wbGU.bWFjX2V4YW1wbGVfdmFsdWU"
}#Retrieve a campaign
GET/v1/campaigns/{id}
A single campaign by ID. A campaign outside the key's scope returns 404, as if it did not exist.
Parameters
- Campaign ID.
Response
Returns a Campaign object.
Endpoint-specific errors
scope_required: The key does not have permission for this read. Texts also require "Message text" to be enabled.not_found: The object was not found or is outside the key's scope. An unknown path also returns 404.
Common errors are described in Errors.
Request
curl https://api.melioralab.io/v1/campaigns/4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14 \
-H "Authorization: Bearer $MELIORA_API_KEY"const res = await fetch('https://api.melioralab.io/v1/campaigns/4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14', {
headers: { Authorization: `Bearer ${process.env.MELIORA_API_KEY}` },
});
if (!res.ok) throw new Error(`Meliora API: ${res.status}`);
const body = await res.json();import os
import requests
resp = requests.get(
"https://api.melioralab.io/v1/campaigns/4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
headers={"Authorization": f"Bearer {os.environ['MELIORA_API_KEY']}"},
timeout=15,
)
resp.raise_for_status()
body = resp.json()Response
{
"object": "campaign",
"id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"name": "Example campaign",
"status": "active",
"first_message_mode": "template",
"accepts_api_leads": false,
"reason": {
"reason_code": "none",
"reason_observed_at": null,
"next_attempt_at": null,
"requires_customer_action": null
},
"created_at": "2026-10-20T08:00:00.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
}