---
title: "Create an account schedule queue"
description: "PubNio API queues.create: create an account schedule queue. 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.

# Create an account schedule queue

Create an account schedule queue with [`POST /api/v1/queues`](https://pubnio.com/api/v1/docs#tag/queues/POST/api/v1/queues). Requires an API key with the `publish` scope or a signed-in workspace owner.

## Request

Creates the only active queue for the account. Repeating an identical request returns that queue.

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

| Body field      | Type                    | Required |
| --------------- | ----------------------- | -------- |
| `accountId`     | UUID                    | Yes      |
| `name`          | string                  | Yes      |
| `timezone`      | string                  | No       |
| `slots`         | array of QueueSlotInput | Yes      |
| `isDefault`     | boolean                 | No       |
| `maxPerDay`     | integer                 | No       |
| `maxPending`    | integer                 | No       |
| `minGapSeconds` | integer                 | No       |
| `horizonDays`   | integer                 | No       |

## Response

- HTTP 201: `Queue` with `id`, `workspaceId`, `accountId`, `name`, `timezone`, `status`, `isDefault`, `limits`, `slots`, `version`, `pausedAt`, `archivedAt`, `createdAt`, `updatedAt`.
  - `status`: `active`, `paused`, `archived`

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

## Examples

### TypeScript

```ts
const queue = await workspace.queues.create({
  accountId,
  name: "Weekday mornings",
  timezone: "America/New_York",
  slots: [
    { dayOfWeek: 1, time: "09:00" },
    { dayOfWeek: 3, time: "09:00" },
    { dayOfWeek: 5, time: "09:00" },
  ],
});
```

### Python

```python
queue = workspace.queues.create(
    account_id=account_id,
    name="Weekday mornings",
    timezone="America/New_York",
    slots=[
        {"dayOfWeek": 1, "time": "09:00"},
        {"dayOfWeek": 3, "time": "09:00"},
        {"dayOfWeek": 5, "time": "09:00"},
    ],
)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/queues?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"accountId":"'"$ACCOUNT_ID"'","name":"Weekday mornings","timezone":"America/New_York","slots":[{"dayOfWeek":1,"time":"09:00"},{"dayOfWeek":3,"time":"09:00"},{"dayOfWeek":5,"time":"09:00"}]}'
```

### CLI

```sh
pnio queues create --account "$ACCOUNT_ID" --name "Weekday mornings" --timezone America/New_York --slot mon@09:00 --slot wed@09:00 --slot fri@09:00
```

### MCP execute

```js
async () => {
  const accountId = "<accountId>";
  const response = await codemode.request({
    method: "POST",
    path: "/api/v1/queues",
    query: { workspaceId: codemode.workspaceId },
    body: {
      accountId: accountId,
      name: "Weekday mornings",
      timezone: "America/New_York",
      slots: [
        { dayOfWeek: 1, time: "09:00" },
        { dayOfWeek: 3, time: "09:00" },
        { dayOfWeek: 5, time: "09:00" },
      ],
    },
  });
  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-create/index.mdx
