---
title: "Add a label to a task"
method: PUT
path: "/tasks/{task}/labels"
tags: ["labels"]
---

# Add a label to a task

`PUT /tasks/{task}/labels`

Add a label to a task. The user needs to have write-access to the project to be able do this.

## Path parameters

- `task` integer, required

## Request body

- ModelsLabelTask
  - `created` string — A timestamp when this task was created. You cannot change this value.
  - `label_id` integer — The label id you want to associate with a task.

## Response `201`

The created label relation object.

- ModelsLabelTask
  - `created` string — A timestamp when this task was created. You cannot change this value.
  - `label_id` integer — The label id you want to associate with a task.

## Other responses

- `400` — Invalid label object provided.
- `403` — Not allowed to add the label.
- `404` — The label does not exist.
- `500` — Internal error

---

[API](https://skmtc.net/go-vikunja/apis/vikunja-api.md) · [All operations](https://skmtc.net/go-vikunja/apis/vikunja-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/go-vikunja/vikunja-api/versions/feb3f68bbdf1/schema)
