curl -X POST "https://nunu.ai/api/v1/project/your-project-id/runs/export/testrail" \
-H "X-Api-Key: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"multiplayer_run_id":"nunu-multiplayer-run-id","custom_run_name":"CI regression"}'
{
"success": true,
"testrail_run_id": 123,
"testrail_run_name": "CI regression",
"testrail_run_url": "https://example.testrail.io/index.php?/runs/view/123",
"export_type": "single_run",
"export_trigger": "manual",
"export_strategy": "single_suite",
"runs_processed": ["nunu-multiplayer-run-id"],
"total_test_cases": 4,
"warnings": []
}
{
"error": "an export for this test plan is already in progress"
}
Export to TestRail
Export runs or a test-plan execution using your project’s saved TestRail integration
curl -X POST "https://nunu.ai/api/v1/project/your-project-id/runs/export/testrail" \
-H "X-Api-Key: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"multiplayer_run_id":"nunu-multiplayer-run-id","custom_run_name":"CI regression"}'
{
"success": true,
"testrail_run_id": 123,
"testrail_run_name": "CI regression",
"testrail_run_url": "https://example.testrail.io/index.php?/runs/view/123",
"export_type": "single_run",
"export_trigger": "manual",
"export_strategy": "single_suite",
"runs_processed": ["nunu-multiplayer-run-id"],
"total_test_cases": 4,
"warnings": []
}
{
"error": "an export for this test plan is already in progress"
}
project:operate-runs. TestRail must be enabled and
configured for the project, with TestRail case mappings for the results you
want to export.Request body
Supply exactly one source:multiplayer_run_id, multiplayer_run_ids, or test_plan_execution_id. Unknown fields are rejected.
nunu.ai name. Must contain 1 to 250 characters after trimming whitespace.false to leave it open.false to return the existing TestRail links
instead. Run exports always create a new entry.Existing exports and retries
Every call creates a new TestRail entry by default. To avoid duplicating a test-plan export, sendforce_new_run: false: if the execution already has a saved TestRail export, the response includes already_exported: true and the existing IDs and links. No results are submitted again; runs_processed is empty and total_test_cases is 0.
Concurrent exports of the same execution return 409 while an export is in progress. An export performed before the execution finishes contains only the runs completed at that time.
force_new_run: false for test-plan executions.Response
The response is the export result directly, without adata or result wrapper. It includes success, export_type, export_trigger, export_strategy, runs_processed, and total_test_cases.
Depending on the suite configuration, the result includes testrail_run_id and testrail_run_url, or testrail_plan_id and testrail_plan_url. Names and export_duration_ms may also be present. Inspect optional skipped_cases and warnings for omitted cases or other export issues. Warning fields use snake_case, including run_id and test_version_id.
Missing sources and sources belonging to another project both return 404, including when any ID in multiplayer_run_ids is not found in the project. Invalid input returns 400; missing permissions or a disabled TestRail integration returns 403.
Using MCP
The matching MCP tool isexport_testrail_run. It accepts the same body fields and returns the same export result, with identical duplicate-export behavior. Both API and MCP exports use a manual trigger; callers cannot select the internal automatic completion trigger.
For global MCP, the run or test-plan execution IDs you supply identify the owning project, so project_id is not required even when your credentials can access several projects. You may still pass it, in which case it is checked against the project that owns the source: a value that does not match returns a project_scope_mismatch error naming both projects. Project-scoped MCP uses the project from its context. MCP accepts authorized user or API-key credentials; this HTTP endpoint accepts API keys. Both require project:operate-runs.
Example global MCP tool arguments:
{
"test_plan_execution_id": "ffb62f53-7971-488b-a788-f57f2e967f62",
"custom_run_name": "CI regression"
}
POST /api/v1/runs/export/testrail endpoint accepts project API
keys only and infers the project from the key. Organization API keys must use
/api/v1/project/{projectId}/runs/export/testrail.curl -X POST "https://nunu.ai/api/v1/project/your-project-id/runs/export/testrail" \
-H "X-Api-Key: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"multiplayer_run_id":"nunu-multiplayer-run-id","custom_run_name":"CI regression"}'
{
"success": true,
"testrail_run_id": 123,
"testrail_run_name": "CI regression",
"testrail_run_url": "https://example.testrail.io/index.php?/runs/view/123",
"export_type": "single_run",
"export_trigger": "manual",
"export_strategy": "single_suite",
"runs_processed": ["nunu-multiplayer-run-id"],
"total_test_cases": 4,
"warnings": []
}
{
"error": "an export for this test plan is already in progress"
}
Authorizations
API key for authentication
Path Parameters
The project ID. You can copy it from the project settings page or the project URL in the dashboard.
Body
- Single run
- Multiple runs
- Test plan execution
Supply exactly one source: multiplayer_run_id, multiplayer_run_ids, or test_plan_execution_id. Uses the saved project TestRail integration and a manual export trigger. Unknown fields are rejected.
nunu multiplayer run ID from List Runs. Not a job ID or a per-player run ID.
1Optional. Name for the created TestRail run or plan. Leading and trailing whitespace is trimmed. Defaults to a generated nunu.ai name.
1 - 250Optional. Close the created TestRail run or plan after results are submitted. Set false to leave it open.
Optional. Create a new TestRail entry even if a test-plan execution was already exported. Set false to return the existing links with already_exported: true instead.
Response
Export completed, or existing test-plan export returned
This endpoint accepts single_run or test_plan sources.
single_run, test_plan, multiple_runs Always manual for this endpoint.
manual, auto single_suite, multi_suite_plan nunu multiplayer run IDs processed by this export. Empty when already_exported is true.
Number of aggregated TestRail cases. Zero when returning an existing export.
True when an existing test-plan export is returned without creating a new remote entry.
TestRail case IDs skipped during export.
Show child attributes
Show child attributes