# What is a Xiaohongshu note ID and where do I find it in a link?

> A Xiaohongshu note ID is 24 hexadecimal characters, found after /explore/ or /discovery/item/ in a note link. How to spot it, what it is often confused with, and how the API uses it.

Canonical page: https://okdata.online/answers/xiaohongshu-note-id/

**Short answer: **It is the 24-character hexadecimal string after /explore/ or /discovery/item/ in a note link, before any ?xsec_token. okdata's Xiaohongshu note detail takes that ID, or the whole link, for $0.02 and returns the note with the ID in id; note search returns IDs for about 20 notes per $0.02 call.

Every Xiaohongshu note has an ID of exactly 24 characters, digits and the letters a to f only, such as `66f3c1a8000000002c03e5b7`. It is the one piece of a note link that never changes: the `xsec_token` after the question mark is issued per visit and expires, the share code in an xhslink.com link has to be resolved, but the 24 characters stay the same for as long as the note exists. That makes the ID the right key for a spreadsheet or a database, and the thing to extract when people paste links in every possible format.

## Where it sits in each kind of link

| Link | The note ID is |
|---|---|
| `xiaohongshu.com/explore/66f3c1a8000000002c03e5b7?xsec_token=AB…` | the segment after `/explore/` |
| `xiaohongshu.com/discovery/item/66f3c1a8000000002c03e5b7` | the segment after `/discovery/item/` |
| `xiaohongshu.com/user/profile/5f2b7c1e0000000001006a3d/66f3c1a8000000002c03e5b7` | the last segment; the one before it is the author's user ID |
| `xhslink.com/a/Hk3pQx2Lm9` | not visible; the short link has to redirect first |

A regular expression that works for the first three: `/(?:explore|discovery/item|user/profile/[0-9a-f]{24})/([0-9a-f]{24})`.

## What it is easy to confuse with

- **User IDs** are also 24 hexadecimal characters. In a `/user/profile/` link the first 24-character segment is the account, not a note.
- **Comment IDs** have the same shape too. Keep the columns labelled.
- **xsec_token** is a long token, not part of the ID; see [whether you need an xsec_token](/answers/xiaohongshu-xsec-token/).

One property worth knowing: the first 8 characters, read as a hexadecimal number, are a Unix timestamp. In every note we have checked it matches the moment the note was posted (`66f3c1a8` is late September 2024). Xiaohongshu does not document this, so use `published_at` in reports and the ID trick only for a quick sort.

## How the API takes it and returns it

[Xiaohongshu note detail](/apis/xiaohongshu/notes/get/) takes `id=66f3c1a8000000002c03e5b7` or `url=` with an `/explore/`, `/discovery/item/` or xhslink.com link. For a `/user/profile/<user>/<note>` link, send the last segment as `id`. No token is needed. You get back `id`, a canonical `url` (`/explore/<id>`), `type` (`image` or `video`), title, text, images, likes, saves, comments, shares and hashtags; with `view=full`, `ext.xsec_token` holds the token Xiaohongshu attached, if any. [Note search](/apis/xiaohongshu/notes/search/) returns the same `id` for every result.

| Task | Calls | Cost |
|---|---|---|
| One ID or link to a full note | 1 | $0.02 |
| 250 IDs from last month's campaign | 250 | $5.00 |
| One search page of note IDs and counts | 1 | $0.02 |

## Example

```python
import os, re, requests

links = ["https://www.xiaohongshu.com/discovery/item/66f3c1a8000000002c03e5b7?source=webshare"]
pattern = re.compile(r"/(?:explore|discovery/item|user/profile/[0-9a-f]{24})/([0-9a-f]{24})")
for link in links:
    note_id = pattern.search(link).group(1)
    r = requests.get("https://api.okdata.online/v1/xiaohongshu/notes/get",
                     headers={"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"},
                     params={"id": note_id, "fields": "id,type,title,published_at,metrics.likes"},
                     timeout=60)
    print(r.json()["data"]["item"])
```

## Limits

- Deleted or private notes return `not_found`, which is still charged as one call.
- `metrics.views` is null; Xiaohongshu does not publish view counts.
- One note per call; there is no batch detail call. For share links pasted as whole messages, see [Xiaohongshu share link to note data](/answers/xiaohongshu-note-from-share-link/).

## Endpoints used

- [Xiaohongshu note detail](https://okdata.online/apis/xiaohongshu/notes/get/) `xiaohongshu.notes.get`: $0.02 per call
- [Xiaohongshu note search](https://okdata.online/apis/xiaohongshu/notes/search/) `xiaohongshu.notes.search`: $0.02 per call · about 20 notes per page

## More about Xiaohongshu (RedNote)

- [Xiaohongshu (RedNote) API](https://okdata.online/apis/xiaohongshu/)
- [Xiaohongshu API in Python: notes, profiles and comments (2026)](https://okdata.online/guides/xiaohongshu-api-python/)
- [How to export Xiaohongshu comments for a keyword](https://okdata.online/guides/xiaohongshu-note-comments/)
- [How to shortlist Xiaohongshu PGY creators by rate and reads](https://okdata.online/guides/xiaohongshu-pgy-creator-rates/)
- [How to search Xiaohongshu notes and export them to CSV](https://okdata.online/guides/xiaohongshu-search-export-notes/)
- [How can an AI agent outside China read Xiaohongshu instead of being sent to RedNote?](https://okdata.online/answers/xiaohongshu-data-for-agents-outside-china/)
- [How do I build a swipe file of high-performing Xiaohongshu (RedNote) notes to find topics and study what works?](https://okdata.online/answers/xiaohongshu-viral-notes-library/)
- [How do I get Douyin, Xiaohongshu and WeChat data into Qwen?](https://okdata.online/answers/qwen-douyin-xiaohongshu-data/)
- [Can Tencent Yuanbao read Douyin and Xiaohongshu data?](https://okdata.online/answers/yuanbao-douyin-xiaohongshu-data/)
- [Xiaohongshu returns error 300011 (account abnormal). How do I keep collecting notes?](https://okdata.online/answers/xiaohongshu-300011-account-abnormal/)
- [Why does my Xiaohongshu scraper get status 461, and how do I get the data anyway?](https://okdata.online/answers/xiaohongshu-461-status-code/)
- [Scraping it yourself vs a per-call data API: cost, upkeep and risk](https://okdata.online/compare/scraping-vs-data-api/)
- [How to choose a social media data API (2026)](https://okdata.online/compare/social-media-data-apis/)
- [MCP servers for social media data: self-hosted vs hosted](https://okdata.online/compare/social-media-data-mcp-servers/)

## Sources

- [XHS-Downloader README: supported link formats (/explore/, /discovery/item/, /user/profile/…/…, xhslink.com)](https://github.com/JoeanAmier/XHS-Downloader) (read 2026-11-12)
- [Knowing the note ID, how to get xsec_token? (XHS-Downloader issue #397)](https://github.com/JoeanAmier/XHS-Downloader/issues/397) (read 2026-11-12)

Where people asked this (read 2026-11-12): 

- https://github.com/JoeanAmier/XHS-Downloader/issues/397
- https://github.com/ReaJason/xhs/issues/107

Updated 2026-11-12
