Leads
A lead is one contact taking part in one campaign. If the same person is in two campaigns, that is two leads with different id values.
Endpoints
#The Lead object
Lead: the participation of one contact in one campaign. The same person in two campaigns produces two different leads.
Attributes
objectstringObject type, alwayslead.idstring (uuid)Lead ID (participation in a campaign).workspace_idstring (uuid)Workspace of the campaign.campaign_idstring (uuid)Campaign the contact participates in.usernamestring or nullTelegram username without@. Can benull. Not unique: usefields.record_idto link to your CRM.statusstringLead status in the campaign. Values:newcontactedcompletedrepliedblockedfailedsuspendeddeletedopted_outunknownexternal_idnullReserved for future versions. Alwaysnullin v1.fieldsobjectAllowed fields from the contact record.Child attributes
- Record ID in an external CRM, passed when the contacts were uploaded.
nullifrecord_id_statusis notvalid. Up to 128 characters. - First name. Up to 1024 characters.
- Last name. Up to 1024 characters.
- Company. Up to 1024 characters.
- Job title. Up to 1024 characters.
- Website. Up to 1024 characters.
- Contact source. Up to 1024 characters.
- The
utm_sourcetag. Up to 1024 characters. - The
utm_mediumtag. Up to 1024 characters. - The
utm_campaigntag. Up to 1024 characters.
fields_truncatedbooleantrueif some field values were shortened or hidden due to size limits.record_id_statusstringHow reliablefields.record_idis:valid,missing,conflictorunknown. Values:validmissingconflictunknownfirst_contact_accountobject or nullAccount that sent the first message.nullif unknown.first_message_sent_atstring (date-time) or nullWhen the first message was sent.nullif sending is not confirmed.first_reply_atstring (date-time) or nullWhen the first reply arrived.nullif there was no reply.delivery_statestringDelivery state of the next or most recent message in the sequence. Values:waiting_queuequeuedheldsentfailedunknownautomation_statestringState of the automatic sequence for this lead. Leads without a scheduled message, such as those who replied, currently often haveunknown. Values:runningpausedheldstoppedcompletedunknownreasonobjectWhy the sequence is waiting, 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 contact was added to the campaign.observed_atstring (date-time)Time the server read the data.
Lead
{
"object": "lead",
"id": "5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"campaign_id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
"username": "example_user",
"status": "replied",
"external_id": null,
"fields": {
"record_id": "crm-10482",
"first_name": "Anna",
"company": "Example Ltd",
"position": "Head of sales",
"utm_source": "partner"
},
"fields_truncated": false,
"record_id_status": "valid",
"first_contact_account": {
"id": "1d9f6b28-4c3e-4a75-8b19-5e7a2c0f6d83",
"username": "example_sender",
"name": "Mary from Example"
},
"first_message_sent_at": "2026-10-26T07:30:00.000Z",
"first_reply_at": "2026-10-26T09:12:00.000Z",
"delivery_state": "sent",
"automation_state": "unknown",
"reason": {
"reason_code": "none",
"reason_observed_at": null,
"next_attempt_at": null,
"requires_customer_action": null
},
"created_at": "2026-10-25T14:00:00.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
}#List leads
GET/v1/leads
Leads (contacts' participation in 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 objects in this campaign.
- Exact Telegram username. A leading
@and letter case are ignored. - Only leads with this status. Values:
newcontactedcompletedrepliedblockedfailedsuspendeddeletedopted_outunknown - Only leads with this delivery state. The values
waiting_queueandfailedare not returned at the moment, so filtering by them returns an empty list. Values:waiting_queuequeuedheldsentfailedunknown
Response
A list: object, data (an array of Lead 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/leads \
-H "Authorization: Bearer $MELIORA_API_KEY" \
-d campaign_id=4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14 \
-d limit=50const url = new URL('https://api.melioralab.io/v1/leads');
url.searchParams.set('campaign_id', '4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14');
url.searchParams.set('limit', '50');
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/leads",
headers={"Authorization": f"Bearer {os.environ['MELIORA_API_KEY']}"},
params={"campaign_id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14", "limit": 50},
timeout=15,
)
resp.raise_for_status()
body = resp.json()Response
{
"object": "list",
"data": [
{
"object": "lead",
"id": "5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"campaign_id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
"username": "example_user",
"status": "replied",
"external_id": null,
"fields": {
"record_id": "crm-10482",
"first_name": "Anna",
"company": "Example Ltd",
"position": "Head of sales",
"utm_source": "partner"
},
"fields_truncated": false,
"record_id_status": "valid",
"first_contact_account": {
"id": "1d9f6b28-4c3e-4a75-8b19-5e7a2c0f6d83",
"username": "example_sender",
"name": "Mary from Example"
},
"first_message_sent_at": "2026-10-26T07:30:00.000Z",
"first_reply_at": "2026-10-26T09:12:00.000Z",
"delivery_state": "sent",
"automation_state": "unknown",
"reason": {
"reason_code": "none",
"reason_observed_at": null,
"next_attempt_at": null,
"requires_customer_action": null
},
"created_at": "2026-10-25T14:00:00.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
},
{
"object": "lead",
"id": "8c1e5a37-9d2f-4b74-a6e8-2f9b3c7d5a40",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"campaign_id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
"username": "sample_contact",
"status": "contacted",
"external_id": null,
"fields": {
"record_id": null,
"first_name": "Igor"
},
"fields_truncated": false,
"record_id_status": "missing",
"first_contact_account": {
"id": "1d9f6b28-4c3e-4a75-8b19-5e7a2c0f6d83",
"username": "example_sender",
"name": "Mary from Example"
},
"first_message_sent_at": "2026-10-26T07:42:00.000Z",
"first_reply_at": null,
"delivery_state": "queued",
"automation_state": "running",
"reason": {
"reason_code": "queue_pending",
"reason_observed_at": "2026-10-27T08:58:10.000Z",
"next_attempt_at": "2026-10-27T10:00:00.000Z",
"requires_customer_action": false
},
"created_at": "2026-10-25T14:00:01.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
}
],
"has_more": true,
"next_cursor": "v1.k1.Qm9hcmRfMWZ4.c3RyaWN0bHlfb3BhcXVl.dGFnX2V4YW1wbGU.bWFjX2V4YW1wbGVfdmFsdWU"
}#Retrieve a lead
GET/v1/leads/{id}
A single lead by ID. A lead outside the key's scope returns 404.
Parameters
- Lead ID.
Response
Returns a Lead 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/leads/5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31 \
-H "Authorization: Bearer $MELIORA_API_KEY"const res = await fetch('https://api.melioralab.io/v1/leads/5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31', {
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/leads/5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31",
headers={"Authorization": f"Bearer {os.environ['MELIORA_API_KEY']}"},
timeout=15,
)
resp.raise_for_status()
body = resp.json()Response
{
"object": "lead",
"id": "5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31",
"workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
"campaign_id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
"username": "example_user",
"status": "replied",
"external_id": null,
"fields": {
"record_id": "crm-10482",
"first_name": "Anna",
"company": "Example Ltd",
"position": "Head of sales",
"utm_source": "partner"
},
"fields_truncated": false,
"record_id_status": "valid",
"first_contact_account": {
"id": "1d9f6b28-4c3e-4a75-8b19-5e7a2c0f6d83",
"username": "example_sender",
"name": "Mary from Example"
},
"first_message_sent_at": "2026-10-26T07:30:00.000Z",
"first_reply_at": "2026-10-26T09:12:00.000Z",
"delivery_state": "sent",
"automation_state": "unknown",
"reason": {
"reason_code": "none",
"reason_observed_at": null,
"next_attempt_at": null,
"requires_customer_action": null
},
"created_at": "2026-10-25T14:00:00.000Z",
"observed_at": "2026-10-27T09:15:42.000Z"
}