API RU
Early access. API keys are issued on request. How to get a key

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.

#The Lead object

Lead: the participation of one contact in one campaign. The same person in two campaigns produces two different leads.

Attributes

  • objectstring
    Object type, always lead.
  • 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 null
    Telegram username without @. Can be null. Not unique: use fields.record_id to link to your CRM.
  • statusstring
    Lead status in the campaign. Values: new contacted completed replied blocked failed suspended deleted opted_out unknown
  • Reserved for future versions. Always null in v1.
  • fieldsobject
    Allowed fields from the contact record.
    Child attributes
    • record_idstring or nullmay be absent
      Record ID in an external CRM, passed when the contacts were uploaded. null if record_id_status is not valid. Up to 128 characters.
    • first_namestring or nullmay be absent
      First name. Up to 1024 characters.
    • last_namestring or nullmay be absent
      Last name. Up to 1024 characters.
    • companystring or nullmay be absent
      Company. Up to 1024 characters.
    • positionstring or nullmay be absent
      Job title. Up to 1024 characters.
    • websitestring or nullmay be absent
      Website. Up to 1024 characters.
    • sourcestring or nullmay be absent
      Contact source. Up to 1024 characters.
    • utm_sourcestring or nullmay be absent
      The utm_source tag. Up to 1024 characters.
    • utm_mediumstring or nullmay be absent
      The utm_medium tag. Up to 1024 characters.
    • utm_campaignstring or nullmay be absent
      The utm_campaign tag. Up to 1024 characters.
  • true if some field values were shortened or hidden due to size limits.
  • How reliable fields.record_id is: valid, missing, conflict or unknown. Values: valid missing conflict unknown
  • first_contact_accountobject or null
    Account that sent the first message. null if unknown.
    Child attributes
    • idstring (uuid)
      Account ID.
    • usernamestring or null
      Account username without @. Can be null.
    • namestring or null
      Account display name. Can be null.
  • first_message_sent_atstring (date-time) or null
    When the first message was sent. null if sending is not confirmed.
  • first_reply_atstring (date-time) or null
    When the first reply arrived. null if there was no reply.
  • Delivery state of the next or most recent message in the sequence. Values: waiting_queue queued held sent failed unknown
  • State of the automatic sequence for this lead. Leads without a scheduled message, such as those who replied, currently often have unknown. Values: running paused held stopped completed unknown
  • reasonobject
    Why the sequence is waiting, if known.
    Child attributes
    • Reason code. Values: none schedule_window daily_limit queue_pending telegram_wait account_unavailable account_restricted campaign_paused subscription_inactive manual_hold automation_stopped service_unavailable unknown
    • reason_observed_atstring (date-time) or null
      When the reason was recorded. null if unknown.
    • next_attempt_atstring (date-time) or null
      When the next attempt is expected. null if the time is unknown.
    • Whether someone needs to act in Meliora for sending to resume. null if 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.

Permission
leads:read
Request weight
2

Parameters

  • limitinteger, queryoptional
    Number of objects to return per page. From 1 to 100. Defaults to 50.
  • cursorstring, queryoptional
    The next_cursor value from the previous response. Other filters must match the first request.
  • workspace_idstring (uuid), queryoptional
    Only objects in this workspace.
  • campaign_idstring (uuid), queryoptional
    Only objects in this campaign.
  • usernamestring, queryoptional
    Exact Telegram username. A leading @ and letter case are ignored.
  • statusstring, queryoptional
    Only leads with this status. Values: new contacted completed replied blocked failed suspended deleted opted_out unknown
  • delivery_statestring, queryoptional
    Only leads with this delivery state. The values waiting_queue and failed are not returned at the moment, so filtering by them returns an empty list. Values: waiting_queue queued held sent failed unknown

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=50
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.

Permission
leads:read
Request weight
1

Parameters

  • idstring (uuid), pathrequired
    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"
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"
}