Update a tag

Rename a tag, set how it displays, or both. slug renames the tag across the site, and title and description set how it displays.

A rename retags every page carrying the tag and moves the tag’s title and description to the new slug, all in one request. Page content is never touched.

PATCH https://sitepaste.com/api/v1/public/sites/{siteId}/tags/{slug}

Requires the content scope.

Usage

Rename a tag and give it display casing in the same request:

curl -X PATCH "https://sitepaste.com/api/v1/public/sites/default/tags/guides" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "slug": "tutorials", "title": "Tutorials" }'

Authorizations

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token (Authorization: Bearer sp_...). Created in the dashboard under Account > Tokens. See authentication.

Path parameters

ParameterTypeRequiredDescription
slugstringYesThe tag’s current slug: lowercased, with spaces as hyphens.

Body

FieldTypeRequiredDescription
slugstringNoThe new tag. Renames it on every page that carries it. Sending the current slug is accepted and renames nothing, so you can send back the whole record you read.
titlestringNoDisplay title, which is how the tag is written on the site (max 30 chars). An empty string clears it. A title equal to the slug reads back as empty, and the site shows the slug.
descriptionstringNoDescription shown on the tag’s page (max 200 chars). An empty string clears it.

Send at least one of the three. When a request carries both slug and metadata, the rename runs first and the metadata lands on the new slug.

Clearing both the title and the description removes the tag’s display title without removing the tag from any page.

Response

200 OK with the tag as it now stands. That is the same record GET /sites/{siteId}/tags/{slug} and the collection answer with, plus renamed.

{ "slug": "tutorials", "title": "Tutorials", "description": "", "pageCount": 12, "renamed": 12 }
FieldTypeDescription
slugstringThe tag’s slug after the update.
titlestringDisplay title, empty when the tag has none.
descriptionstringDescription, empty when the tag has none.
pageCountnumberHow many pages carry the tag.
renamednumberOnly on a rename. The number of pages retagged, which is 0 when no page carried the tag.

Errors

CodeMeaning
400The slug in the path is not a valid tag
409The site already has a title or description set on 500 tags; clear another tag’s first
422No field was sent, the slug in the body is not a valid tag (fields.slug carries the reason), or the title or description is too long