Skip to main content
Use our REST API to trigger tests programmatically from any CI/CD system. After initiating a test run, poll the status endpoint to monitor completion and get results.

Authentication

All API requests require authentication using a Bearer token. Get your API key from the settings page on the Web UI.
export STABLY_API_KEY=your-api-key

Trigger Test Run

To execute a test suite, make a POST request to the run endpoint:
export TEST_SUITE_ID=your-suite-id
export STABLY_API_KEY=your-api-key

curl -X 'POST' \
"https://api.stably.ai/v1/testSuite/$TEST_SUITE_ID/run" \
-H "accept: application/json" \
-H "Authorization: Bearer $STABLY_API_KEY"

Response

The API returns a response containing the test suite run details:
{
  "projectId": "clpubgab41000ku089nuy24g",
  "testSuiteRunId": "cmgbkcce1009hmo013iiky0it",
  "testSuiteName": "Pre-release Test Suite",
  "options": {}
}

Poll Test Status

Use the test suite run ID to check the status of your test execution:
export TEST_SUITE_RUN_ID=your-test-suite-run-id

curl -X 'GET' \
"https://api.stably.ai/v1/testSuiteRun/$TEST_SUITE_RUN_ID/status" \
-H "accept: application/json" \
-H "Authorization: Bearer $STABLY_API_KEY"

Response

{
  "status": "RUNNING" | "FINISHED",
}

View Test Results

Use the test suite run ID to view the results of your test execution:
export TEST_SUITE_RUN_ID=your-test-suite-run-id

curl -X 'GET' \
"https://api.stably.ai/v1/testSuiteRun/$TEST_SUITE_RUN_ID/result" \
-H "accept: application/json" \
-H "Authorization: Bearer $STABLY_API_KEY"

Response

The result endpoint returns the results of each test ran in the test suite:
{
  "projectId": "<project-id>",
  "testSuiteRunId": "<test-suite-run-id>",
  "testSuiteName": "<test-suite-name>",
  "results": [
    {
      "testId": "<test-id>",
      "testName": "<test-name>",
      "status": "PASSED" | "FAILED" | "RUNNING" | "ERROR" | "FLAKY" | "CANCELLED" | "SKIPPED" | "QUEUED" | "RETRYING"
    },
    ...
  ]
}

API Documentation

For complete API reference, including all available endpoints, request/response schemas, and examples, visit our API Documentation.

Best Practices

  • Store credentials securely: Use your CI/CD platform’s secret management features
  • Handle timeouts: Implement appropriate timeout mechanisms
  • Error handling: Always check for errors in API responses
  • Logging: Include detailed logging for debugging
  • Retry logic: Implement retry mechanisms for transient failures
  • Parallel execution: Run multiple test suites concurrently when possible
I