Skip to main content
Ask AI

Programmatic Access

TestRelic exposes a REST API so that tools and scripts can work with your test data the same way the web app and command-line tools do. This page is a high-level overview of how to authenticate and what you can do — it is not an exhaustive endpoint catalog.

Authentication

TestRelic uses two credential types, each scoped to a different job:

CredentialUsed forHow it is sent
tr_mcp_* — personal access token (PAT)Reading and acting on your platform data from tools and scriptsAuthorization: Bearer <token> header
tr_live_* — ingest / API keyUploading test runs from SDK reporters and testrelic uploadConfigured in the reporter / uploader

Generate and manage both credential types from the API Keys page.

Pick the right credential

Use a tr_live_* key when something is sending runs in (an SDK reporter or an upload). Use a tr_mcp_* personal access token when something is reading data out or acting on it through the REST API.

Run ingestion

SDK reporters and the testrelic upload command POST your test runs to TestRelic using a tr_live_* ingest key. This is the same path that powers the dashboards — historical imports (for example from Allure or JUnit, via the CLI) and live runs land in the same repository. See API Keys for where the key is configured.

What you can do programmatically

With a tr_mcp_* personal access token you can drive the platform's supported, user-facing capabilities:

  • Artifact sharing — create, list, update, and revoke share links for an artifact, and grant or revoke individual people's access to it.
  • Run insights — request root-cause analysis for a run to get a structured explanation of why it failed.
  • Conversation rename — rename an Ask AI conversation.

These map to the same actions you can take in the web app, so anything you automate stays consistent with what you and your team see in the UI.

Where the API is used for you

You usually do not have to call the REST API by hand — the TestRelic command-line tools and the MCP server already use it on your behalf with your personal access token:

  • The command-line interface authenticates with your PAT and works against the same API.
  • The MCP server sends your PAT as a bearer token so AI assistants can read and act on your test data.

If you are building your own automation, generate a dedicated personal access token for it from API Keys and treat it like any other secret.