> ## Documentation Index
> Fetch the complete documentation index at: https://cloro.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Clear queue

> Deletes every task still in the `QUEUED` state for the authenticated organization, letting you drain a pending backlog in one call instead of opening a support request. Tasks that are already `PROCESSING` are in-flight on a worker and are left untouched, as are `COMPLETED` and `FAILED` tasks. Queued tasks have not been charged, so clearing them does not affect your credit balance. The call is safe to repeat — if the queue is already empty it simply returns `cleared: 0`.

## Overview

Use this endpoint to clear your organization's pending async queue in a single
call. It deletes every task still in the `QUEUED` state, which is useful when
you've enqueued a large backlog by mistake or want to reset the queue instead of
waiting for it to drain (or opening a support request).

Only queued tasks are affected:

* `QUEUED` tasks are **removed**.
* `PROCESSING` tasks are already in-flight on a worker and are **left running** —
  they cannot be recalled from here.
* `COMPLETED` and `FAILED` tasks are historical and are **left in place**; you can
  still retrieve them via [`GET /v1/async/task/{taskId}`](/api-reference/endpoint/get-task-status)
  until they age out of the [retention window](/api-reference/endpoint/get-task-status#task-retention-policy).

## Billing

Queued tasks have not been charged yet — credits are only deducted once a task is
processed. Clearing the queue therefore has **no effect on your credit balance**,
and no refund is issued.

## Idempotency

The call is safe to repeat. If the queue is already empty, it returns
`cleared: 0` rather than an error.

## Checking the queue first

To see how many tasks are currently queued before clearing, use the
[async status endpoint](/api-reference/endpoint/get-async-status).

## Example usage

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.cloro.dev/v1/async/queue" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```json Response theme={null}
  {
    "success": true,
    "cleared": 42
  }
  ```
</CodeGroup>


## OpenAPI

````yaml api-reference/openapi.json DELETE /v1/async/queue
openapi: 3.1.0
info:
  title: cloro
  description: API for monitoring AI responses across different providers and regions
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.cloro.dev
    description: Production server
security:
  - bearerAuth: []
paths:
  /v1/async/queue:
    delete:
      summary: Clear queued async tasks
      description: >-
        Deletes every task still in the `QUEUED` state for the authenticated
        organization, letting you drain a pending backlog in one call instead of
        opening a support request. Tasks that are already `PROCESSING` are
        in-flight on a worker and are left untouched, as are `COMPLETED` and
        `FAILED` tasks. Queued tasks have not been charged, so clearing them
        does not affect your credit balance. The call is safe to repeat — if the
        queue is already empty it simply returns `cleared: 0`.
      operationId: clearAsyncQueue
      responses:
        '200':
          description: Queue cleared. Returns the number of queued tasks that were removed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClearQueueResponse'
        '401':
          description: Unauthorized - Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalError'
      security:
        - bearerAuth: []
components:
  schemas:
    ClearQueueResponse:
      type: object
      required:
        - success
        - cleared
      properties:
        success:
          type: boolean
          description: Indicates the queue was cleared successfully.
          example: true
        cleared:
          type: integer
          description: Number of queued tasks that were removed.
          example: 42
    AuthenticationError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - MISSING_API_KEY
                - INVALID_API_KEY_FORMAT
                - INVALID_OR_EXPIRED_API_KEY
              example: MISSING_API_KEY
            message:
              type: string
              example: Missing or invalid API key
            timestamp:
              type: string
              format: date-time
              example: '2025-01-15T12:00:00.000Z'
    InternalError:
      type: object
      oneOf:
        - properties:
            success:
              type: boolean
              example: false
            error:
              type: string
              example: Maximum retries exceeded
        - properties:
            error:
              type: object
              properties:
                code:
                  type: string
                  example: INTERNAL_SERVER_ERROR
                message:
                  type: string
                  example: Internal server error
                timestamp:
                  type: string
                  format: date-time
                  example: '2025-01-15T12:00:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````