Aller au contenu

Tags

Every route for tags: managing them, then setting them on a page or a short link. A tag is referred to by its numeric id.

List tags

GET/v1/tags

The environment's tags, in alphabetical order. elements_count counts the pages and links that carry the tag. Read scope.

curl https://api.tinylink.fr/v1/tags \
  -H "Authorization: Bearer tl_your_token"

Possible responses

{
  "data": [
    {
      "id": 46,
      "name": "Campaign",
      "color": "#1E90FF",
      "elements_count": 1,
      "created_at": "2026-10-05T21:57:18+02:00"
    }
  ]
}

Create a tag

POST/v1/tags

name is required (50 characters at most). color is a hexadecimal colour, #1E90FF or #19F; without it the tag is black. Write scope.

curl -X POST https://api.tinylink.fr/v1/tags \
  -H "Authorization: Bearer tl_your_token" \
  -H "Content-Type: application/json" \
  -d '{"name":"Campaign","color":"#1E90FF"}'

Possible responses

{
  "id": 46,
  "name": "Campaign",
  "color": "#1E90FF",
  "elements_count": 0,
  "created_at": "2026-10-05T21:57:18+02:00"
}

Read a tag

GET/v1/tags/{id}

Read scope.

curl https://api.tinylink.fr/v1/tags/46 \
  -H "Authorization: Bearer tl_your_token"

Possible responses

{
  "id": 46,
  "name": "Campaign",
  "color": "#1E90FF",
  "elements_count": 1,
  "created_at": "2026-10-05T21:57:18+02:00"
}

Edit a tag

PATCH/v1/tags/{id}

name, color, or both. Write scope.

curl -X PATCH https://api.tinylink.fr/v1/tags/46 \
  -H "Authorization: Bearer tl_your_token" \
  -H "Content-Type: application/json" \
  -d '{"name":"Summer campaign"}'

Possible responses

{
  "id": 46,
  "name": "Summer campaign",
  "color": "#1E90FF",
  "elements_count": 1,
  "created_at": "2026-10-05T21:57:18+02:00"
}

Delete a tag

DELETE/v1/tags/{id}

Deletes the tag and removes it from every element that carried it; the pages and links themselves are untouched. Delete scope.

curl -X DELETE https://api.tinylink.fr/v1/tags/46 \
  -H "Authorization: Bearer tl_your_token"

Possible responses

No content

List a tag's elements

GET/v1/tags/{id}/elements

The pages and short links that carry the tag, paginated like the other lists (?page=, ?per_page=). type tells page from link. Read scope.

curl https://api.tinylink.fr/v1/tags/46/elements \
  -H "Authorization: Bearer tl_your_token"

Possible responses

{
  "data": [
    {
      "id": "6ac401093831b",
      "type": "link",
      "target_url": "https://example.com/promo",
      "slug": "promo",
      "url": "https://tnlnk.fr/promo",
      "status": "active",
      "password_protected": false,
      "restricted": false,
      "tags": [
        {
          "id": 46,
          "name": "Campaign",
          "color": "#1E90FF"
        }
      ],
      "qr_code": null,
      "created_at": "2026-10-05T21:56:57+02:00",
      "edit_url": "https://app.tinylink.fr/shortener-edit?id=6ac401093831b"
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 50,
    "total": 1,
    "total_pages": 1
  }
}

Read an element's tags

GET/v1/pages/{id}/tags

GET/v1/links/{id}/tags

The tags set on a page or on a short link. Read scope.

curl https://api.tinylink.fr/v1/links/6ac401093831b/tags \
  -H "Authorization: Bearer tl_your_token"

Possible responses

{
  "data": [
    {
      "id": 46,
      "name": "Campaign",
      "color": "#1E90FF"
    }
  ]
}

Set a tag

PUT/v1/pages/{id}/tags/{tag}

PUT/v1/links/{id}/tags/{tag}

Sets the tag on the page or the short link; no request body. The response gives the element's tags after the operation. Write scope.

curl -X PUT https://api.tinylink.fr/v1/links/6ac401093831b/tags/46 \
  -H "Authorization: Bearer tl_your_token"

Possible responses

{
  "data": [
    {
      "id": 46,
      "name": "Campaign",
      "color": "#1E90FF"
    }
  ]
}

Remove a tag

DELETE/v1/pages/{id}/tags/{tag}

DELETE/v1/links/{id}/tags/{tag}

Removes the tag from the element without deleting anything: the Write scope is enough. The response gives the remaining tags.

curl -X DELETE https://api.tinylink.fr/v1/links/6ac401093831b/tags/46 \
  -H "Authorization: Bearer tl_your_token"

Possible responses

{
  "data": []
}

Still stuck?

Write to us from the Support tab of your workspace, we answer within one business day.

Contact support