HonestHook

RankingsSign in

Tutorials

Linktree profile in Python

One authenticated call to /api/v1/linktree/profile?handle=comedycentral, the response it returned, and the line that reads one field out of it.

What you need

Standard library only — urllib and json ship with Python 3. There is nothing to pip install.

The call

import json
import os
import urllib.request

url = "https://honesthook.com/api/v1/linktree/profile?handle=comedycentral"

request = urllib.request.Request(
    url,
    headers={"Authorization": "Bearer " + os.environ["HH_KEY"]},
)

with urllib.request.urlopen(request, timeout=30) as response:
    envelope = json.load(response)

print(envelope["success"], envelope["platform"], envelope["endpoint"])

What came back

{
  "success": true,
  "platform": "linktree",
  "endpoint": "linktree/profile",
  "data": {
    "author": {
      "id": "1847312",
      "handle": "comedycentral",
      "name": "Comedy Central",
      "followers": null,
      "following": null,
      "posts_count": null,
      "verified": null,
      "is_private": null
    },
    "items": [
      { "title": "Stream Comedy Central Shows on Paramount+", "url": "http://www.paramountplus.com/", "position": 1 },
      { "title": "Tales From The Trip Merch", "url": "https://comedycentralstore.com/collections/comedy-central", "position": 2 },
      { "title": "Comedy Central Merch Store", "url": "https://bit.ly/33Zo0Lp", "position": 3 },
      { "title": "Comedy Central YouTube", "url": "https://www.youtube.com/comedycentral", "position": 4 },
      { "title": "Animated YouTube", "url": "https://www.youtube.com/channel/UCqp9YsX6sR7i93CY4yGsAow", "position": 5 },
      { "title": "Stand-Up YouTube", "url": "https://www.youtube.com/standup", "position": 6 },
      { "title": "cc.com", "url": "http://www.cc.com/", "position": 7 }
    ]
  },
  "error": null,
  "cached": false
}

Recorded response, captured 27 Sep 2026. A live call returns the value at the moment you ask, not this one.

Every field in that capture

In PythonType in this capture
envelope["success"]boolean
envelope["platform"]string
envelope["endpoint"]string
envelope["data"]["author"]["id"]string
envelope["data"]["author"]["handle"]string
envelope["data"]["author"]["name"]string
envelope["data"]["author"]["followers"]null
envelope["data"]["author"]["following"]null
envelope["data"]["author"]["posts_count"]null
envelope["data"]["author"]["verified"]null
envelope["data"]["author"]["is_private"]null
envelope["data"]["items"]array (7 in this capture)
envelope["error"]null
envelope["cached"]boolean

A field we cannot read comes back null, never 0. A zero would be a claim about the account; null is a fact about our collection. The full list of what this route does not return is on linktree-api/profile.

Reading one field

print(envelope["data"]["items"])

envelope is the dict from the block above. os.environ raises if the key is not set, which is better than sending the word None as a bearer token.

This endpoint is the odd one of the set, and it is worth knowing why before you write the code: Linktree has no follower count. It is not a number we failed to read — it does not exist on the platform.

So five of the eight author fields come back null — followers, following and posts_count, plus verified and is_private — and the thing you actually came for is items: the list of links, in the order the owner put them in.

Read the list, not the counters

If you copy a snippet from another platform's tutorial and point it at Linktree, you will print None or null and conclude the call failed. It did not. Look at items.

The position on each item is the order the links arrive in — ours, derived, starting at one. It is not Linktree's own number. Linktree's internal values are a sparse key, not a rank, and publishing them as a position would turn an identifier into a ranking it never was.

What you are calling

One authenticated GET to our endpoint, with your key in an Authorization header. The handle in the example is the one that produced the recorded response below.

Before you copy the block

Keep the key in an environment variable — all three examples read HH_KEY.

Then read the field list. The link thumbnails and the campaign parameters some links carry are deliberately not here.

The endpoint itself

Parameters, the handle format, what the route does not return and what a call costs: linktree-api/profile.

The same call in curl · JavaScript.

Free key, 1,000 credits a month

Every example above runs against the real endpoint as soon as you have a key. No card, and the key arrives in seconds.

Get a key →

← Tutorials · linktree-api · Pricing