Back to Blog

RedNote (Xiaohongshu) API Quickstart: Your First Request in Python

Rnote API Team · · 45 views · 中文
Xiaohongshu Data API Tutorial Python

This tutorial gets your first RedNote (Xiaohongshu) data API call working in Python in about 5 minutes. No crawler to build, no proxies to maintain — the Rnote API handles the collection infrastructure, so all you do is send a standard HTTP request.

Step 1: Sign up and get an API key

Head to the sign-up page, create an account, and verify your email. You'll get free credits on verification, and you can view and manage your API key in the admin panel.

Step 2: Understand the request shape

Every endpoint is standard REST:

  • Base URL: https://rnote.dev/api/v2/crawler
  • Auth: send X-API-Key: YOUR_API_KEY in the request header
  • Response: JSON

Step 3: Make your first request

Using "search notes" as an example:

import requests

API_BASE = "https://rnote.dev/api/v2/crawler"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}

resp = requests.get(
    f"{API_BASE}/search/notes",
    params={"keyword": "美食推荐", "page": 1},
    headers=HEADERS,
)
print(resp.status_code)
print(resp.json())

Once that works, swap the endpoint for note/image (image-note details), user/info (creator info), and more — see the API docs for parameters.

Step 4: Handle errors and retries

Rnote API returns standard HTTP status codes. A robust helper:

import time
import requests

def call(path, params, retries=3):
    url = f"https://rnote.dev/api/v2/crawler/{path}"
    headers = {"X-API-Key": "YOUR_API_KEY"}
    for i in range(retries):
        r = requests.get(url, params=params, headers=headers, timeout=30)
        if r.status_code == 200:
            return r.json()
        time.sleep(2 ** i)  # exponential backoff
    r.raise_for_status()

The good news: only successful (HTTP 2xx) requests are billed, so retries on failures cost nothing — add retry logic with confidence.

Pricing & credits

  • Billed per request. No monthly fee, no minimum spend — pay for what you use.
  • Only successful requests are charged.
  • Free credits on sign-up, enough to validate the API and run small tests.
  • See top-up options and current offers on the pricing page.

Next steps

Ready? Sign up free and send your first request now.