> For the complete documentation index, see [llms.txt](https://docs.bugbug.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bugbug.io/running-tests/running-via-api.md).

# Running via API

Discover how to run tests via API with BugBug's comprehensive documentation. Connect BugBug to your CI/CD pipeline. Streamline your automation testing process.

You can start BugBug tests and suites from CI/CD pipelines, deployment tools and your own systems. There are four ways to do it. Choose the one that fits how much control you need.

| Option                                            | Use it when                                                                                                                             | Plan           |
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| [CLI](/integrations/cli.md)                       | You want a ready-made command in a CI/CD script that runs a test or suite, waits for the result and fails the build when the run fails. | Pro or higher  |
| [Incoming webhooks](/integrations/webhooks.md)    | Another tool only needs to start a test or suite with one `POST` request.                                                               | Core or higher |
| [Public API](/integrations/public-api.md)         | You're building a custom integration and need full programmatic control.                                                                | Business       |
| [TypeScript SDK](/integrations/typescript-sdk.md) | You're building the integration in Node.js or TypeScript and prefer a typed client to raw HTTP calls.                                   | Business       |

All of them run tests in the BugBug cloud.

## CLI

The CLI is the quickest way to add BugBug to a pipeline. `bugbug tests run <test-id>` and `bugbug suites run <suite-id>` wait for the result and exit with `0` only when the run passed. It can also save a JUnit report for your CI.

See [CLI](/integrations/cli.md).

## Incoming webhooks

Each test and suite has a webhook URL. Send a `POST` request to it to start the run. No authentication header is needed, because the token is part of the URL. The webhook doesn't wait for the result.

See [Webhooks](/integrations/webhooks.md).

## Public API

The Public API can list and manage tests and suites, start runs, check their status, read the results, stop runs, download reports, export and import data, update settings, and manage visual regression reference screenshots.

See [Public API](/integrations/public-api.md) for authentication, a typical CI flow and limits. The endpoint reference is available in three formats:

* [GitBook](broken://pages/a6db6c569698f717f625a369380fe1e5e750b1bf)
* [Swagger](https://app.bugbug.io/docs/swagger/?version=v2)
* [Redoc](https://app.bugbug.io/docs/redoc/?version=v2)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bugbug.io/running-tests/running-via-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
