---
title: "Replace a service's tag set"
description: "Atomically replaces the service's whole tag set in one transaction (duplicate ids are collapsed)."
api_method: PUT
api_path: "/v1/services/{serviceId}/tags"
canonical_url: https://wiblo.app/docs/developers/api/service-tags/replace-service-tags
last_updated: 2026-07-28T18:08:25+02:00
md_url: https://wiblo.app/docs/developers/api/service-tags/replace-service-tags.md
---

# Replace a service's tag set

`PUT /v1/services/{serviceId}/tags`

Atomically replaces the service's whole tag set in one transaction (duplicate ids are collapsed). An empty `tag_ids` clears every assignment. Any unknown or foreign tag id fails the whole call with 404 `TAG_NOT_FOUND` and leaves the previous set intact. Owner/admin only. Per-user rate-limited at 60/60s.

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `serviceId` | `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 |
| --- | --- | --- | --- |
| `tag_ids` | `array<string>` | Yes | The service's complete new tag set (max 100) — replaces every existing assignment atomically; duplicate ids collapse, `[]` clears all tags, and any unknown or foreign id fails the whole call with 404 `TAG_NOT_FOUND`. |

## Request

**curl**

```bash
curl https://api.wiblo.app/v1/services/3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c/tags \
  -X PUT \
  -H "Authorization: Bearer $WIBLO_TOKEN" \
  -H "X-Wiblo-Workspace: $WIBLO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "tag_ids": [
    "d4c8b1a2-3e5f-4a6b-8c9d-0e1f2a3b4c5d",
    "f2a7c4e1-8b3d-4e5f-9a6c-1d0e8b5f3a2c"
  ]
}'
```

**TypeScript**

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

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

const { data, error } = await replaceServiceTags({
  client: sdk,
  path: { serviceId: "3f8a2b9c-51d4-4e0b-9c6a-7d2e8f1a4b5c" },
  headers: { "X-Wiblo-Workspace": "..." },
  body: {
    "tag_ids": [
      "d4c8b1a2-3e5f-4a6b-8c9d-0e1f2a3b4c5d",
      "f2a7c4e1-8b3d-4e5f-9a6c-1d0e8b5f3a2c"
    ]
  },
})
```

## Example response

```json
{
  "tags": [
    {
      "id": "f2a7c4e1-8b3d-4e5f-9a6c-1d0e8b5f3a2c",
      "workspace_id": "9c1b7e24-6a3f-4d58-b2e9-0f4a8c6d1e37",
      "name": "Deep dive",
      "color": "#a78bfa",
      "created_at": "2026-07-26T10:00:00.000Z",
      "updated_at": "2026-07-26T10:00:00.000Z"
    },
    {
      "id": "d4c8b1a2-3e5f-4a6b-8c9d-0e1f2a3b4c5d",
      "workspace_id": "9c1b7e24-6a3f-4d58-b2e9-0f4a8c6d1e37",
      "name": "Intro",
      "color": "#38bdf8",
      "created_at": "2026-06-10T15:20:00.000Z",
      "updated_at": "2026-06-10T15:20:00.000Z"
    }
  ]
}
```

## Responses

**`200`** — The service's new tag set. Returns `TagListResponse`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `tags` | `array<TagResponse>` | Yes | The workspace's tags, ordered by name. |

**`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 (`SERVICE_NOT_FOUND`) or one of the tag ids (`TAG_NOT_FOUND`) is not visible in this workspace. Returns `ApiErrorEnvelope`.

**`422`** — 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`.

### The TagResponse object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique id of the tag. |
| `workspace_id` | `string` | Yes | Workspace the tag belongs to. |
| `name` | `string` | Yes | Display name, unique per workspace (case-insensitive). |
| `color` | `string \| null` | Yes | `#rrggbb` chip colour; `null` uses the default chip style. |
| `created_at` | `string` | Yes | Creation timestamp (RFC 3339). |
| `updated_at` | `string` | Yes | Last-update timestamp (RFC 3339). |
