CLI Scripting and API Access
The CLI gives scripts structured output for common commands. When you need cloud data that does not have a dedicated command, use the API schema to find a supported request.
Discover an API request
vizzly api schema --jsonvizzly api schema sdk.listBuilds --jsonThe operation details include the HTTP method, API version header, query parameters, request body,
and response shape. Follow those details when you call the endpoint:
Pass the version header with --header; the CLI does not add it automatically.
vizzly api /api/sdk/builds \ --header 'Vizzly-API-Version: 2026-09-12' --jsonSchema discovery does not need authentication. API requests use your Vizzly login or a project
token in VIZZLY_TOKEN, depending on the operation.
The API command accepts query parameters, headers, and a JSON body:
vizzly api /api/sdk/builds --query limit=5 \ --header 'Vizzly-API-Version: 2026-09-12' --jsonUse the request method and body shown in the schema for operations that need them. Some operations change review state or add comments, so check the method before calling one.
Build context returns comparison IDs. Use getComparisonContext for review details, then
sdk.getComparisonImage to save the current screenshot, baseline, or diff. Pass the image kind as
the last path segment. Replace cmp456 with the comparison ID from the build response:
vizzly api /api/sdk/context/comparisons/cmp456/images/diff \ --header 'Vizzly-API-Version: 2026-09-12' \ --output diff.pngTo download the full OpenAPI document:
vizzly api schema --full --output openapi.jsonParse JSON output
Successful JSON output goes to stdout; progress goes to stderr. Other command results are
under data. API calls include the endpoint and method, with the response under data.response.
Most commands accept comma-separated fields after --json:
vizzly builds --limit 1 --json id,status,branchvizzly api /api/sdk/builds \ --header 'Vizzly-API-Version: 2026-09-12' --json | jq '.data.response'Check the exit code and error detail before using a result.
Read local TDD results
Local TDD context is available without cloud authentication:
vizzly context build current --source local --jsonUse --json on other CLI commands when a script needs structured output. For example:
vizzly builds --limit 1 --json id,status,branchAbout the old compact output
The --agent options for context build and context comparison are deprecated in v0.37.x and
will be removed in v0.38.0. Use API schema discovery for cloud requests. Use vizzly context ... --json for local TDD results.