Tests and Test Runs REST API
Warning
The use of this API is discouraged in favor of API v6 Load tests and API v6 Test runs.
Use these endpoints to access tests and test runs in Grafana Cloud k6.
List load tests
GET /projects/:projectId/load_tests
Example URL with optional parameters:
GET /projects/:projectId/load_tests?$top=10&$skip=20&$count=true&$select=id,name,created&$orderby=created desc&$filter=contains(name,'heavy')
Parameters
All parameters are optional.
Parameter | Description |
---|---|
$select | Specifies a comma-separated list of properties to include in the response. |
$orderby | Specifies the sorting order for the returned results. It accepts one or more comma-separated properties with an optional asc (ascending) or desc (descending) keyword. |
$top | Limits the number of items to return in the response. |
$skip | Specifies the number of items to skip in the result set before returning the remaining items. It is used for paging through a large result set. |
$count | Includes a count of the total number of items in the result set in the response. |
$filter | Filters the result set based on specified conditions. |
Example request:
GET https://api.k6.io/cloud/v5/projects/5276/load_tests?$count=true
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example response
HTTP/1.1 200
Content-Type: application/json
{
"@count": "3",
"value": [
{
"created": "2021-05-24T12:59:18.180471Z",
"id": 4122,
"name": "Simple login test",
"project_id": 5276,
"project_name": "Heavy tests",
"updated": "2021-05-24T12:59:18.180483Z"
},
{
"created": "2020-07-20T09:32:46.071962Z",
"id": 3535,
"name": "Cart checkout test",
"project_id": 5276,
"project_name": "Heavy tests",
"updated": "2020-07-22T08:14:05.164385Z"
},
{
"created": "2020-07-17T15:18:31.274028Z",
"id": 3533,
"name": "Cart checkout test (increased VUs)",
"project_id": 5276,
"project_name": "Heavy tests",
"updated": "2020-07-17T15:18:31.274041Z"
},
]
}
Get single load test by Id
GET /load_tests/:id
Parameters
Parameter | Description |
---|---|
$select | Optional: Specifies a comma-separated list of properties to include in the response. |
Example Request:
GET https://api.k6.io/cloud/v5/load_tests/3535?$select=id,name
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example Response:
HTTP/1.1 200
Content-Type: application/json
{
"id": 3535,
"name": "Cart checkout test",
}
List test runs
GET /load_tests/:loadTestId/test_runs
Example URL with optional parameters:
GET /load_tests/:loadTestId/test_runs?$top=10&$skip=20&$count=true&$select=id,name,created&$orderby=created desc&$filter=run_status eq 5 and
Parameters
All parameters are optional.
Parameter | Description |
---|---|
$select | Specifies a comma-separated list of properties to include in the response. |
$orderby | Specifies the sorting order for the returned results. It accepts one or more comma-separated properties with an optional asc (ascending) or desc (descending) keyword. |
$top | Limits the number of items to return in the response. |
$skip | Specifies the number of items to skip in the result set before returning the remaining items. It is used for paging through a large result set. |
$count | Includes a count of the total number of items in the result set in the response. |
$filter | Filters the result set based on specified conditions. |
Example request:
GET https://api.k6.io/cloud/v5/load_tests/3535/test_runs?$top=10&$count=true&$orderby=created desc
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example response
HTTP/1.1 200
Content-Type: application/json
{
"@count": "144",
"value": [
{
"config": {
"agent_access_token": "eba569496f1d64f42333333320e4abaec0c74c6baf06d22f603f3aac7eb39c",
"archive": "4744e429260e47f8a504443d0f9f1bf1.tar",
// cut for brevity
},
"created": "2023-05-18T08:46:01.157645Z",
"delete_status": 0,
"deleted": false,
"duration": 2550,
"ended": "2023-05-18T08:55:25.000000Z",
"error_code": null,
"error_detail": null,
"id": 152779,
"is_baseline": false,
"note": "",
"organization_id": 499,
"processing_status": 2,
"project_id": 5276,
"public_id": null,
"result_status": 0,
"run_process": "UI-Script to Cloud",
"run_status": 5,
"script": "import { sleep, check } from 'k6 ...", // cut for brevity
"started": "2023-05-18T08:48:31.000000Z",
"stopped_by_id": 703,
"test_id": 3535,
"user_id": 703,
"vus": 3000
},
// cut for brevity
]
}
Get single test run by Id
GET /test_runs/:id
Parameters
Parameter | Description |
---|---|
$select | Optional: Specifies a comma-separated list of properties to include in the response. |
Example Request:
GET https://api.k6.io/cloud/v5/test_runs/152779
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example Response:
HTTP/1.1 200
Content-Type: application/json
{
"config": {
"agent_access_token": "eba569496f1d64f42333333320e4abaec0c74c6baf06d22f603f3aac7eb39c",
"archive": "4744e429260e47f8a504443d0f9f1bf1.tar",
// cut for brevity
},
"created": "2023-05-18T08:46:01.157645Z",
"delete_status": 0,
"deleted": false,
"duration": 2550,
"ended": "2023-05-18T08:55:25.000000Z",
"error_code": null,
"error_detail": null,
"id": 152779,
"is_baseline": false,
"note": "",
"organization_id": 499,
"processing_status": 2,
"project_id": 5276,
"public_id": null,
"result_status": 0,
"run_process": "UI-Script to Cloud",
"run_status": 5,
"script": "import { sleep, check } from 'k6 ...", // cut for brevity
"started": "2023-05-18T08:48:31.000000Z",
"stopped_by_id": 703,
"test_id": 3535,
"user_id": 703,
"vus": 3000
}