# Replace note tags by names

`PUT /api/note/{noteId}/tags`

URL: https://repsona.com/api/put-note-noteid-tags

Matches space tags by name (find-or-create with the given color) and replaces the note tag links.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `noteId` | path | integer | required | ID of the note. |

## Request body

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `names` | body | string[] | required | Names of the tags to set (up to 50). Replaces all tags on the note; tags that do not exist yet are created. An empty array removes every tag. |
| `color` | body | string \| null |  | Color for tags created by this request (up to 32 characters). Existing tags keep their color. Omit or `null` for the default color. |

## Request

```sh
curl -X PUT "https://<space>.repsona.com/api/note/{noteId}/tags" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "names": [
      "launch",
      "checklist"
    ],
    "color": "#3b82f6"
  }'
```

## Responses

- 200: Updated tags
- 400: Too many tags
- 401: Authentication is required
- 403: Not a project member
- 404: Note not found

## Example response

```json
{
  "tags": [
    {
      "id": 86,
      "name": "launch",
      "color": "#3b82f6"
    },
    {
      "id": 87,
      "name": "checklist",
      "color": "#3b82f6"
    }
  ]
}
```
