---
title: "Retrieve last n test runs for each of the specified tests"
method: POST
path: "/testRuns/workspace/{workspace_id}/byTestIds"
tags: ["TestRun"]
---

# Retrieve last n test runs for each of the specified tests

`POST /testRuns/workspace/{workspace_id}/byTestIds`

Retrieve the last n test runs for each test in the provided list of test
invariant ids within a workspace. Test ids that do not belong to the
workspace are omitted from the response. Scoped to a single page of the
Tests list so the client does not have to fetch the whole workspace.

## Path parameters

- `workspace_id` string, required

## Request body

- RecentTestRunsByTestIdsRequest — Request body for querying recent test runs for a set of tests
  - `test_ids` string[], required — The test IDs (invariant or variant) to fetch recent runs for
  - `max_runs_per_test` integer, required — Max number of runs per test

## Response `200`

History of test runs for the specified tests

- TestHistoryQueryResult — Contains map of test to most recent test run
  - `cursor` string — The cursor to use to continue paging
  - `tests` TestHistory[] — Test ids with recent test runs of that test
    - `test_id` string
    - `test_runs` TestRunStatusSummary[]
      - `journey_run_id` string
      - `status` string
      - `started_time` integer
      - `completed_time` integer

## Other responses

- `401` — User not authenticated
- `403` — User not authorized
- `default` — Unknown error

---

[API](https://skmtc.net/mabl/apis/mabl-api.md) · [All operations](https://skmtc.net/mabl/apis/mabl-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mabl/mabl-api/revisions/d0fc0114da66/schema)
