# Update schedule

Updates a schedule.

```http
PUT https://api.pozy.ai/v1/queue/slots
```

- Area: Publishing / Queue
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `profileId`, string, required
- `queueId`, string
- `name`, string
- `timezone`, string, required
- `slots`, array of object, required
  - `dayOfWeek`, integer: 0 to 6
  - `time`, string: Matches `^([0-1][0-9]|2[0-3]):[0-5][0-9]$`
- `active`, boolean: Default `true`
- `setAsDefault`, boolean
- `reshuffleExisting`, boolean: Default `false`

## Example request

```bash
curl -X PUT "https://api.pozy.ai/v1/queue/slots" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "profileId": "6a0b6573846efc28aaa9a3ff",
  "timezone": "America/New_York",
  "slots": [
    {
      "dayOfWeek": 1,
      "time": "2026-10-02T09:00:00.000Z"
    }
  ]
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/queue/slots", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    profileId: "6a0b6573846efc28aaa9a3ff",
    timezone: "America/New_York",
    slots: [
      {
        dayOfWeek: 1,
        time: "2026-10-02T09:00:00.000Z"
      }
    ]
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.put(
    "https://api.pozy.ai/v1/queue/slots",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "profileId": "6a0b6573846efc28aaa9a3ff",
        "timezone": "America/New_York",
        "slots": [
            {
                "dayOfWeek": 1,
                "time": "2026-10-02T09:00:00.000Z",
            },
        ],
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `success`, boolean
- `schedule`, object
  - `_id`, string
  - `profileId`, string
  - `name`, string
  - `timezone`, string
  - `slots`, array of object
    - `dayOfWeek`, integer: 0 to 6
    - `time`, string: Matches `^([0-1][0-9]|2[0-3]):[0-5][0-9]$`
  - `active`, boolean
  - `isDefault`, boolean
  - `createdAt`, string (date-time)
  - `updatedAt`, string (date-time)
- `nextSlots`, array of string (date-time)
- `reshuffledCount`, integer
- `skippedDailyLimit`, integer
- `isNewQueue`, boolean

```json
{
  "success": true,
  "schedule": {
    "_id": "635d87e261ae344ef27fd1df",
    "profileId": "6a0b6573846efc28aaa9a3ff",
    "name": "Acme",
    "timezone": "America/New_York",
    "slots": [
      {
        "dayOfWeek": 1,
        "time": "2026-10-02T09:00:00.000Z"
      }
    ],
    "active": true,
    "isDefault": true,
    "createdAt": "2026-10-02T09:00:00.000Z",
    "updatedAt": "2026-10-02T09:00:00.000Z"
  },
  "nextSlots": [
    "2026-10-02T09:00:00.000Z"
  ],
  "reshuffledCount": 42,
  "skippedDailyLimit": 1,
  "isNewQueue": true
}
```
