RedNote (Xiaohongshu) API Quickstart with Go
Xiaohongshu Data
API Tutorial
Go
This tutorial connects you to the RedNote (Xiaohongshu) data API with Go. Like the Python and Node.js versions, you build no crawler — the Rnote API handles collection infrastructure, and you just send a GET request with the standard net/http package.
Step 1: Sign up and get an API key
Go to the sign-up page, create an account, verify your email, and get free credits plus your API key.
Step 2: Make your first request
Standard library only — no third-party dependencies:
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
endpoint := "https://rnote.dev/api/v2/crawler/search/notes"
q := url.Values{}
q.Set("keyword", "camping gear")
q.Set("page", "1")
req, _ := http.NewRequest("GET", endpoint+"?"+q.Encode(), nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}
Step 3: Wrap a call with retries
func call(path string, params url.Values, retries int) ([]byte, error) {
endpoint := "https://rnote.dev/api/v2/crawler/" + path + "?" + params.Encode()
var lastErr error
for i := 0; i < retries; i++ {
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
lastErr = err
} else {
body, _ := io.ReadAll(resp.Body)
resp.Body.Close()
if resp.StatusCode == 200 {
return body, nil
}
lastErr = fmt.Errorf("HTTP %d", resp.StatusCode)
}
time.Sleep(time.Duration(1<<i) * time.Second) // exponential backoff
}
return nil, lastErr
}
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; free credits on sign-up. See top-up options and current offers on the pricing page.
Next steps
- Bulk content: keyword search, watermark-free image/video
- Users & products: comment data, product data
- Full endpoints: API docs
Sign up free and send your first request with Go now.