# Update a queue

> Rename a queue, pause or resume it, or change its flush rules. Only the fields sent change.

Source: https://docs.stacksync.com/api-reference/queues/update_queue

`PATCH https://api.stacksync.com/v1/workspaces/{workspace_id}/queues/{workflows_app_queue_id}`

- Operation: `update_queue`
- Resource: Queues
- Access: writes data

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.
- `Content-Type: application/json` on every request with a body.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace. List the ones your key can reach with GET /v1/workspaces. |
| `workflows_app_queue_id` | string (uuid) | Yes | The queue. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `region` | string (besg \| usnv) | Yes | Region of the resource: besg (Europe) or usnv (United States), as GET /v1/regions lists them |

## Request body

`application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `queue_name` | string \| null, 1 to 255 characters | No |  |
| `status` | string (running \| paused) \| null | No |  |
| `flush_batch_size` | integer \| null, 1 to 10000 | No |  |
| `flush_record_max_age` | integer \| null, 1 to 86400 | No |  |
| `flush_rate_limit_max_flush_count` | integer \| null, 1 to 2147483647 | No |  |
| `flush_rate_limit_time_window` | integer \| null, 1 to 2147483647 | No |  |
| `flush_strategy` | string (fifo \| lifo) \| null | No |  |
| `validate_only` | boolean, default false | No | Run every check of the write and answer 204 without writing: a refused write answers the error the write would |

## Returns

### 200 OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `queue_id` | string | Yes |  |
| `queue_name` | string | Yes |  |
| `queue_resource_id` | string | Yes |  |
| `status` | string (running \| paused) | Yes |  |
| `consumer_workflow_id` | string \| null | Yes | The workflow that receives the flushed records, if any |
| `flush_batch_size` | integer | Yes | Records sent to the consumer workflow per flush |
| `flush_record_max_age` | integer \| null | Yes | Seconds a record may wait before the queue flushes |
| `flush_rate_limit_max_flush_count` | integer \| null | Yes | Maximum flushes per rate limit window |
| `flush_rate_limit_time_window` | integer \| null | Yes | The rate limit window, in seconds |
| `flush_strategy` | string (fifo \| lifo) | Yes | fifo sends the oldest records first, lifo the newest |
| `parent_folder_id` | string \| null | Yes |  |
| `created_time` | string (date-time) | Yes |  |
| `last_modified_time` | string (date-time) | Yes |  |
| `region` | string (besg \| usnv) | Yes |  |

### 204 No Content

No body.

## Example request

```bash
curl -X PATCH "https://api.stacksync.com/v1/workspaces/{workspace_id}/queues/{workflows_app_queue_id}?region=besg" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "queue_name": "<queue_name>"
}'
```

## Example response (200)

```json
{
  "queue_id": "<queue_id>",
  "queue_name": "<queue_name>",
  "queue_resource_id": "<queue_resource_id>",
  "status": "running",
  "consumer_workflow_id": "<consumer_workflow_id>",
  "flush_batch_size": 0,
  "flush_record_max_age": 0,
  "flush_rate_limit_max_flush_count": 0,
  "flush_rate_limit_time_window": 0,
  "flush_strategy": "fifo",
  "parent_folder_id": "<parent_folder_id>",
  "created_time": "2027-01-15T09:00:00Z",
  "last_modified_time": "2027-01-15T09:00:00Z",
  "region": "besg"
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | Bad Request | `{ "error": string, "msg": string, "field": string \| null }` |
| 403 | Forbidden | `{ "error": string, "msg": string, "field": string \| null }` |
| 404 | Not Found | `{ "error": string, "msg": string, "field": string \| null }` |
| 409 | Conflict | `{ "error": string, "msg": string, "field": string \| null }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json
- [List queues](https://docs.stacksync.com/api-reference/queues/list_queues)
- [List a queue's waiting records](https://docs.stacksync.com/api-reference/queues/list_queue_records)
- [Get a queue](https://docs.stacksync.com/api-reference/queues/get_queue)
- [Create a queue](https://docs.stacksync.com/api-reference/queues/create_queue)
- [Delete a queue](https://docs.stacksync.com/api-reference/queues/delete_queue)
- [Flush a queue](https://docs.stacksync.com/api-reference/queues/flush_queue)
- [Clear a queue's waiting records](https://docs.stacksync.com/api-reference/queues/clear_queue_records)