Asynchronous Execution

Start Asynchronous Execution

post

Starts an asynchronous execution of a published Chatbot (Chatflow or Workflow). This is ideal for long-running tasks. The API queues the job and immediately returns an execution_id and tracking URLs, allowing you to check the status later without keeping the connection open.

Authorizations
Path parameters
chatbot_idstringRequired

The unique identifier of the Chatbot to execute.

Body
Responses
202

The execution has been accepted for processing. The response body contains details to track the job.

application/json
post
POST /v1/executions/{chatbot_id}/async HTTP/1.1
Host: api.waterflai.ai
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 66

{
  "input_data": {
    "query": "What is Waterflai?",
    "user_id": "user-123"
  }
}
{
  "execution_id": "text",
  "status_url": "https://example.com",
  "stream_url": "https://example.com",
  "cancel_url": "https://example.com"
}

Get Execution Status

get

Retrieves the current status and result of a specific asynchronous execution. You should poll this endpoint to check the job's progress. Once the status is COMPLETED, the final_output field will contain the result.

Authorizations
Path parameters
execution_idstringRequired

The unique identifier of the execution job.

Responses
200

The current state of the execution job.

application/json
get
GET /v1/executions/{execution_id} HTTP/1.1
Host: api.waterflai.ai
X-API-Key: YOUR_API_KEY
Accept: */*
{
  "execution_id": "text",
  "status": "PENDING",
  "progress": 1,
  "current_node": "text",
  "completed_nodes": 1,
  "total_nodes": 1,
  "final_output": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "error_message": "text",
  "created_at": "2025-09-14T04:33:48.102Z",
  "started_at": "2025-09-14T04:33:48.102Z",
  "completed_at": "2025-09-14T04:33:48.102Z",
  "retry_count": 1,
  "execution_source": "CHATBOT",
  "is_temporary": true,
  "cleanup_after": "2025-09-14T04:33:48.102Z"
}

Cancel Asynchronous Execution

delete

Cancels a PENDING or RUNNING execution. Completed, failed, or already cancelled jobs cannot be cancelled again.

Authorizations
Path parameters
execution_idstringRequired

The unique identifier of the execution job to cancel.

Responses
200

The cancellation request was successfully processed.

application/json
delete
DELETE /v1/executions/{execution_id} HTTP/1.1
Host: api.waterflai.ai
X-API-Key: YOUR_API_KEY
Accept: */*
{
  "execution_id": "text",
  "cancelled": true,
  "message": "text",
  "previous_status": "PENDING"
}

Stream Asynchronous Execution Progress

get

Streams the real-time progress of a specific asynchronous execution via Server-Sent Events (SSE). This provides a live feed of events like node_started, node_completed, and execution_completed. The stream closes automatically when the job finishes.

Authorizations
Path parameters
execution_idstringRequired

The unique identifier of the execution job.

Responses
200

A stream of events representing the real-time execution progress.

text/event-stream
ResponsestringExample: data: {"type": "progress_update", "progress": 50.0}
get
GET /v1/executions/{execution_id}/stream HTTP/1.1
Host: api.waterflai.ai
X-API-Key: YOUR_API_KEY
Accept: */*
data: {"type": "progress_update", "progress": 50.0}