Create an account schedule queue with 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:
Queuewithid,workspaceId,accountId,name,timezone,status,isDefault,limits,slots,version,pausedAt,archivedAt,createdAt,updatedAt.status:active,paused,archived
The OpenAPI document has each field’s type.
Examples
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" },
],
});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 -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"}]}'pnio queues create --account "$ACCOUNT_ID" --name "Weekday mornings" --timezone America/New_York --slot mon@09:00 --slot wed@09:00 --slot fri@09:00async () => {
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 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.