---
title: "Black out a queue date range"
description: "PubNio API queues.blackouts.create: black out a queue date range. Request fields, examples in five clients, errors, and idempotency."
---

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

# Black out a queue date range

Black out a queue date range with [`POST /api/v1/queues/{queueId}/blackouts`](https://pubnio.com/api/v1/docs#tag/queues/POST/api/v1/queues/{queueId}/blackouts). Requires an API key with the `publish` scope or a signed-in workspace owner.

## Request

Use YYYY-MM-DD dates in the queue time zone with startsOn before or equal to endsOn and at most 90 days. Overlaps with other blackouts are allowed.

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `queueId`     | path  | UUID | Yes      |
| `workspaceId` | query | UUID | Yes      |

| Body field | Type   | Required |
| ---------- | ------ | -------- |
| `startsOn` | string | Yes      |
| `endsOn`   | string | Yes      |
| `reason`   | string | No       |

## Response

- HTTP 201: `QueueBlackout` with `id`, `queueId`, `startsOn`, `endsOn`, `reason`, `createdAt`.

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

```ts
const blackout = await workspace.queues.blackout(queueId, {
  startsOn: "2026-12-24",
  endsOn: "2026-12-26",
  reason: "Holiday",
});
```

### Python

```python
blackout = workspace.queues.create_blackout(
    queue_id,
    starts_on="2026-12-24",
    ends_on="2026-12-26",
    reason="Holiday",
)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/queues/$QUEUE_ID/blackouts?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"startsOn":"2026-12-24","endsOn":"2026-12-26","reason":"Holiday"}'
```

### CLI

```sh
pnio queues blackout "$QUEUE_ID" --starts-on 2026-12-24 --ends-on 2026-12-26 --reason Holiday
```

### MCP execute

```js
async () => {
  const queueId = "<queueId>";
  const response = await codemode.request({
    method: "POST",
    path: `/api/v1/queues/${queueId}/blackouts`,
    query: { workspaceId: codemode.workspaceId },
    body: {
      startsOn: "2026-12-24",
      endsOn: "2026-12-26",
      reason: "Holiday",
    },
  });
  return response.data;
};
```

## Errors

It declares no problem of its own.

It declares the problems [most operations](https://pubnio.com/docs/reference/#shared-problems) declare.

## Idempotency

No key, so a retried `POST` is not deduplicated. Read the current state before you retry.

## Limits

- Field lengths and ranges are in the [OpenAPI document](https://pubnio.com/api/v1/openapi).

## Related

- [Queues operations](https://pubnio.com/docs/reference/#queues)
- [Publishing](https://pubnio.com/docs/publishing/)

Source: https://pubnio.com/docs/reference/queues-blackouts-create/index.mdx
