# Tag several requests (https://notert.io/docs/api/reference/tag-several-requests)

`POST /api/v1/requests/tags`

Puts tags on several requests and takes others off them at once, as the token's holder, as the requests list does over the requests picked there. Every other tag each wears stays as it is, so a tag a teammate put on one meanwhile stays. A request this token can't read, on a board it isn't held to, deleted or named by a key no request holds, is left out and named in notFoundIds as the call named it. A tag that isn't the workspace's is PICKS_GONE, and nothing changes. Asking again changes nothing.

Access: A token with requests:manage.

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `requestIds` | string[] | Yes | The requests to change, by their ids or keys, up to 100. |
| `addTagIds` | string[] | No | Tags to put on every one of them. One a request wears already stays. Default []. |
| `removeTagIds` | string[] | No | Tags to take off every one of them. Default []. |

## Response 200

| Field | Type | Description |
| --- | --- | --- |
| `changed` | object[] | Each request whose tags changed; one that wore them as asked is left out. |
| `changed.requestId` | string | The request's id. |
| `changed.addedTagIds` | string[] | The tags it put on this request. |
| `changed.removedTagIds` | string[] | The tags it took off this request. |
| `notFoundIds` | string[] | The requests named that this token can't read, on another board, deleted or named by a key no request holds, each as the call named it. |

## Errors

| Status | Code | Message |
| --- | --- | --- |
| 400 | `BAD_REQUEST` | Input validation failed. |
| 401 | `UNAUTHORIZED` | Send a valid API token as a Bearer token. |
| 403 | `HOLDER_NOT_ALLOWED` | The teammate who holds this API token's secret can't do this in the workspace now. A teammate who can should roll it in the workspace's settings. |
| 403 | `INSUFFICIENT_SCOPE` | This API token can't change or delete requests, their status or their place on the roadmap. Create one that may in the workspace's settings. |
| 403 | `NETWORK_NOT_ALLOWED` | This API token works only from the networks it was made for. Call from one of them, or create a token for this one in the workspace's settings. |
| 403 | `NO_SEAT` | This workspace's plan has no seat for you. |
| 403 | `WORKSPACE_SUSPENDED` | This workspace is suspended. |
| 409 | `CHANGED_MEANWHILE` | Something changed meanwhile. Try again. |
| 409 | `PICKS_GONE` | A board, tag or teammate it names isn't in this workspace. Pick another, or leave it out. Its data holds `board`, `tagIds`, `ownerIds`, `author`. |
| 409 | `TAGS_FULL` | A request named would wear more than 50 tags, counting those a teammate added since. data.requestId says which. Take some off it, then send your change once more. Its data holds `requestId`. |
| 429 | `TOO_MANY_REQUESTS` | Too Many Requests. Its data holds `retryAfter`. |

## Example request

```sh
curl -X POST https://app.notert.io/api/v1/requests/tags \
  -H "Authorization: Bearer $NOTERT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "requestIds": [
    "8f2c4b1e-3a6d-4f0b-9c2e-5d7a1b3c9e40"
  ],
  "addTagIds": [
    "8e2f4a6c-1b3d-4e5f-9a7b-2c4d6e8f0a13"
  ],
  "removeTagIds": []
}'
```

## Example response 200

```json
{
  "changed": [
    {
      "requestId": "8f2c4b1e-3a6d-4f0b-9c2e-5d7a1b3c9e40",
      "addedTagIds": [
        "8e2f4a6c-1b3d-4e5f-9a7b-2c4d6e8f0a13"
      ],
      "removedTagIds": []
    }
  ],
  "notFoundIds": []
}
```
