Tag POST Resources

Create tag

POST /tags

Only users with the contentadmin_ role are allowed to create tags.

Parameter Type Description
tag string Tag to create. Tag must not exist. Tags are treated case-insensitive.
excluded_from_suggestions boolean If true, this tag is explicitly excluded from being returned by the /search/tags/suggestions endpoint.

Payload

{
    "tag": "Sherlock",
    "excluded_from_suggestions": true
}

Response

{
    "id": 27,
    "tag": "Sherlock",
    "encounter": 0,
    "image": null,
    "excluded_from_suggestions": true,
    "created": "2011-12-12T15:35:25.000Z"
}


Set tag image

Uploads MUST be performed using the multipart/form-data Content-Type.

The image file is automatically resized to 96x96px and converted to grayscale.

POST /tags/:ID/image
Parameter Type Default Required Description
file file - Image file.

Response

{
    "tag": "Sherlock",
    "id": 27,
    "encounter": 736,
    "image": "https://cdn.example.com/avatar/default/2d/1b84215e2f035a22f6fec213d3b1d9.jpg",
    "excluded_from_suggestions": false,
    "created": "2011-12-12T15:35:25.000Z"
}


Merge tags

POST /tags/:ID/merge
Parameter Type Default Required Description
source_tag_id Int - ID of the source tag to merge.

Merge a source-tag into a target-tag. The request is made as POST /tags/targetID/merge with the source tag in the payload. Merging has the following consequences:

  • The target label remains unchanged.
  • Questions with the source tag are tagged with the target tag after the merge.
  • The target inherits subscribers and linked tags of the source.
  • If the target does not have an avatar, it will inherit the avatar of the source if there is one.
  • The target keeps its exclude_from_suggestions property.
  • After the merge, the source tag is completely removed from the network.

It is not possible to revert a tag merge. However, it is possible to recreate the source tag as completely new tag after the merge.

A common use case for this endpoint is to merge a misspelling (e.g. source tag Stamrind) into the correct tag (target tag Starmind).

Payload

{
    "source_tag_id": 99
}

Response

{
    "tag": "Sherlock",
    "id": 27,
    "encounter": 736,
    "image": "https://cdn.example.com/avatar/default/2d/1b84215e2f035a22f6fec213d3b1d9.jpg",
    "excluded_from_suggestions": false,
    "created": "2011-12-12T15:35:25.000Z"
}