VisualQ
CI/CD

REST API

Trigger test runs and check status programmatically.

The VisualQ REST API lets you trigger test runs and check their status from any CI system.

Base URL

https://visualq.ai/api

Authentication

All CI endpoints require an API key in the X-API-Key header.

X-API-Key: your-api-key-here

Trigger a test run

POST /api/ci/run

Starts a new visual regression test or baseline capture.

Request body:

FieldTypeRequiredDescription
projectstringYesProject slug
typestringNotest (default), baseline, perf, seo, or tracking
environmentstringNoEnvironment name or slug (e.g., staging)
scenariosstring[]NoFilter to specific scenario labels
browsersstring[]Nochromium, firefox, webkit
commitShastringNoGit commit SHA
branchstringNoGit branch name
prNumbernumberNoPull request number
prUrlstringNoPull request URL
ciProviderstringNoCI system name
jiraKeystringNoJira issue key (e.g., PROJ-123)
perfBudgetsobjectNoPerformance budget thresholds (when type: "perf"). Keys: lcp, fcp, cls, tbt, ttfb, score

When environment is provided, scenarios are tested against that environment's base URL instead of the default. The value can be either the environment name (e.g., "Staging") or its slug (e.g., "staging").

Example request:

curl -X POST https://visualq.ai/api/ci/run \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $VISUALQ_API_KEY" \
  -d '{
    "project": "my-website",
    "type": "test",
    "environment": "staging",
    "commitSha": "abc123",
    "branch": "feature/redesign",
    "prNumber": 42,
    "ciProvider": "github-actions"
  }'

Response (202 Accepted):

{
  "success": true,
  "runId": "run_abc123",
  "projectId": "proj_xyz",
  "type": "test",
  "environmentId": "env_abc",
  "environmentName": "Staging",
  "statusUrl": "/api/ci/status/run_abc123",
  "message": "VRT test started"
}

Check run status

GET /api/ci/status/[runId]

Returns the current status of a test run.

Response:

{
  "runId": "run_abc123",
  "projectId": "proj_xyz",
  "status": "completed",
  "type": "vrt-test",
  "duration": 12345,
  "summary": {
    "total": 5,
    "passed": 4,
    "failed": 1
  },
  "error": null
}

For performance runs (type: "perf"), the response also includes:

{
  "perfScore": 85,
  "perfAvgLcp": 1200,
  "perfBudgetResult": "pass"
}

For SEO runs (type: "seo"), the response also includes:

{
  "seoScore": 92,
  "seoPassed": 18,
  "seoFailed": 2,
  "seoWarnings": 3,
  "seoLighthouseScore": 88
}

Status values:

StatusDescription
runningTest is in progress
completedFinished successfully
failedAn error occurred

Type values in response:

TypeDescription
vrt-testVisual regression test
baselineBaseline capture
perf-testPerformance test
seo-testSEO audit
tracking-testTracking audit

List projects

GET /api/ci/projects

Returns a list of projects accessible with the current API key.

Response:

{
  "projects": [
    {
      "id": "proj_xyz",
      "name": "My Website",
      "slug": "my-website",
      "baseUrl": "https://example.com",
      "scenarioCount": 12
    }
  ],
  "count": 1
}

When using a project-scoped API key, the response contains only the single associated project.

Polling pattern

To wait for a run to complete, poll the status endpoint:

RUN_ID=$(curl -s -X POST https://visualq.ai/api/ci/run \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $VISUALQ_API_KEY" \
  -d '{"project": "my-website"}' | jq -r '.runId')

while true; do
  STATUS=$(curl -s "https://visualq.ai/api/ci/status/$RUN_ID" \
    -H "X-API-Key: $VISUALQ_API_KEY" | jq -r '.status')
  
  if [ "$STATUS" != "running" ]; then
    echo "Run finished with status: $STATUS"
    break
  fi
  
  sleep 5
done

On this page