public api s for integration.md

Public API's for Integration

This article explains how to use the Leapwork Go Integration API to discover timelines and data items, start timeline runs, poll for completion, and download result reports from your own tooling.

It is intended for customer developers integrating Leapwork Go with CI/CD pipelines, schedulers, or custom automation. You can explore endpoints, review request and response formats, and try out calls directly in the browser at https://perfapi.leapwork.ai/swagger/integrations/index.html

What this article covers

The examples below show the fields most relevant for integration. Some responses may contain additional fields in your environment.

Before you start

Authentication

Use the API key in the Authorization header on every request:

Authorization: X-API-KEY rik_your_generated_key

Example:

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
"$BASE_URL/api/integration/getTimelines"

Integration API keys are company-scoped. If a key is expired, revoked, or invalid, the API will reject the request.

Supported endpoints

Method Endpoint Purpose
GET /api/integration/getTimelines List timelines available to your company
GET /api/integration/getTimelineAsset?timelineAssetId={id} Get a timeline by asset ID
GET /api/integration/getTimeline?timelineName={name}&projectId={projectId} Get a timeline by name
GET /api/integration/getDataItems?projectId={projectId} List data items in a project
GET /api/integration/getDataItemAsset?dataItemId={id} Get a data item by asset ID
GET /api/integration/getDataItem?dataItemName={name}&projectId={projectId} Get a data item by name
POST /api/integration/runIntegration Start a timeline run
GET /api/integration/getTimelineStatus?runId={runId}&trackItemIds={ids} Poll run status
GET /api/integration/downloadRunReport?runId={runId}&trackItemIds={ids} Download the Excel run report
GET /api/integration/downloadAiAnalysisReport?runId={runId} Download the combined AI analysis report
GET /api/integration/getAiAnalysis?runId={runId}&trackItemId={trackItemId} Download AI analysis for one track item
GET /api/integration/stopIntegration?runId={runId} Stop an active run

Recommended workflow

  1. Resolve the timeline you want to run.
  2. Resolve the data item if your run needs one.
  3. Call runIntegration.
  4. Poll the returned pollResultUrl every 5 seconds.
  5. When the run reaches a terminal status, download the Excel and AI analysis reports.

For stable automation, prefer timelineAssetId over timelineName when you already know the ID.

1. Discover timelines

List all timelines

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
"$BASE_URL/api/integration/getTimelines"

Example response:

[ { "timelineId": "timeline_123", "projectId": "project_001", "title": "Checkout Load Test" }, { "timelineId": "timeline_456", "projectId": "project_001", "title": "Login Smoke Timeline" } ]

Get a timeline by asset ID

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
"$BASE_URL/api/integration/getTimelineAsset?timelineAssetId=timeline_123"

Example response:

{ "projectId": "project_001", "timeline": { "tracks": [ { "id": "track_001", "height": 160 } ], "trackItems": [ { "id": "ti_001", "trackId": "track_001", "title": "Login Flow", "startTime": 0, "lengthTime": 300, "sequenceId": "seq_001", "region": "westeurope", "load": [ { "time": 0, "load": 5 }, { "time": 300, "load": 5 } ], "thresholdLevel": [], "endCondition": "duration", "executionTarget": null } ], "isRunEnabled": true }, "plannedRunTime": 300, "estimatedVum": 25 }

Get a timeline by name

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
--get
--data-urlencode "timelineName=Checkout Load Test"
--data-urlencode "projectId=project_001"
"$BASE_URL/api/integration/getTimeline"

Example response:

{ "projectId": "project_001", "timeline": { "tracks": [], "trackItems": [ { "id": "ti_001", "title": "Login Flow", "region": "westeurope" }, { "id": "ti_002", "title": "Search Flow", "region": "eastus" } ], "isRunEnabled": true }, "plannedRunTime": 360, "estimatedVum": 150 }

2. Discover data items

List data items in a project

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
"$BASE_URL/api/integration/getDataItems?projectId=project_001"

Example response:

[ { "id": "di_internal_001", "assetId": "dataitem_123", "projectId": "project_001", "companyId": "company_001", "dataItemName": "Retail Users", "text": [ { "email": "user1@example.com", "role": "Admin" } ], "isDeleted": false } ]

Get a data item by asset ID

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
"$BASE_URL/api/integration/getDataItemAsset?dataItemId=dataitem_123"

Example response:

{ "id": "di_internal_001", "assetId": "dataitem_123", "projectId": "project_001", "companyId": "company_001", "dataItemName": "Retail Users", "text": [ { "email": "user1@example.com", "role": "Admin" }, { "email": "user2@example.com", "role": "User" } ], "isDeleted": false }

Get a data item by name

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
--get
--data-urlencode "dataItemName=Retail Users"
--data-urlencode "projectId=project_001"
"$BASE_URL/api/integration/getDataItem"

3. Start a run

Simple request using a timeline and data item

If you provide a dataItemAssetId or dataItemName and omit trackItems, Leapwork Go builds the per-track-item configuration for you.

