Getting Started
Learn how to get started running workflows via API
Get Your API Key
To use the Leap Workflows API, you’ll need an API key. You can get one by signing up for a free account at app.tryleap.ai.
Running a Workflow via the API
Before you can run a workflow via the API, you’ll need to publish it first:
- Create and test your workflow in the Leap Workflows Builder
- Click the “Publish” button in the top right corner
- Your workflow is now ready to be called via the API
After publishing your workflow you’ll need to retrieve the workflow_id
and the trigger_id
you want to use.
Here’s a quick example of how you can publish and retrieve these values:
API Endpoints
Get started with these key endpoints:
- Run Workflow - Execute a published workflow
- Get Workflow Run - Check the status and results of a workflow run
Understanding the API Flow
When running a workflow through the API, it follows an asynchronous pattern:
-
First, you call the Run Workflow endpoint which immediately returns a workflow run
id
. The workflow execution happens asynchronously in the background. -
Then, you use the Get Workflow Run endpoint using the
id
returned from the Run Workflow endpoint to check on the status and retrieve the results. A common pattern is to poll this endpoint every few seconds until the workflow run is complete.
Here’s a typical flow:
- Call
/v2/runs
with your workflow configuration - Receive a workflow run
id
immediately - Poll
/v2/runs/{workflow_run_id}
periodically to check status and get results - Once the status indicates completion, retrieve your workflow output
This asynchronous approach allows you to handle long-running workflows efficiently without keeping connections open for extended periods.