---
title: Create a schedule
description: "Creates a working-hours schedule owned by exactly one of member_id / service_id / resource_id (not exactly one → 422 SCHEDULE_OWNER_INVALID)."
api_method: POST
api_path: "/v1/schedules"
canonical_url: https://wiblo.app/docs/developers/api/schedules/create-schedule
last_updated: 2026-07-28T18:08:25+02:00
md_url: https://wiblo.app/docs/developers/api/schedules/create-schedule.md
---

# Create a schedule

`POST /v1/schedules`

Creates a working-hours schedule owned by exactly one of `member_id` / `service_id` / `resource_id` (not exactly one → 422 `SCHEDULE_OWNER_INVALID`). Members create their own; owner/admin create anyone's (member schedules) and all service/resource schedules. `availability` defaults to Mon-Fri 09:00-17:00 when omitted; the first schedule for a member auto-defaults. A service/resource can hold at most one schedule (409 `SCHEDULE_ALREADY_EXISTS`). Machine members can never own schedules (422 `MEMBER_MUST_BE_HUMAN`). Per-user rate-limited at 60/60s.

## Headers

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Wiblo-Workspace` | `string` | Yes | Workspace id the call is scoped to. The actor must hold an active membership in it; a foreign or unknown id collapses onto 404 WORKSPACE_NOT_FOUND. |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `member_id` | `string` | No | Workspace member who owns the schedule. Exactly one of `member_id` / `service_id` / `resource_id` must be set. |
| `service_id` | `string` | No | Service that owns the schedule (a service holds at most one). Exactly one of `member_id` / `service_id` / `resource_id` must be set. |
| `resource_id` | `string` | No | Resource that owns the schedule (a resource holds at most one). Exactly one of `member_id` / `service_id` / `resource_id` must be set. |
| `name` | `string` | Yes | Display name of the schedule (1–100 characters). |
| `timezone` | `string` | No | IANA time zone the schedule's times are interpreted in, e.g. `Europe/London`. Defaults to `UTC` when omitted. |
| `availability` | `array<AvailabilityBlock>` | No | Weekly availability blocks (must not overlap on a day). Defaults to Mon–Fri `09:00`–`17:00` when omitted. |
| `is_default` | `boolean` | No | Make this the member's default schedule (member-owned schedules only). When omitted, a member's first schedule auto-defaults. |

### The AvailabilityBlock object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `days` | `array<integer>` | Yes | Days of week the window applies to — unique integers `0`–`6`, `0` = Sunday. |
| `start_time` | `string` | Yes | Window start in 24h `HH:mm`. |
| `end_time` | `string` | Yes | Window end in 24h `HH:mm`; must be after `start_time`. |

## Request

**curl**

```bash
curl https://api.wiblo.app/v1/schedules \
  -X POST \
  -H "Authorization: Bearer $WIBLO_TOKEN" \
  -H "X-Wiblo-Workspace: $WIBLO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "member_id": "5f2d8c1b-7e4a-4b9d-a6c3-1d8e5f2a7b4c",
  "name": "Weekday hours",
  "timezone": "Europe/London"
}'
```

**TypeScript**

```ts
import { createSdk, createSchedule } from "@workspace/sdk"

const sdk = createSdk({ baseUrl: "https://api.wiblo.app" })

