Skip to content

Previews API

The change running at its own URL, until its TTL, the next push or the merge.

Each tool below is an MCP tool on https://api.bareci.com/mcp and, unless it is marked local, a route of the https://api.bareci.com/v1 JSON API. The bareci CLI calls the same routes.

Tool What it does
previews_list A repository’s live previews: URL, branch, PR, state, expiry and the access token the URL needs.
preview_get One preview by id: its URL, state, expiry and the access token the URL needs.
preview_stop End a preview: its machine is released first, so billing stops, then its tunnel and DNS record go.
previews_close End every preview of a branch or pull request.

previews_list

Previews. A repository’s live previews: URL, branch, PR, state, expiry and the access token the URL needs.

  • HTTP: GET /v1/previews
  • Scope: read
  • Reads only

Arguments

Argument Type Required Description
repo string yes Repository as owner/name, e.g. acme/web
all boolean no Include ended previews

Answer

Field Type Required Description
previews any[] no [{id, url, branch, pr, state, expiresAt, accessToken, …}]

Every answer also carries next: the next action, usually a tool and its arguments.

Example

{
"method": "tools/call",
"params": {
"name": "previews_list",
"arguments": {
"repo": "acme/web"
}
}
}

Next: open the URL with ?bareci_token=, or flows_run against it.

preview_get

Preview. One preview by id: its URL, state, expiry and the access token the URL needs.

  • HTTP: GET /v1/previews/{preview}
  • Scope: read
  • Reads only

Arguments

Argument Type Required Description
preview string yes Preview id, pv__

Answer

Field Type Required Description
preview object no The preview

Every answer also carries next: the next action, usually a tool and its arguments.

Example

{
"method": "tools/call",
"params": {
"name": "preview_get",
"arguments": {
"preview": "<preview>"
}
}
}

Next: preview_stop when done.

preview_stop

Stop a preview. End a preview: its machine is released first, so billing stops, then its tunnel and DNS record go.

  • HTTP: DELETE /v1/previews/{preview}
  • Scope: run
  • Ends or removes something

Arguments

Argument Type Required Description
preview string yes Preview id, pv__

Answer

Field Type Required Description
preview object no The preview, state ended or ending

Every answer also carries next: the next action, usually a tool and its arguments.

Example

{
"method": "tools/call",
"params": {
"name": "preview_stop",
"arguments": {
"preview": "<preview>"
}
}
}

Next: nothing; state is ended (or ending while cleanup retries).

previews_close

Close previews. End every preview of a branch or pull request.

  • HTTP: POST /v1/previews/close
  • Scope: run
  • Ends or removes something

Arguments

Argument Type Required Description
repo string yes Repository as owner/name, e.g. acme/web
branch string no Branch
pr integer no Pull request number (min 1)

Answer

Field Type Required Description
ended any[] no Previews ended

Every answer also carries next: the next action, usually a tool and its arguments.

Example

{
"method": "tools/call",
"params": {
"name": "previews_close",
"arguments": {
"repo": "acme/web"
}
}
}

Next: nothing.