# Replace task tags by names

`PUT /api/task/{taskId}/tags`

URL: https://repsona.com/api/put-task-taskid-tags

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

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `taskId` | path | integer | required | ID of the task. |

## Request body

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `names` | body | string[] | required | Names of the tags the task should have (up to 50). This replaces all current tags; an empty array removes them all. Tags that do not exist yet are created. |
| `color` | body | string \| null |  | Color for newly created tags, such as `#8CC230`. Existing tags keep their color. Omit to use the default color. |

## Request

```sh
curl -X PUT "https://<space>.repsona.com/api/task/{taskId}/tags" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "names": [
      "Design",
      "Launch"
    ],
    "color": "#8CC230"
  }'
```

## Responses

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

## Example response

```json
{
  "tags": [
    {
      "id": 90,
      "name": "Design",
      "color": "#2196F3"
    },
    {
      "id": 91,
      "name": "Launch",
      "color": "#8CC230"
    }
  ]
}
```
