Xiaohongshu E-commerce (RedNote) Product Search API (V1)
Searches Xiaohongshu E-commerce (RedNote) products by keyword with page and search-ID pagination; pages after the first require the search ID returned by the initial search. Use it to discover marketplace products and continue through multi-page results.
Parameters
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
token | query | string | Yes | - | Authentication token for this API service. |
keyword | query | string | Yes | - | Search keyword. |
page | query | string | No | - | Page number, starting from 1. |
searchId | query | string | No | | Search ID returned by the first-page response; required when page is greater than 1. |
Code Samples
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE'I want to use the "Product Search (V1)" API from JustOneAPI.
Base URL: https://api.justoneapi.com.
API Path: /api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE
API Endpoint: BASE_URL + /api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE
HTTP Method: GET
Authentication: Append the "token" query parameter to the URL.
OpenAPI Definition: https://docs.justoneapi.com/openapi/xiaohongshu-e-commerce-rednote/product-search-v1-en.json
Parameters:
- token (query): Authentication token for this API service. (Required)
- keyword (query): Search keyword. (Required)
- page (query): Page number, starting from 1.
- searchId (query): Search ID returned by the first-page response; required when page is greater than 1.
Return format: safely handle JSON or text according to the actual Content-Type.
Response Handling & Error Codes:
1. Business results should be determined by the "code" field in the response body (code 0 means success).
2. Timeout Recommendation: Set the request timeout to 120 seconds. If 120 seconds is too long for your use case, use at least 60 seconds, but a small number of requests may time out before receiving a result.
3. Business Code Reference:
- 0: Success
- 100: Invalid or Inactive Token
- 301: Collection Failed. Please Retry.
- 302: Rate Limit Exceeded
- 303: Daily Quota Exceeded
- 400: Invalid Parameters
- 500: Internal Server Error
- 600: Permission Denied
- 601: Insufficient Balance
- 602: Token Budget Exceeded
4. Code 601 means the shared account balance is insufficient. Code 602 means the current API token's own cumulative budget limit has been reached. Token budget limits do not transfer funds out of the shared account balance.
Please help me write a script in my preferred programming language to call this API and handle the response.import requests
BASE_URL = "https://api.justoneapi.com" # Provided by OpenAPI servers
url = BASE_URL + "/api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
content_type = response.headers.get("content-type", "").lower()
if "json" in content_type:
try:
print(response.json())
except ValueError:
print(response.text)
elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
print(response.text)
else:
with open("response.bin", "wb") as output:
output.write(response.content)
print(f"Saved {len(response.content)} bytes to response.bin")const BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
const url = BASE_URL + "/api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE";
const response = await fetch(url, {
method: "GET",
signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
const contentType = (response.headers.get("content-type") || "").toLowerCase();
const mediaType = contentType.split(";", 1)[0].trim();
const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
if (textual) {
const responseText = new TextDecoder().decode(responseBytes);
let data = responseText;
if (contentType.includes("json")) {
try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
}
console.log(data);
} else {
console.log(`Received ${responseBytes.byteLength} binary bytes`);
}
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws Exception {
final String BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
final String url = BASE_URL + "/api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE";
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(120))
.method("GET", HttpRequest.BodyPublishers.noBody());
HttpRequest request = builder.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
System.out.println(response.statusCode());
String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
String mediaType = contentType.split(";", 2)[0].trim();
if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
System.out.println(new String(response.body(), StandardCharsets.UTF_8));
} else {
Files.write(Path.of("response.bin"), response.body());
System.out.println("Saved " + response.body().length + " bytes to response.bin");
}
}
}package main
import (
"fmt"
"io"
"os"
"strings"
"net/http"
"time"
)
const BASE_URL = "https://api.justoneapi.com" // Provided by OpenAPI servers
func main() {
client := &http.Client{Timeout: 120 * time.Second}
url := BASE_URL + "/api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
bodyBytes, _ := io.ReadAll(resp.Body)
contentType := strings.ToLower(resp.Header.Get("Content-Type"))
mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
fmt.Println(string(bodyBytes))
} else {
os.WriteFile("response.bin", bodyBytes, 0600)
fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
}
}<?php
$BASE_URL = 'https://api.justoneapi.com'; // Provided by OpenAPI servers
$url = $BASE_URL . '/api/xiaohongshu-ec/search-products/v1?token=YOUR_API_KEY&keyword=VALUE';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
echo $response;
} else {
file_put_contents('response.bin', $response);
echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}Response Fields
Key fields in a successful response (code = 0).
Pagination and status6 fields
data
| Field | Type | Description |
|---|---|---|
search_id | string | Search ID returned for this search. Pass it unchanged as searchId when requesting subsequent pages with the same keyword. |
page | integer | Page number reported for the current search response. |
next_page | integer | Next page number returned by the search. When requesting it, reuse the search ID. |
success | boolean | Whether the payload reports a successful search. |
code | integer | Status code reported inside the search payload. |
msg | string | Status message reported inside the search payload. |
Result cards3 fields
data.data.module.data[]
Search result cards. This list can contain product cards and separate related-keyword cards.
| Field | Type | Description |
|---|---|---|
id | string | Identifier of the result card within the page layout. |
card_name | string | Name of the result card as returned. |
card_type | string | Type of the result card as returned. |
Product information5 fields
data.data.module.data[].content
Card content. Product fields are present on product cards. Related-keyword cards can contain scene_keywords.
| Field | Type | Description |
|---|---|---|
id | string | Identifier of the card content. On product cards this is the product ID. |
title | string | Product title shown on the card. |
goods_type | string | Product type reported by the search. |
stock_status | integer | Stock status code reported for the product. |
link | string | RedNote app link for the product. |
Images and prices11 fields
data.data.module.data[].content
| Field | Type | Description |
|---|---|---|
image | array | Product images shown on the search card. |
image[] | object | - |
image[].url | string | Image URL. |
image[].width | integer | Reported image width. |
image[].height | integer | Reported image height. |
image[].aspect_ratio | number | Reported width-to-height ratio of the product image. |
price_info | object | Price information returned on the product card. |
price_info.price | number | Current product price reported on the card. |
price_info.origin_price | number | Original or reference price reported on the card. |
price_info.symbol | string | Currency symbol used for the displayed price. |
price_info.foreign_price | string | Price display text returned in the foreign-price field. |
Shop5 fields
data.data.module.data[].content.vendor
Shop information shown on the product card.
| Field | Type | Description |
|---|---|---|
vendor_name | string | Display name of the shop. |
vendor_id | string | Shop ID returned for the product. |
seller_id | string | Seller ID returned for the product. |
vendor_type | string | Shop type reported by the search. |
vendor_link | string | RedNote app link for the shop. |
Related searches4 fields
data.data.module.data[].content
| Field | Type | Description |
|---|---|---|
scene_keywords | array | Related keyword suggestions returned on a separate card, when available. |
scene_keywords[] | object | - |
scene_keywords[].scene_keyword | string | Text of a related keyword suggestion. |
scene_keywords[].link | string | RedNote app link for the related keyword. |
Product card labels48 fields
data.data.module.data[].content.tag_strategy_map
Optional product card labels, grouped by their placement in the app.
| Field | Type | Description |
|---|---|---|
before_price | array | Text labels shown before the product price. |
before_price[] | object | - |
before_price[].type | string | Display label type. |
before_price[].tag_type | integer | Display label code. |
before_price[].tag_content | object | Display text associated with the label. |
before_price[].tag_content.content | string | Text shown in the label. |
before_price[].tag_content_list | array | Display text fragments returned for the label. |
before_price[].tag_content_list[] | string | - |
after_price | array | Text labels shown after the product price. |
after_price[] | object | - |
after_price[].type | string | Display label type. |
after_price[].tag_type | integer | Display label code. |
after_price[].tag_content | object | Display text associated with the label. |
after_price[].tag_content.content | string | Text shown in the label. |
after_price[].tag_content_list | array | Display text fragments returned for the label. |
after_price[].tag_content_list[] | string | - |
after_shop_name | array | Text labels shown after the shop name. |
after_shop_name[] | object | - |
after_shop_name[].type | string | Display label type. |
after_shop_name[].tag_type | integer | Display label code. |
after_shop_name[].tag_content | object | Display text associated with the label. |
after_shop_name[].tag_content.content | string | Text shown in the label. |
after_shop_name[].tag_content_list | array | Display text fragments returned for the label. |
after_shop_name[].tag_content_list[] | string | - |
upon_title | array | Text labels shown above the product title. |
upon_title[] | object | - |
upon_title[].type | string | Display label type. |
upon_title[].tag_type | integer | Display label code. |
upon_title[].tag_content | object | Display text associated with the label. |
upon_title[].tag_content.content | string | Text shown in the label. |
upon_title[].tag_content_list | array | Display text fragments returned for the label. |
upon_title[].tag_content_list[] | string | - |
behavior | array | Behavior labels returned for the product card. |
behavior[] | object | - |
behavior[].type | string | Display label type. |
behavior[].tag_type | integer | Display label code. |
behavior[].tag_content | object | Display text associated with the label. |
behavior[].tag_content.content | string | Text shown in the label. |
behavior[].tag_content_list | array | Display text fragments returned for the label. |
behavior[].tag_content_list[] | string | - |
before_title | array | Labels shown before the product title. |
before_title[] | object | - |
before_title[].type | string | Display label type. |
before_title[].tag_type | integer | Display label code. |
before_title[].tag_image | object | Image used in the display label. |
before_title[].tag_image.url | string | Image URL. |
before_title[].tag_image.width | integer | Reported image width. |
before_title[].tag_image.height | integer | Reported image height. |
Card order5 fields
data.data.hierarchy
Search result layout and pagination indicators.
| Field | Type | Description |
|---|---|---|
common | object | Common search layout metadata. |
common.load_more | boolean | Whether the returned layout indicates that more results can be loaded. |
structure | object | Card placement in the result layout. |
structure.root | array | Result card IDs in root layout order. They correspond to the IDs in module.data. |
structure.root[] | string | - |