---
title: "Create a queue"
method: POST
path: "/v1/workspaces/{workspace_id}/queues"
tags: ["Queues"]
---

# Create a queue

`POST /v1/workspaces/{workspace_id}/queues`

## Request

- Base URL: `https://api.stacksync.com`
- URL: `https://api.stacksync.com/v1/workspaces/{workspace_id}/queues`
- Auth: HTTP bearer

A queue, running unless sent paused: records added by workflows (and syncs) wait in it until its flush rules send them to its consumer workflow. Send the status, rate limit and strategy of a queue read with GET to copy it. Send an Idempotency-Key to retry safely.

## Path parameters

- `workspace_id` integer, required

## Query parameters

- `region` 'besg' | 'usnv', required

## Headers

- `Idempotency-Key` string, nullable: Makes the create retry-safe for 24 hours: a retry with the same key answers the resource the first call created, with the Idempotent-Replayed: true header, and creates nothing. 1 to 255 visible ASCII characters. The same key with a different request answers 422; while the first call still runs, 409.

## Request body

- CreateQueueBody
  - `queue_name` string, required
  - `queue_resource_id` string, nullable: The id workflow steps name the queue by; generated from the name when absent
  - `flush_batch_size` integer, required
  - `flush_record_max_age` integer, required
  - `parent_folder_id` string, nullable: The folder to create the queue in, the root when absent
  - `status` 'running' | 'paused'
  - `flush_rate_limit_max_flush_count` integer, nullable: 10 when absent
  - `flush_rate_limit_time_window` integer, nullable: 1 second when absent
  - `flush_strategy` 'fifo' | 'lifo'
  - `validate_only` boolean: Run every check of the write and answer 204 without writing: a refused write answers the error the write would

## Response `201`

Created

- CreatedQueue
  - `queue_id` string, required
  - `queue_name` string, required
  - `queue_resource_id` string, required
  - `status` 'running' | 'paused', required
  - `consumer_workflow_id` string, nullable, required: The workflow that receives the flushed records, if any
  - `flush_batch_size` integer, required: Records sent to the consumer workflow per flush
  - `flush_record_max_age` integer, nullable, required: Seconds a record may wait before the queue flushes
  - `flush_rate_limit_max_flush_count` integer, nullable, required: Maximum flushes per rate limit window
  - `flush_rate_limit_time_window` integer, nullable, required: The rate limit window, in seconds
  - `flush_strategy` 'fifo' | 'lifo', required
  - `parent_folder_id` string, nullable, required
  - `created_time` string, date-time, required
  - `last_modified_time` string, date-time, required
  - `region` 'besg' | 'usnv', required

## Other responses

- `204`: No Content
- `400`: Bad Request
- `403`: Forbidden
- `409`: Conflict
- `422`: Unprocessable Content

---

[API](https://skmtc.dev/stacksync/apis/stacksync-api.md) - [All operations](https://skmtc.dev/stacksync/apis/stacksync-api/llms.txt) - [OpenAPI document](https://skmtc.dev/stacksync/apis/stacksync-api/revisions/21f4ba4b214e?raw)
