# Add, list and remove Confluence page labels

URL: https://goingstellar.ro/reference/atlassian-rest-api/page-labels/

Labels are added with the v1 POST /wiki/rest/api/content/{id}/label, which takes an array, and read with the v2 GET /wiki/api/v2/pages/{id}/labels. A label is removed by name with DELETE on the label path.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| POST | `/wiki/rest/api/content/{id}/label` | v1: adds labels to a piece of content; existing labels stay. |
| GET | `/wiki/api/v2/pages/{id}/labels` | v2: lists the labels of a page. |
| DELETE | `/wiki/rest/api/content/{id}/label/{label}` | v1: removes one label by name. |

## Examples

### POST /wiki/rest/api/content/{pageId}/label

Adds a global label. The body is an array of label objects.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '[
  {
    "prefix": "global",
    "name": "api-example"
  }
]' \
  'https://your-domain.atlassian.net/wiki/rest/api/content/{pageId}/label'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/wiki/rest/api/content/{pageId}/label',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json=[{'prefix': 'global', 'name': 'api-example'}],
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "results": [
  {
   "prefix": "global",
   "name": "api-example",
   "id": "33456401",
   "label": "api-example"
  }
 ],
 "start": 0,
 "limit": 200,
 "size": 1
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /wiki/api/v2/pages/{pageId}/labels

Reads the labels of the page with v2.

```bash
curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}/labels'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}/labels',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "results": [
  {
   "prefix": "global",
   "name": "api-example",
   "id": "33456401"
  }
 ]
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### DELETE /wiki/rest/api/content/{pageId}/label/api-example

Removes the label by name.

```bash
curl -X DELETE \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/wiki/rest/api/content/{pageId}/label/api-example'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.delete(
    'https://your-domain.atlassian.net/wiki/rest/api/content/{pageId}/label/api-example',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)
```

Response: HTTP 204

No response body.

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- The add call answers 200 with a results array in which each label has prefix, name, id and label (conf-label-add).
- The v2 list returns prefix, name and id for each label, with no label field (conf-labels-get).
- The remove call answers 204 with no body (conf-label-remove).

## Pitfalls

- The add body is an array even for one label. An object is not what the call takes.
- The path form of the delete does not accept a slash in the name, per the spec. Use the query-parameter form for such names.
- The v1 add call does not replace labels. The spec says an update of the content does.

## Questions and answers

### What is the prefix?

The runs used global. The label then is a normal label of the page.

## Related

- [Get a page](https://goingstellar.ro/reference/atlassian-rest-api/get-page/)
- [Content properties](https://goingstellar.ro/reference/atlassian-rest-api/content-properties/)
- [Spaces](https://goingstellar.ro/reference/atlassian-rest-api/spaces/)
- [Confluence REST API v1 vs v2](https://goingstellar.ro/reference/atlassian-rest-api/confluence-v1-vs-v2/)
- [Find a page by title](https://goingstellar.ro/reference/atlassian-rest-api/find-page-by-title/)

## Sources

- [Add labels to content (Confluence REST API v1)](https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content-labels/#api-wiki-rest-api-content-id-label-post)
- [Get labels for page (Confluence REST API v2)](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-label/#api-pages-id-labels-get)
- [The Confluence Cloud REST API v1 (Atlassian Developer)](https://developer.atlassian.com/cloud/confluence/rest/v1/intro/)

