API Reference
Complete reference for the Loadlab REST API. All endpoints return JSON responses.
https://api.loadlab.devAuthentication
LoadLab supports two authentication methods: JWT tokens (for web app) and API keys (for CI/CD). For CI/CD integration, create an API key in Settings → API Keys.
Authorization header
Authorization: Bearer <your-api-key>
Projects
Manage your projects and their settings.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /projects | List all projects | Required |
| POST | /projects | Create a new project | Required |
| GET | /projects/:id | Get project details | Required |
| DELETE | /projects/:id | Delete a project | Required |
Scenarios
Create and manage load test scenarios.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /projects/:projectId/scenarios | List scenarios | Required |
| POST | /projects/:projectId/scenarios | Create a scenario | Required |
| GET | /projects/:projectId/scenarios/:id | Get scenario details | Required |
| DELETE | /projects/:projectId/scenarios/:id | Delete a scenario | Required |
Request body
POST /projects/:projectId/scenarios
{
"name": "Homepage load test",
"vus": 100,
"durationSeconds": 300,
"mode": "DURATION", // or "BURST"
"environmentId": "env_xxx",
"endpoints": [
{ "endpointId": "ep_xxx", "weight": 3 }
]
}Endpoints
Define API endpoints to include in your tests.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /projects/:projectId/endpoints | List endpoints | Required |
| POST | /projects/:projectId/endpoints | Create an endpoint | Required |
| DELETE | /projects/:projectId/endpoints/:id | Delete an endpoint | Required |
Request body
POST /projects/:projectId/endpoints
{
"method": "GET", // GET, POST, PUT, PATCH, DELETE
"path": "/api/users",
"name": "List users" // optional
}Environments
Configure target environments with base URLs and headers.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /projects/:projectId/environments | List environments | Required |
| POST | /projects/:projectId/environments | Create an environment | Required |
| DELETE | /projects/:projectId/environments/:id | Delete an environment | Required |
Request body
POST /projects/:projectId/environments
{
"name": "Production",
"baseUrl": "https://api.example.com",
"headers": {
"Authorization": "Bearer xxx"
}
}Runs
Create, monitor, and retrieve test run results.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /runs | List all runs | Required |
| POST | /runs | Create and enqueue a new run | Required |
| GET | /runs/:id | Get run details with metrics | Required |
| GET | /runs/:id/stream | SSE stream for live metrics | Required |
| POST | /runs/:id/cancel | Cancel a running test | Required |
| POST | /projects/:projectId/scenarios/:scenarioId/run | Trigger a run for a scenario | Required |
Response body
GET /runs/:id
{
"id": "run_xxx",
"status": "COMPLETED",
"p95LatencyMs": 145,
"p99LatencyMs": 289,
"throughputRps": 523,
"errorRate": 0.002,
"totalRequests": 15690
}Baselines
Set and retrieve baseline runs for comparison.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /runs/:runId/baseline | Get baseline for a run | Required |
| POST | /projects/:projectId/scenarios/:scenarioId/baseline | Set baseline run | Required |
Performance Badge
Embed a performance badge in your README or documentation.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /badge/perf | Get performance badge SVG | Optional |
Markdown

With scenario filter

CI/CD Integration
Integrate LoadLab into your CI/CD pipeline to automatically run load tests on every deployment. Use API keys for authentication (create them in Settings → API Keys).
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /ci/run | Trigger a load test run | Required |
| GET | /ci/runs/:id | Get run results with verdict | Required |
Trigger a Run
Request
POST /ci/run
Authorization: Bearer lt_xxxxxxxxxxxx
{
"projectKey": "my-project",
"scenarioKey": "checkout-flow",
"branch": "feature/new-api",
"commitSha": "abc123",
"baseBranch": "main"
}Response
{
"runId": "run_xxx",
"status": "PENDING"
}Get Run Results
Response
GET /ci/runs/:id
{
"id": "run_xxx",
"status": "COMPLETED",
"verdict": "PASS", // PASS, WARN, or FAIL
"verdictReasons": [
"All metrics within acceptable thresholds"
],
"metrics": {
"p95LatencyMs": 145,
"p99LatencyMs": 289,
"errorRate": 0.002,
"throughputRps": 523,
"totalRequests": 15690
},
"baseline": { // If baseline exists
"id": "run_yyy",
"metrics": { ... }
},
"diff": { // Comparison with baseline
"p95LatencyMs": -5.2,
"errorRate": 0.1
}
}Verdict Criteria
| Verdict | Condition |
|---|---|
| PASS | Error rate < 1% and P95 within 10% of baseline |
| WARN | Error rate 1-5% or P95 regressed 10-25% vs baseline |
| FAIL | Error rate > 5% or P95 regressed > 25% vs baseline |
GitHub Actions Example
.github/workflows/load-test.yml
name: Load Test
on:
push:
branches: [main]
pull_request:
jobs:
load-test:
runs-on: ubuntu-latest
steps:
- name: Trigger LoadLab test
id: trigger
run: |
RESPONSE=$(curl -s -X POST https://api.loadlab.dev/ci/run \
-H "Authorization: Bearer ${{ secrets.LOADLAB_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"projectKey": "my-project",
"scenarioKey": "api-stress-test",
"branch": "${{ github.ref_name }}",
"commitSha": "${{ github.sha }}"
}')
echo "run_id=$(echo $RESPONSE | jq -r '.runId')" >> $GITHUB_OUTPUT
- name: Wait for results
run: |
while true; do
RESULT=$(curl -s \
-H "Authorization: Bearer ${{ secrets.LOADLAB_API_KEY }}" \
https://api.loadlab.dev/ci/runs/${{ steps.trigger.outputs.run_id }})
STATUS=$(echo $RESULT | jq -r '.status')
if [[ "$STATUS" == "COMPLETED" || "$STATUS" == "FAILED" ]]; then
VERDICT=$(echo $RESULT | jq -r '.verdict')
echo "## Load Test Results" >> $GITHUB_STEP_SUMMARY
echo "**Verdict:** $VERDICT" >> $GITHUB_STEP_SUMMARY
echo $RESULT | jq -r '.verdictReasons[]' >> $GITHUB_STEP_SUMMARY
if [[ "$VERDICT" == "FAIL" ]]; then
echo "::error::Performance regression detected!"
exit 1
fi
break
fi
echo "Status: $STATUS - waiting..."
sleep 10
done