---
title: Update a resource requirement
description: "Patches quantity or retargets the requirement (set one of category/resource_id, null the other in the same call)."
api_method: PATCH
api_path: "/v1/services/{serviceId}/resource-requirements/{requirementId}"
canonical_url: https://wiblo.app/docs/developers/api/resources/update-service-resource-requirement
last_updated: 2026-07-28T18:08:25+02:00
md_url: https://wiblo.app/docs/developers/api/resources/update-service-resource-requirement.md
---

# Update a resource requirement

`PATCH /v1/services/{serviceId}/resource-requirements/{requirementId}`

Patches quantity or retargets the requirement (set one of `category`/`resource_id`, null the other in the same call). A merged result violating the XOR is 422 `REQUIREMENT_TARGET_INVALID`; a merged result putting quantity above 1 on a specific resource is 422 `REQUIREMENT_QUANTITY_INVALID`. Owner/admin only. Per-user rate-limited at 60/60s.

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `serviceId` | `string` | Yes |  |
| `requirementId` | `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 |
| --- | --- | --- | --- |
| `category` | `string \| null` | No | Resource category to draw from; to retarget, set one of `category`/`resource_id` and `null` the other in the same call. |
| `resource_id` | `string \| null` | No | A specific resource the service needs; to retarget, set one of `category`/`resource_id` and `null` the other in the same call. |
| `quantity` | `integer` | No | How many distinct free resources the category's pool must supply per booking; must be `1` for a specific-resource requirement. |

## Request

**curl**

```bash
curl https://api.wiblo.app/v1/services/3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c/resource-requirements/f1d7a3c9-5e8b-4a1f-9c6d-2b8e4f7a1c3d \
  -X PATCH \
  -H "Authorization: Bearer $WIBLO_TOKEN" \
  -H "X-Wiblo-Workspace: $WIBLO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "resource_id": "e2f8b4d6-9c1a-4e7b-8f3d-6a2c9e5b1f7d",
  "category": null
}'
```

**TypeScript**

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

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

const { data, error } = await updateServiceResourceRequirement({
  client: sdk,
  path: { serviceId: "3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c", requirementId: "f1d7a3c9-5e8b-4a1f-9c6d-2b8e4f7a1c3d" },
  headers: { "X-Wiblo-Workspace": "..." },
  body: {
    "resource_id": "e2f8b4d6-9c1a-4e7b-8f3d-6a2c9e5b1f7d",
    "category": null
  },
})
```

## Example response

```json
{
  "id": "f1d7a3c9-5e8b-4a1f-9c6d-2b8e4f7a1c3d",
  "workspace_id": "9c1b7e24-6a3f-4d58-b2e9-0f4a8c6d1e37",
  "service_id": "3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c",
  "resource_id": "e2f8b4d6-9c1a-4e7b-8f3d-6a2c9e5b1f7d",
  "category": null,
  "quantity": 1,
  "created_at": "2026-07-28T09:12:00.000Z",
  "updated_at": "2026-07-28T09:30:00.000Z"
}
```

## Responses

**`200`** — The updated requirement. Returns `ResourceRequirementResponse`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique id of the requirement. |
| `workspace_id` | `string` | Yes | Workspace the requirement belongs to. |
| `service_id` | `string` | Yes | Service the requirement is attached to. |
| `resource_id` | `string \| null` | Yes | The specific resource required; `null` for a category requirement. |
| `category` | `string \| null` | Yes | The category pool drawn from; `null` for a specific-resource requirement. |
| `quantity` | `integer` | Yes | How many distinct free resources the category's pool must supply per booking; always `1` for a specific-resource requirement. |
| `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`** — The actor is a plain member; owner or admin is required (`ADMIN_REQUIRED`). Returns `ApiErrorEnvelope`.

**`404`** — No requirement with this id on this service (`REQUIREMENT_NOT_FOUND`), or the service/resource/workspace collapsed. Returns `ApiErrorEnvelope`.

**`409`** — The service already requires the new target (`REQUIREMENT_ALREADY_EXISTS`). Returns `ApiErrorEnvelope`.

**`422`** — The merged result violates the XOR (`REQUIREMENT_TARGET_INVALID`) or the specific-resource quantity rule (`REQUIREMENT_QUANTITY_INVALID`), or a path param failed UUID validation (`INVALID_PARAMS`). 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`.
