> 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/integrations/public-api.md).

# Public API

### How to create custom integrations with BugBug Public API?

BugBug Public API lets you run and manage tests from your own tools, scripts, CI/CD pipelines, and internal dashboards.

Use the Public API when you need more control than a simple webhook URL or CLI command can provide.

Keep in mind that Public API access is available on paid plans. More information about pricing can be found here: <https://bugbug.io/pricing/>

### Get your API token

1. Go to the **Integrations** page.
2. Open the **API** tab.
3. Copy the project API token.

The API token belongs to a project. Treat it as a secret.

### Authenticate API requests

Send the API token in the `Authorization` header with the `Token` prefix:

```http
Authorization: Token <api-token>
```

Example:

```bash
curl \
  -H "Authorization: Token <api-token>" \
  "https://api.bugbug.io/v2/tests/"
```

### API documentation

BugBug provides generated API documentation 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)

### What you can build with the Public API

The Public API can be used to create custom integrations for CI/CD systems, internal tools, dashboards, release workflows, and reporting automation.

Common API capabilities include:

* listing, creating, updating, and deleting tests
* listing, creating, updating, and deleting suites, including their [Before all / After all](/organizing-tests/suites.md#before-all-after-all-tests) tests
* running tests and suites in the cloud
* checking test run and suite run status
* retrieving run results
* reading and updating notes on test runs and suite runs
* stopping running tests and suites
* downloading JUnit reports
* managing test groups, steps, and reusable components in API v2
* managing [tags](/organizing-tests/tags.md) and assigning them to tests, suites, and runs
* [exporting and importing](/export-import-and-backup/import-export.md) tests or projects as YAML or ZIP files
* reading and updating project settings
* managing visual regression reference screenshots

### Public API, CLI, and webhooks

Use the **Public API** when you are building a custom integration and need programmatic control.

Use the **Command Line Interface** when you want a ready-made command for CI/CD scripts.

Use **incoming webhooks** when another tool only needs to start a test or suite with one `POST` request.

Use **outgoing webhooks** when BugBug should send run events to another system.


---

# 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/integrations/public-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.
