Orchestrating Long-Running APIs
This tutorial demonstrates how to handle long-running APIs using Orkes Conductor. You’ll learn how to prevent HTTP timeouts when APIs take several minutes to complete, using Conductor’s built-in capabilities: the HTTP Poll task and async complete.
By the end, you'll have a fully functional workflow that orchestrates long-running APIs effectively.
Understanding the challenge
When an API takes longer than 60 seconds to respond, a standard HTTP request can timeout and fail.
Conductor provides two easy ways to handle such cases:
- Method 1: Using the HTTP Poll task – Triggers the API and periodically polls its status until the job completes.
- Method 2: Using async complete – Triggers the API and marks the HTTP task complete later through a callback.
Both approaches let you handle long-running APIs natively within Conductor.
Before you begin, ensure that you have the following:
- Access to an Orkes Conductor cluster. Use the free Developer Edition to get started.
- An API that either:
- Exposes a status endpoint that can be polled for progress, or
- Sends a callback when processing is complete.
Method 1: Handle long-running APIs using an HTTP Poll task
In this method, the workflow uses two tasks to manage a long-running API.
- The HTTP task that sends a request to start the job on an external system.
- The HTTP Poll task then periodically calls the API’s status endpoint to check the job’s progress. Polling continues until the response meets the defined termination condition (for example, status = COMPLETED), at which point the workflow completes.
To create a workflow:
- Go to Definitions > Workflow from the left navigation menu on your Conductor cluster.
- Select + Define workflow.
- In the Code tab, paste the following code:
{
"name": "LongRunningAPIWorkflow",
"description": "Starts a long-running job and polls its status until completion using Orkes API Tester service",
"version": 1,
"schemaVersion": 2,
"tasks": [
{
"name": "startRemoteJob",
"taskReferenceName": "startRemoteJob",
"type": "HTTP",
"inputParameters": {
"http_request": {
"uri": "https://orkes-api-tester.orkesconductor.com/api",
"method": "POST",
"contentType": "application/json",
"accept": "application/json",
"body": {
"message": "Start long-running process"
}
}
}
},
{
"name": "pollJobStatus",
"taskReferenceName": "pollJobStatus",
"type": "HTTP_POLL",
"inputParameters": {
"http_request": {
"uri": "https://orkes-api-tester.orkesconductor.com/api",
"method": "GET",
"accept": "application/json",
"contentType": "application/json",
"pollingInterval": "5",
"pollingStrategy": "FIXED",
"terminationCondition": "(function(){ return $.output.response.statusCode == 200; })();"
}
}
}
]
}
- Select Save > Confirm.
Your workflow looks like this:

In this workflow, the HTTP task triggers the API that starts a job. The HTTP Poll task queries the status endpoint every 5 seconds until the termination condition is met. The workflow completes once that condition evaluates to true.
Let’s run the workflow using Conductor UI. Open your workflow definition, and select Execute.
The workflow begins, and the polling task continues to call the API at regular intervals until the response meets the termination condition (for example, when the status is set to COMPLETED). Once the condition is met, the workflow is completed successfully.
Replace orkes-api-tester.orkesconductor.com with your own API endpoint before using this workflow in practice.