> For the complete documentation index, see [llms.txt](https://docs.aviator.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aviator.co/mergequeue/how-to-guides/queue-dequeue-via-api.md).

# How to Queue / Dequeue via API

You can use a set of Aviator APIs and webhooks to build custom workflows. Get instructions on how to queue / dequeue via API in our manual guide.

Aviator provides a set of [<mark style="color:blue;">APIs</mark>](https://docs.aviator.co/reference/api-documentation) and [<mark style="color:blue;">webhooks</mark>](https://docs.aviator.co/reference/webhooks) that you can leverage to build custom workflows. In addition, you can use the [<mark style="color:blue;">Pilot automated workflows</mark>](https://docs.aviator.co/reference/pilot-automated-actions) to define your custom logic.

For instance, you can use an API to queue or dequeue a PR. You can use this to automatically trigger a queue event on an external event happening.

```bash
curl -X POST \
    -H "Authorization: Bearer <aviator_token>" \
    -H "Content-Type: application/json" \
    -d '{"action": "queue",
         "pull_request": {
            "number": 1234,
            "repository": {"name": "repo_name", "org": "org_name"},
            "head_commit_sha":" "69f4404fda48aa2932abfbcb6956a9ccd473b17d",
           "merge_commit_message": {
                "title": "This is where title goes",
                "body": "This is where body goes"
            }
          }
       }’ \
https://api.aviator.co/api/v1/pull_request/
```

Likewise, you can dequeue a PR by using `"action": "dequeue"` in the same API request. Dequeuing also clears any pending ready / skip-line / skip-validation options previously set on the PR, so re-queuing starts from a clean state.


---

# 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.aviator.co/mergequeue/how-to-guides/queue-dequeue-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.