curl -s
-X POST
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
-H "Content-Type: application/json"
"$BASE_URL/api/integration/runIntegration"
-d '{ "timelineAssetId": "timeline_123", "dataItemAssetId": "dataitem_123", "role": "Admin", "userCount": 5 }'

Example response:

{ "timelineId": "timeline_123", "runId": "run_x7k2m", "status": "Preparing", "estimatedVum": 150, "plannedRunTime": 360, "trackItems": [ { "trackItemId": "ti_001", "sequenceName": "Login Flow", "region": "westeurope" }, { "trackItemId": "ti_002", "sequenceName": "Search Flow", "region": "eastus" } ], "pollResultUrl": "https://your-PERFORMANCE-base-url/api/integration/getTimelineStatus?runId=run_x7k2m&trackItemIds=ti_001%2Cti_002" }

Request using timeline name and project ID

curl -s
-X POST
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
-H "Content-Type: application/json"
"$BASE_URL/api/integration/runIntegration"
-d '{ "timelineName": "Checkout Load Test", "projectId": "project_001", "dataItemName": "Retail Users", "userCount": 10 }'

Advanced request with explicit track item configuration

Use trackItems when different track items need different user counts, roles, or data items.

curl -s
-X POST
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
-H "Content-Type: application/json"
"$BASE_URL/api/integration/runIntegration"
-d '{ "timelineAssetId": "timeline_123", "trackItems": { "ti_001": { "dataItemAssetId": "dataitem_123", "selectedRoles": ["Admin"], "userCount": 5 }, "ti_002": { "dataItemAssetId": "dataitem_456", "selectedRoles": ["User"], "userCount": 20 } } }'

If you provide trackItems, the API uses that explicit configuration instead of auto-building one from dataItemAssetId, dataItemName, role, and userCount.

Each track item object currently supports:

If you use a custom authenticated flow, authScriptId can be used to reference the auth script for that track item. For more on TOTP-based authenticated flows, see Use TOTP-Based MFA for Authenticated Flows in Leapwork Go.

The top-level request body currently supports these fields:

Field Required Description
timelineAssetId Conditional Timeline asset ID. Provide this or timelineName
timelineName Conditional Timeline name. Requires projectId
projectId Conditional Required when you use timelineName
dataItemAssetId No Data item asset ID
dataItemName No Data item name
role No Role to use when the server builds track item configs
userCount No User count to use when the server builds track item configs
trackItems No Explicit per-track-item configuration

If both an ID and a name are supplied for the same entity, the ID takes precedence.

4. Poll for completion

Use the pollResultUrl returned by runIntegration. That URL already includes the required runId and trackItemIds values.

A practical polling interval is every 5 seconds. For your overall timeout, use plannedRunTime + 300 seconds.

In-progress response

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
"$POLL_RESULT_URL"

Example response:

{ "status": "Running" }

Possible non-terminal statuses:

Terminal response

When the run completes, stops, or fails, the response includes metadata and report URLs.

Example response:

{ "status": "Finished", "metadata": [ { "trackItemId": "ti_001", "metadata": [ { "runId": "run_x7k2m", "trackItemId": "ti_001", "stepId": "step_001", "title": "POST /api/login", "errors": 0, "requestsSent": 1500, "totalBodyBytesSent": 0, "totalBytesReceived": 3750000, "min": 12, "max": 480, "average": 45, "median": 38, "p90": 80, "p95": 120, "p99": 250 } ] } ], "excelReportUrl": "https://your-PERFORMANCE-base-url/api/integration/downloadRunReport?runId=run_x7k2m&trackItemIds=ti_001%2Cti_002", "aiAnalysisReportUrl": "https://your-PERFORMANCE-base-url/api/integration/downloadAiAnalysisReport?runId=run_x7k2m" }

Possible terminal statuses:

5. Download reports

Download the Excel report

curl -L
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
-o run-report.xlsx
"$EXCEL_REPORT_URL"

The Excel report contains step-level run metrics grouped by track item.

Download the combined AI analysis report

curl -L
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
-o ai-analysis.txt
"$AI_ANALYSIS_REPORT_URL"

If AI analysis for a track item is not yet available, the combined report can include guidance to call the per-track-item endpoint directly.

Download AI analysis for one track item

curl -L
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
-o trackitem-ai-analysis.txt
"$BASE_URL/api/integration/getAiAnalysis?runId=run_x7k2m&trackItemId=ti_001"

Example output format:

=== AI Analysis for: ti_001 === Login Flow - Response times stayed stable for most of the run. - No meaningful error spike was detected.

6. Stop an active run

curl -s
-H "Authorization: X-API-KEY $PERFORMANCE_API_KEY"
"$BASE_URL/api/integration/stopIntegration?runId=run_x7k2m"

Example response:

"Stopped run run_x7k2m"

After stopping a run, call pollResultUrl again to retrieve the final status and any available report URLs.

Common error responses

Status Example reason
401 Missing, invalid, expired, or revoked API key
403 Integration is not enabled in your environment
400 Missing required request fields, unknown timeline, unknown data item, or unknown run

Example 400 responses:

"Either timelineAssetId or timelineName must be provided"

"projectId is required when using timelineName"

"No timeline found with name 'Checkout Load Test'"