---
title: "Purge queued runs"
method: POST
path: "/v1/projects/{project_id}/environments/{environment_id}/purge-queue"
tags: ["runs"]
---

# Purge queued runs

`POST /v1/projects/{project_id}/environments/{environment_id}/purge-queue`

## Request

- Base URL: `https://api.connic.co`
- URL: `https://api.connic.co/v1/projects/{project_id}/environments/{environment_id}/purge-queue`
- Auth: HTTP bearer

Cancels every run in the environment that is in `queued` status, or only those of `agent_name`.

Purged runs get the error `Purged from queue by user`. Scheduled and running runs are not affected.

Required permission: `runs.queue.manage`.

## Path parameters

- `project_id` string, uuid, required
- `environment_id` string, uuid, required

## Request body

- PurgeQueueRequest: Which queued runs to cancel.
  - `agent_name` string, nullable: Only cancel queued runs of this agent; omit to cancel every queued run in the environment.

## Response `200`

Successful Response

- PublicPurgeQueueResponse
  - `ok` boolean, required: Whether the operation succeeded.
  - `purged_count` integer, required: Number of queued runs that were cancelled.

## Other responses

- `401`: Missing or invalid API key.
- `403`: The API key lacks the required permission or access to the environment.
- `404`: The resource does not exist in this project.
- `422`: Validation Error
- `429`: Rate limit exceeded.

---

[API](https://skmtc.dev/connic/apis/connic-api.md) · [All operations](https://skmtc.dev/connic/apis/connic-api/llms.txt) · [OpenAPI document](https://skmtc.dev/connic/apis/connic-api/revisions/482932da5fbe?raw)
