Commands
Enrollment and stop results, processing states and queue status.
Endpoints
#The Command object
Enrollment or stop command. Completed processing does not confirm sending.
Attributes
objectstringObject type, alwayscommand.idstring (uuid)Identifier for polling this command.kindstringenroll: enrollment;stop: stopping. Values:enrollstopstatestringaccepted,running,done,done_with_unknown,failed. This is the command processing state. Values:acceptedrunningdonedone_with_unknownfailedworkspace_idstring (uuid)Original command workspace.campaign_idstring (uuid)Original command campaign.lead_idstring (uuid) or nullStop target lead;nullfor a batch.created_atstring (date-time)Command acceptance time.finished_atstring (date-time) or nullCompletion time ornull.cleanup_pendingbooleanStopped work still needs cleanup. Continue polling.resultobjectEnrollment counters or stop result.itemsarray of objectLead results in input order. Empty for a stop. Up to 100 items.Child attributes
input_indexintegerZero-based input index.lead_idstring (uuid) or nullAccepted or existing lead;nullon rejection.usernamestring or nullNormalized username ornull. Up to 32 characters.external_idstring or nullExternal identifier ornull. Up to 128 characters.statusstringaccepted: new lead;existing: existing and unchanged;rejected: refused. Values:acceptedexistingrejectedreasonstring or nullRejection or hold reason, ornull.warningsarray of stringfirst_message_longat 700 characters or more. Up to 1 items.queue_statestringwaiting,queued,held,failed,stopped,not_required. Enqueue does not confirm sending. Values:waitingqueuedheldfailedstoppednot_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
input_indexintegerZero-based input index.lead_idstring (uuid) or nullAccepted or existing lead;nullon rejection.usernamestring or nullNormalized username ornull. Up to 32 characters.external_idstring or nullExternal identifier ornull. Up to 128 characters.statusstringaccepted: new lead;existing: existing and unchanged;rejected: refused. Values:acceptedexistingrejectedreasonstring or nullRejection or hold reason, ornull.warningsarray of stringfirst_message_longat 700 characters or more. Up to 1 items.queue_statestringwaiting,queued,held,failed,stopped,not_required. Enqueue does not confirm sending. Values:waitingqueuedheldfailedstoppednot_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
EnrollResult
{
"accepted": 1,
"inserted": 1
}#The StopResult object
Attributes
automation_statestringstopping: sending started;stopped: no new attempts will start. Values:stoppedstoppingsend_in_flightbooleanAn in-flight send may still complete.unknown_outcome_message_idsarray of stringOpaque identifiers of unknown outcomes. Do not retry these sends.
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.
Parameters
- 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"const res = await fetch('https://api.melioralab.io/v1/commands/bd465c91-d715-4987-ab61-e63a9f01c625', {
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/commands/bd465c91-d715-4987-ab61-e63a9f01c625",
headers={"Authorization": f"Bearer {os.environ['MELIORA_API_KEY']}"},
timeout=15,
)
resp.raise_for_status()
body = resp.json()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"
}
]
}