Answers

How do I collect likes, saves and comments for all my Xiaohongshu campaign notes?

Short answer

Put the note links or IDs in a list and call the okdata Xiaohongshu note detail endpoint for each one, $0.02 per note; add one account profile call per creator ($0.02) for follower counts. A 30-note campaign measured on day 1, day 7 and day 30 costs $2.40.

The campaign is over: 30 creators, 30 notes, and the brand wants a recap with likes, saves, comments and shares per note, plus an engagement rate per creator. Someone usually opens every note on a phone and types numbers into a sheet, then does it again a week later. A script does the same in a minute and stores the snapshot.

The calls

  • Xiaohongshu note detail, by id or by url (xhslink.com short links work): likes, saves (favorites), comments, shares, publish time, title and the author's user ID.
  • Xiaohongshu account profile per creator: followers, so you can compute engagement per follower.

Cost

Report Calls Cost
30 notes, one snapshot 30 $0.60
plus 30 creator profiles 60 {{cost:xiaohongshu.notes.get30+xiaohongshu.users.get30}}
30 notes on day 1, 7 and 30, profiles once 120 {{cost:xiaohongshu.notes.get90+xiaohongshu.users.get30}}

Script

import csv, os, requests, datetime as dt

API = "https://api.okdata.online"
HEAD = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
links = ["http://xhslink.com/a/AbCdEf", "https://www.xiaohongshu.com/explore/6650a1b2000000001e00abcd"]

with open(f"campaign-{dt.date.today()}.csv", "w", newline="", encoding="utf-8-sig") as f:
    w = csv.writer(f)
    w.writerow(["note_id", "author_id", "likes", "saves", "comments", "shares", "followers"])
    for link in links:
        n = requests.get(API + "/v1/xiaohongshu/notes/get", headers=HEAD, params={"url": link}, timeout=60).json()["data"]["item"]
        u = requests.get(API + "/v1/xiaohongshu/users/get", headers=HEAD, params={"id": n["author"]["id"]}, timeout=60).json()["data"]["item"]
        m = n["metrics"]
        w.writerow([n["id"], n["author"]["id"], m["likes"], m["favorites"], m["comments"], m["shares"], u["followers"]])

If one creator appears twice, cache their profile instead of calling again.

What a public API cannot tell you

  • Reads and impressions. Xiaohongshu does not publish view counts, so metrics.views is null. Reads, impressions and the organic versus paid split are in the brand's PGY or ads report.
  • Deleted notes. A note the creator removed returns not_found (free). Keep the earlier snapshot; that is your proof it ran.
  • History. Counts are as of the call. Store each snapshot with the date.

Alternatives

If the campaign was booked through PGY, its order report gives reads and audience data for each note and should be the primary source; public counts are a cross-check and cover notes outside PGY too. For a recurring version of this report across competitors' campaigns as well, see competitor monitoring.

Updated