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

Enrollment and stop results, processing states and queue status.

#The Command object

Enrollment or stop command. Completed processing does not confirm sending.

Attributes

  • objectstring
    Object type, always command.
  • idstring (uuid)
    Identifier for polling this command.
  • kindstring
    enroll: enrollment; stop: stopping. Values: enroll stop
  • statestring
    accepted, running, done, done_with_unknown, failed. This is the command processing state. Values: accepted running done done_with_unknown failed
  • workspace_idstring (uuid)
    Original command workspace.
  • campaign_idstring (uuid)
    Original command campaign.
  • lead_idstring (uuid) or null
    Stop target lead; null for a batch.
  • created_atstring (date-time)
    Command acceptance time.
  • finished_atstring (date-time) or null
    Completion time or null.
  • Stopped work still needs cleanup. Continue polling.
  • resultobject
    Enrollment counters or stop result.
  • itemsarray of object
    Lead results in input order. Empty for a stop. Up to 100 items.
    Child attributes
    • Zero-based input index.
    • lead_idstring (uuid) or null
      Accepted or existing lead; null on rejection.
    • usernamestring or null
      Normalized username or null. Up to 32 characters.
    • external_idstring or null
      External identifier or null. Up to 128 characters.
    • statusstring
      accepted: new lead; existing: existing and unchanged; rejected: refused. Values: accepted existing rejected
    • reasonstring or null
      Rejection or hold reason, or null.
    • warningsarray of string
      first_message_long at 700 characters or more. Up to 1 items.
    • waiting, queued, held, failed, stopped, not_required. Enqueue does not confirm sending. Values: waiting queued held failed stopped not_required
Command
{
  "object": "command",
  "id": "bd465c91-d715-4987-ab61-e63a9f01c625",
  "kind": "enroll",
  "state": "accepted",
  "workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
  "campaign_id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
  "lead_id": null,
  "created_at": "2026-10-27T09:15:42.000Z",
  "finished_at": null,
  "cleanup_pending": false,
  "result": {
    "accepted": 1,
    "inserted": 1
  },
  "items": [
    {
      "input_index": 0,
      "lead_id": "5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31",
      "username": "example_lead",
      "external_id": "crm-1042",
      "status": "accepted",
      "reason": null,
      "warnings": [],
      "queue_state": "waiting"
    }
  ]
}

#The CommandItem object

Intake and enqueue result for one lead.

Attributes

  • Zero-based input index.
  • lead_idstring (uuid) or null
    Accepted or existing lead; null on rejection.
  • usernamestring or null
    Normalized username or null. Up to 32 characters.
  • external_idstring or null
    External identifier or null. Up to 128 characters.
  • statusstring
    accepted: new lead; existing: existing and unchanged; rejected: refused. Values: accepted existing rejected
  • reasonstring or null
    Rejection or hold reason, or null.
  • warningsarray of string
    first_message_long at 700 characters or more. Up to 1 items.
  • waiting, queued, held, failed, stopped, not_required. Enqueue does not confirm sending. Values: waiting queued held failed stopped not_required
CommandItem
{
  "input_index": 0,
  "lead_id": "5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31",
  "username": "example_lead",
  "external_id": "crm-1042",
  "status": "accepted",
  "reason": null,
  "warnings": [],
  "queue_state": "waiting"
}

#The EnrollResult object

Attributes

  • acceptedinteger
    Number of new leads accepted for enqueue.
  • insertedinteger
    Number of inserted records, including a possible policy rejection after insertion. Excludes existing.
EnrollResult
{
  "accepted": 1,
  "inserted": 1
}

#The StopResult object

Attributes

StopResult
{
  "automation_state": "stopping",
  "send_in_flight": true,
  "unknown_outcome_message_ids": []
}

#Get a command

GET/v1/commands/{id}

Requires the command kind permission: leads:enroll for enroll, leads:stop for stop. Polling does not start sending.

Permission
leads:enroll | leads:stop
Request weight
1

Parameters

  • idstring (uuid), pathrequired
    Command identifier.

Response

Returns a Command object.

Endpoint-specific errors

  • scope_required: The key does not permit the operation. A command requires its kind permission.
  • 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/commands/bd465c91-d715-4987-ab61-e63a9f01c625 \
  -H "Authorization: Bearer $MELIORA_API_KEY"
Response
{
  "object": "command",
  "id": "bd465c91-d715-4987-ab61-e63a9f01c625",
  "kind": "enroll",
  "state": "accepted",
  "workspace_id": "3f6a9d21-8b4c-4e7f-a102-5c9e8d7b6a43",
  "campaign_id": "4d8b2f73-6e1a-4c95-b7d0-8a3f5e2c9b14",
  "lead_id": null,
  "created_at": "2026-10-27T09:15:42.000Z",
  "finished_at": null,
  "cleanup_pending": false,
  "result": {
    "accepted": 1,
    "inserted": 1
  },
  "items": [
    {
      "input_index": 0,
      "lead_id": "5a7c3e92-1f4b-4d68-9c2e-7b0a6d4f8e31",
      "username": "example_lead",
      "external_id": "crm-1042",
      "status": "accepted",
      "reason": null,
      "warnings": [],
      "queue_state": "waiting"
    }
  ]
}