---
title: "Replace a host's restriction windows for a service"
description: Atomically replaces the restriction set.
api_method: PUT
api_path: "/v1/services/{serviceId}/hosts/{memberId}/restrictions"
canonical_url: https://wiblo.app/docs/developers/api/schedules/replace-host-restrictions
last_updated: 2026-07-28T18:08:25+02:00
md_url: https://wiblo.app/docs/developers/api/schedules/replace-host-restrictions.md
---

# Replace a host's restriction windows for a service

`PUT /v1/services/{serviceId}/hosts/{memberId}/restrictions`

Atomically replaces the restriction set. Windows NARROW the host's schedule — each must fit entirely inside one baseline block of the host's default schedule (422 `RESTRICTION_OUTSIDE_BASELINE`, split-shift gaps included) and must not overlap each other (422 `OVERLAPPING_BLOCKS`). An empty set clears all restrictions. Owner/admin only. Per-user rate-limited at 60/60s.

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `serviceId` | `string` | Yes |  |
| `memberId` | `string` | Yes |  |

## 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 |
| --- | --- | --- | --- |
| `restrictions` | `array<AvailabilityBlock>` | Yes | The full new restriction set for this service + host. Windows must fit inside the host's baseline schedule and must not overlap; `[]` removes every restriction. |

### 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/services/3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c/hosts/8b3e6d2a-4c7f-4e1b-9d5a-2f6c8e3b7a1d/restrictions \
  -X PUT \
  -H "Authorization: Bearer $WIBLO_TOKEN" \
  -H "X-Wiblo-Workspace: $WIBLO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "restrictions": [
    {
      "days": [
        1,
        2,
        3
      ],
      "start_time": "10:00",
      "end_time": "13:00"
    },
    {
      "days": [
        4,
        5
      ],
      "start_time": "14:00",
      "end_time": "18:00"
    }
  ]
}'
```

**TypeScript**

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

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

const { data, error } = await replaceHostRestrictions({
  client: sdk,
  path: { serviceId: "3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c", memberId: "8b3e6d2a-4c7f-4e1b-9d5a-2f6c8e3b7a1d" },
  headers: { "X-Wiblo-Workspace": "..." },
  body: {
    "restrictions": [
      {
        "days": [
          1,
          2,
          3
        ],
        "start_time": "10:00",
        "end_time": "13:00"
      },
      {
        "days": [
          4,
          5
        ],
        "start_time": "14:00",
        "end_time": "18:00"
      }
    ]
  },
})
```

## Example response

```json
{
  "restrictions": [
    {
      "id": "e2a94c6d-8b3f-4d5a-a1c7-3f8e5b2d9c4a",
      "workspace_id": "9c1b7e24-6a3f-4d58-b2e9-0f4a8c6d1e37",
      "service_id": "3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c",
      "member_id": "8b3e6d2a-4c7f-4e1b-9d5a-2f6c8e3b7a1d",
      "days": [
        1,
        2,
        3
      ],
      "start_time": "10:00:00",
      "end_time": "13:00:00",
      "created_at": "2026-08-20T11:20:00.000Z",
      "updated_at": "2026-08-20T11:20:00.000Z"
    },
    {
      "id": "f7b25e8c-3d6a-4a9e-8b4f-6c1d9e3a7b5f",
      "workspace_id": "9c1b7e24-6a3f-4d58-b2e9-0f4a8c6d1e37",
      "service_id": "3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c",
      "member_id": "8b3e6d2a-4c7f-4e1b-9d5a-2f6c8e3b7a1d",
      "days": [
        4,
        5
      ],
      "start_time": "14:00:00",
      "end_time": "18:00:00",
      "created_at": "2026-08-20T11:20:00.000Z",
      "updated_at": "2026-08-20T11:20:00.000Z"
    }
  ]
}
```

## Responses

**`200`** — The new restriction set. Returns `HostRestrictionListResponse`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `restrictions` | `array<HostRestrictionResponse>` | Yes | The restriction windows narrowing this host's schedule for this service; `[]` when unrestricted. |

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

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

**`403`** — The actor is a plain member; owner or admin is required (`ADMIN_REQUIRED`). Returns `ApiErrorEnvelope`.

**`404`** — The service collapsed (`SERVICE_NOT_FOUND`) or the member is not an assigned host (`HOST_NOT_FOUND`). Returns `ApiErrorEnvelope`.

**`422`** — A window falls outside the host's baseline (`RESTRICTION_OUTSIDE_BASELINE`) or windows overlap (`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 HostRestrictionResponse object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique id of the restriction row. |
| `workspace_id` | `string` | Yes | Workspace the row belongs to. |
| `service_id` | `string` | Yes | Service the restriction applies to. |
| `member_id` | `string` | Yes | Host (workspace member) whose availability the window narrows. |
| `days` | `array<integer>` | Yes | Days of week (`0`–`6`, `0` = Sunday) the window applies to. |
| `start_time` | `string` | Yes | Window start as `HH:mm:ss` (requests send `HH:mm`). |
| `end_time` | `string` | Yes | Window end as `HH:mm:ss`. |
| `created_at` | `string` | Yes | Creation timestamp (RFC 3339). |
| `updated_at` | `string` | Yes | Last-update timestamp (RFC 3339). |
