Skip to main content

Tags API

The Tags API provides endpoints for managing tags in Joomla.

Base URL

/api/index.php/v1/tags

Endpoints Overview

MethodEndpointDescription
GET/tagsRetrieve all tags
GET/tags/{id}Retrieve specific tag
POST/tagsCreate new tag
PATCH/tags/{id}Update tag
DELETE/tags/{id}Delete tag

Retrieve all tags

GET /api/index.php/v1/tags

Response

{
"data": [
{
"type": "tags",
"id": "2",
"attributes": {
"title": "Joomla",
"alias": "joomla",
"description": "Articles about Joomla",
"published": 1,
"parent_id": 1,
"level": 1,
"path": "joomla",
"language": "*"
}
}
]
}

Retrieve specific tag

GET /api/index.php/v1/tags/{id}

Parameters

ParameterTypeDescription
idintegerTag ID

Example

curl -X GET "https://yoursite.com/api/index.php/v1/tags/2" \
-H "X-Joomla-Token: YOUR_API_TOKEN"

Create tag

POST /api/index.php/v1/tags

Request Body

{
"title": "New Tag",
"alias": "new-tag",
"description": "Description of the tag",
"published": 1,
"access": 1,
"language": "*"
}

Required fields

FieldTypeDescription
titlestringTag title

Optional fields

FieldTypeDefaultDescription
aliasstringautoURL-friendly name
descriptionstring""Description
parent_idint1Parent tag ID
publishedint1Publication status
accessint1Access level
languagestring"*"Language code or *

Example

curl -X POST "https://yoursite.com/api/index.php/v1/tags" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "New Tag",
"description": "Description of the tag"
}'

Update tag

PATCH /api/index.php/v1/tags/{id}

Request Body

{
"title": "Updated Tag",
"description": "New description"
}

Example

curl -X PATCH "https://yoursite.com/api/index.php/v1/tags/2" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Tag"
}'

Delete tag

DELETE /api/index.php/v1/tags/{id}

Example

curl -X DELETE "https://yoursite.com/api/index.php/v1/tags/5" \
-H "X-Joomla-Token: YOUR_API_TOKEN"
Note

Deleting a tag moves it to the trash.

Tag States

ValueStatus
-2Trash
0Unpublished
1Published
2Archived

Hierarchical Tags

Tags support a hierarchical structure via parent_id.

Example: Create sub-tag

curl -X POST "https://yoursite.com/api/index.php/v1/tags" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Sub Tag",
"parent_id": 2
}'

Filtering

By publication status

GET /api/index.php/v1/tags?filter[published]=1
GET /api/index.php/v1/tags?filter[search]=joomla

Linking tags to content

Tags are linked to articles via the tags field when creating or updating articles.

Example: Article with tags

curl -X POST "https://yoursite.com/api/index.php/v1/content/articles" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Article with tags",
"catid": 2,
"tags": [2, 3, 5]
}'