const { data, error } = await createSchedule({
  client: sdk,
  headers: { "X-Wiblo-Workspace": "..." },
  body: {
    "member_id": "5f2d8c1b-7e4a-4b9d-a6c3-1d8e5f2a7b4c",
    "name": "Weekday hours",
    "timezone": "Europe/London"
  },
})
```

## Example response

```json
{
  "id": "e6a91c4d-2b7f-4a3e-8d5c-1f9b3e7a5c2d",
  "workspace_id": "9c1b7e24-6a3f-4d58-b2e9-0f4a8c6d1e37",
  "member_id": "5f2d8c1b-7e4a-4b9d-a6c3-1d8e5f2a7b4c",
  "service_id": null,
  "resource_id": null,
  "name": "Weekday hours",
  "timezone": "Europe/London",
  "is_default": true,
  "availability": [
    {
      "id": "b2d74f8e-1c5a-4d9b-a3e7-6c8f2b4d9e1a",
      "workspace_id": "9c1b7e24-6a3f-4d58-b2e9-0f4a8c6d1e37",
      "schedule_id": "e6a91c4d-2b7f-4a3e-8d5c-1f9b3e7a5c2d",
      "days": [
        1,
        2,
        3,
        4,
        5
      ],
      "start_time": "09:00:00",
      "end_time": "17:00:00",
      "date": null,
      "created_at": "2026-08-03T09:15:00.000Z",
      "updated_at": "2026-08-03T09:15:00.000Z"
    }
  ],
  "created_at": "2026-08-03T09:15:00.000Z",
  "updated_at": "2026-08-03T09:15:00.000Z"
}
```

## Responses

**`201`** — Schedule created, availability rows embedded. Returns `ScheduleResponse`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique id of the schedule. |
| `workspace_id` | `string` | Yes | Workspace the schedule belongs to. |
| `member_id` | `string \| null` | Yes | Owning workspace member; `null` unless member-owned. Exactly one of the three owner ids is non-null. |
| `service_id` | `string \| null` | Yes | Owning service; `null` unless service-owned. |
| `resource_id` | `string \| null` | Yes | Owning resource; `null` unless resource-owned. |
| `name` | `string` | Yes | Display name of the schedule. |
| `timezone` | `string` | Yes | IANA time zone the schedule's times are interpreted in. |
| `is_default` | `boolean` | Yes | Whether this is the owning member's default schedule; always `false` on service/resource schedules. |
| `availability` | `array<AvailabilityRowResponse>` | Yes | All availability rows — weekly rules and date overrides. |
| `created_at` | `string` | Yes | Creation timestamp (RFC 3339). |
| `updated_at` | `string` | Yes | Last-update timestamp (RFC 3339). |

**`400`** — Body failed Zod validation (`VALIDATION_FAILED`). Returns `ApiErrorEnvelope`.

**`401`** — No valid session cookie or `wbl_*` bearer was present. Returns `ApiErrorEnvelope`.

**`403`** — A plain member targeted another member (`SELF_EDIT_ONLY`) or a service/resource schedule (`ADMIN_REQUIRED`). Returns `ApiErrorEnvelope`.

**`404`** — The workspace, member, service, or resource collapsed (`WORKSPACE_NOT_FOUND` / `MEMBER_NOT_FOUND` / `SERVICE_NOT_FOUND` / `RESOURCE_NOT_FOUND`). Returns `ApiErrorEnvelope`.

**`409`** — The service/resource already has a schedule (`SCHEDULE_ALREADY_EXISTS`). Returns `ApiErrorEnvelope`.

**`422`** — Not exactly one owner (`SCHEDULE_OWNER_INVALID`), a machine member owner (`MEMBER_MUST_BE_HUMAN`), or overlapping availability blocks (`OVERLAPPING_BLOCKS`). Returns `ApiErrorEnvelope`.

**`429`** — Rate limit exceeded. The body's `error.code` is `RATE_LIMITED` and `error.details.retry_after` is the same number of seconds as the `Retry-After` header. Returns `ApiErrorEnvelope`.

### The AvailabilityRowResponse object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique id of the availability row. |
| `workspace_id` | `string` | Yes | Workspace the row belongs to. |
| `schedule_id` | `string` | Yes | Schedule the row belongs to. |
| `days` | `array<integer>` | Yes | Days of week (`0`–`6`, `0` = Sunday) for weekly rules; `[]` on date-override rows. |
| `start_time` | `string` | Yes | Window start as `HH:mm:ss` (responses carry seconds; requests send `HH:mm`). |
| `end_time` | `string` | Yes | Window end as `HH:mm:ss`; a `00:00:00`/`00:00:00` pair is the day-off sentinel. |
| `date` | `string \| null` | Yes | Date the override row pins (`YYYY-MM-DD`); `null` on weekly rules. |
| `created_at` | `string` | Yes | Creation timestamp (RFC 3339). |
| `updated_at` | `string` | Yes | Last-update timestamp (RFC 3339). |
