Submission API reference for JUnit XML uploads
This is the terse, authoritative version. The tutorial-flavored walkthrough lives at Submission API.
Three endpoints make up the client-side surface:
POST /integrations/test_runs/uploadto send a JUnit XML file.POST /integrations/test_runs/finalizeto mark a build complete once all files are uploaded.POST /integrations/test_runs/upload_failedto report a client-side upload failure.
All three authenticate with the Project-Token header. Two internal converter callbacks (Testnod-Auth) round out the surface and are documented at the bottom for completeness.
Base URL: https://app.testnod.com
Upload endpoint
POST /integrations/test_runs/upload
Headers
| Header | Required | Notes |
|---|---|---|
Project-Token |
yes | The project's token. See Authentication. |
Content-Type |
yes | multipart/form-data (set automatically by curl -F) or application/json. |
Body parameters
Parameters are shown in form-field notation. In a JSON body, nest them instead, for example {"test_run": {"metadata": {"build_id": "1234"}}, "tags": [{"value": "smoke"}], "retry": false}.
| Parameter | Type | Required | Notes |
|---|---|---|---|
test_run[metadata][build_id] |
string | yes | CI build identifier. Groups multi-file uploads into a single run. |
test_run[metadata][branch] |
string | no | Git branch. |
test_run[metadata][commit_sha] |
string | no | Full Git SHA. |
test_run[metadata][run_url] |
string | no | URL of the CI build. |
tags[][value] |
string (repeated) | no | Tag values. Defaults to a single Default tag if omitted. |
retry |
boolean | no | true marks the file as a rerun of earlier failures in the same build, so its passing tests are recorded as passed on retry. Defaults to false. |
Uploads that share (project_id, build_id) attach to the same pending run. A partial unique index enforces one open run per build per project. If that pending run is older than your plan's history, it's marked failed and the upload starts a new run.
Responses
201 Created
{
"id": 12345,
"project_id": "b7e2c1a0-9f3d-4a8b-bc1e-2d4f6a8c0e11",
"test_run_id": 42,
"upload_id": 1,
"test_run_url": "https://app.testnod.com/projects/b7e2c1a0-9f3d-4a8b-bc1e-2d4f6a8c0e11/test_runs/42",
"presigned_url": "..."
}
project_id is a UUID string. id, test_run_id, and upload_id are integers, with test_run_id numbered within the project and upload_id within the run.
upload_id is the handle the CLI passes back if the presigned_url PUT fails. See Reporting a client-side upload failure.
404 Not Found
{ "error_message": "Project not found." }
The Project-Token header is missing, malformed, or does not match any project.
403 Forbidden
{ "error_message": "This project is paused because the Solo plan includes 1 project and another project in your organization is active. To upload test runs here, upgrade to Team or have an admin make this the active project from its page in TestNod." }
The organization has more projects than its plan includes, so only one of them accepts uploads and this one is paused, and TestNod doesn't record anything from the request. Runs that were already uploaded before the pause still finish when you call finalize. An admin can switch which project accepts uploads from the paused project's page, or upgrade to Team so every project accepts them.
{ "error_message": "Uploads are paused for your organization because it went well over the Solo plan's limit of 250 test runs this month. They resume when the count resets on December 14. To resume sooner, an admin can upgrade to Team or contact TestNod support." }
The organization went well over its monthly test run limit, so we paused its uploads after getting in touch. They resume when the count resets, or as soon as the organization changes plans, and runs that were already uploaded still finish when you call finalize.
422 Unprocessable Content
{ "error_message": "metadata.build_id is required." }
Returned when test_run[metadata][build_id] is missing or blank.
{ "error_message": "There was a problem creating this test run." }
Returned when the token is valid but the run could not be saved (most often a malformed parameter shape).
409 Conflict
{ "error_message": "Conflicting concurrent upload." }
Returned in the rare case where two concurrent uploads with the same build_id race to create the pending run. Retry once.
Sending the file
The upload call registers the upload; the JUnit file is not part of its body. PUT the file to the presigned_url from the 201 response within five minutes of receiving it.
| Field | Value |
|---|---|
| Method | PUT {presigned_url} |
Content-Type |
application/xml |
| Body | The raw JUnit XML file |
| Success | 200 OK, empty body |
A failed PUT should be reported with the upload-failed endpoint.
Finalize endpoint
POST /integrations/test_runs/finalize
The CI must call this once per build_id after the last upload, otherwise the run sits in pending indefinitely. The call is idempotent and safe to retry.
Headers
| Header | Required | Notes |
|---|---|---|
Project-Token |
yes | The project's token. |
Body parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
build_id |
string | yes | The same build_id you sent on the matching uploads. Top-level, not nested under test_run[metadata]. |
Responses
200 OK
{ "status": "processing" }
status is whatever state the run is in after the call: pending, processing, processed, or failed. If every upload had already reached a terminal state when finalize was called, the run transitions immediately; otherwise the worker transitions it when the last upload completes.
404 Not Found
{ "error_message": "Test run not found for this build_id." }
No run exists for the given (project, build_id). Confirm the upload step ran successfully and used the same build_id.
422 Unprocessable Content
{ "error_message": "build_id is required." }
{ "error_message": "No uploads received for this test run." }
The run exists but never received an upload. Finalize will not transition an empty run.
Reporting a client-side upload failure
POST /integrations/test_runs/upload_failed
The upload response returns a presigned_url that the CLI PUTs the JUnit XML to directly. If that PUT itself fails (network error, expired URL, S3 4xx/5xx), call this endpoint so the run can settle. Use this only for client-side failures. Parsing failures are reported by the converter via the internal callbacks.
Headers
| Header | Required | Notes |
|---|---|---|
Project-Token |
yes | The project's token. |
Body parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
test_run_id |
integer | yes | The test_run_id from the upload response. |
upload_id |
integer | yes | The upload_id from the upload response. |
failure_message |
string | no | Free-form description of what went wrong. Stored on the upload. |
Responses
200 OK
{ "status": "failed" }
If the upload was already terminal, the response reflects the existing status (no mutation).
404 Not Found
{ "error_message": "Upload not found." }
The (test_run_id, upload_id) pair does not belong to this project.
422 Unprocessable Content
{ "error_message": "test_run_id and upload_id are required." }
Async lifecycle
pending → processing (after /finalize and all uploads terminal) → processed or failed. The full lifecycle, including the parallel TestRunUpload state machine, is covered on the Processing states page.
Internal callbacks (not for end users)
Two endpoints exist for TestNod's converter pipeline. They are gated by the Testnod-Auth header and are not part of the client surface.
Upload processing
POST /integrations/test_runs/uploads/:upload_public_id/processing
The converter calls this once it has finished parsing the JSON output from S3. Transitions the upload from pending to uploaded. Returns 200 OK or 422 Unprocessable Content.
Upload failed
POST /integrations/test_runs/uploads/:upload_public_id/failed
The converter calls this when parsing the JSON fails. Body includes failure_message. Transitions the upload to failed, stores the message, and calls try_finalize! on the parent run.
Upload rate limits
The upload, finalize, and upload-failed endpoints share a limit of 120 requests a minute per project token, or per IP address when the request has no valid token. Going over returns 429 Too Many Requests:
{ "error_message": "Rate limit exceeded. Please retry later." }
A large matrix build that sends many files under one token can reach the limit, so space the uploads out, and wait a few seconds before retrying when you get a 429. The internal converter callbacks aren't rate limited.
Monthly test run limits
Each plan includes a monthly number of test runs, counted per organization once a run finishes processing. Going over the limit doesn't reject uploads. If an organization stays well over it, we get in touch before pausing its uploads, and a paused organization gets the 403 described under Upload. See Plans and billing for each plan's limit and what counts as a test run.
Versioning
The endpoint URLs do not include a version segment today. We will add /v1 to the paths before making any breaking changes. Until then, the three URLs above are stable.