For AI

Use okdata in n8n: HTTP Request and MCP Client Tool

Build an n8n workflow that pulls Xiaohongshu, Douyin or X data from okdata on a schedule, or give an n8n AI Agent the whole catalog through MCP.

Updated 2026-11-12

Here is the workflow this page builds: every morning at nine, n8n searches Xiaohongshu for your brand name, newest first, and drops the new notes into your team's chat channel. Nobody has to remember to check. The second half shows how to give an n8n AI Agent all 214 endpoints at once, so it can answer questions like "what is trending on Bilibili today?" by itself.

Before you start

  • n8n, cloud or self-hosted. The MCP part needs version 1.104 or later; 1.114 or later is easier, because the right transport is the default there.
  • An API key from okdata, starting with okd_. New keys come with $0.10 of credit. The quickstart explains how to get one.

Elsewhere we keep the key in the OKDATA_API_KEY environment variable. In n8n the right place is a credential: n8n stores it encrypted, and it stays out of the workflow when you export or share it.

Step 1: save the key as a credential

  1. Create a new credential and pick Bearer Auth.
  2. Paste your key into Bearer Token (just okd_..., without the word Bearer; n8n adds it).
  3. Name it okdata and save.

If your n8n has no Bearer Auth option, use Header Auth instead: Name Authorization, Value Bearer okd_....

Step 2: a scheduled search with the HTTP Request node

  1. Start with a Schedule Trigger set to every day at 09:00.
  2. Add an HTTP Request node:
    • Method: GET
    • URL: https://api.okdata.online/v1/xiaohongshu/notes/search
    • Authentication: Generic Credential Type, then Generic Auth Type: Bearer Auth, and choose the okdata credential.
    • Turn on Send Query Parameters, choose Using Fields Below, and add two: query = your brand name, sort = latest.
  3. Run the node once. The notes are in data.items; what the call cost is in meta.billing.amount.
  4. Add a Split Out node on data.items, then your Slack, Feishu, email or Google Sheets node.

Every endpoint works the same way: the URL is https://api.okdata.online/v1/ plus the endpoint id with dots turned into slashes, and the parameters go in the query string. Each endpoint page lists them.

Step 3 (optional): give an AI Agent the whole catalog

Add an AI Agent node with a chat model, then attach an MCP Client Tool as its tool:

  • Endpoint: https://api.okdata.online/mcp
  • Server Transport: HTTP Streamable
  • Authentication: Bearer Auth, with the same okdata credential
  • Tools to Include: All

The agent now sees five tools: find and describe to look up endpoints and prices for free, call to fetch data, read_more to read the rest of a long answer for free, and account for the balance. Put a budget into the agent's system message, for example "never make more than three paid calls per request".

If you only need one endpoint as a tool, you can attach the HTTP Request node from step 2 to the agent instead, and let the model fill the keyword with {{ $fromAI('query', 'keywords to search for') }} in the query field.

A first prompt to try

Open the chat on the AI Agent and type:

What is on the Bilibili popular board right now? Give me the top ten with their
heat and links, and tell me what the okdata calls cost.

What it costs

The scheduled search in step 2 makes one call a day. Xiaohongshu note search is $0.02 per page, so that's about $0.60 a month. The Bilibili prompt above costs $0.002. The agent's find, describe and account calls are free, and failed calls never cost anything.

Watch loops: an n8n workflow that pages through results until page.has_more is false can run longer than you expect. Cap it with a fixed number of pages.

When something goes wrong

  • 401 unauthorized. The credential is missing, or the token has a stray space or the word Bearer twice. Open the credential and paste the key again.
  • 402 insufficient_balance. Not enough balance for the call. Nothing was charged. Top up and run it again; prices are on the pricing page.
  • 429 rate_limited. Too many calls in a short burst, often from a loop. The response includes retry_after_seconds. In the HTTP Request node's settings, turn on Retry On Fail with a wait at least that long, or slow the loop down. Rate-limited calls are free.
  • The MCP Client Tool shows no tools. Check the n8n version, that Server Transport is HTTP Streamable, and that the endpoint ends in /mcp. A node added on an older n8n may still show an "SSE Endpoint" field; delete it and add a fresh MCP Client Tool.

Check it works

“List the okdata tools.”

okdata is connected with 5 tools: find describe the data you need in words; get up to five capabilities with what they need, the price and a ready call. It never offers another platform in place of the one asked for; describe read the full contract of one to five capabilities: parameters, links taken, price and the most a call can cost, paging, fields and an example item; call fetch one page of data as text: the first lines say what it cost, the balance left and how to get the next page. Failed calls are free; max_price caps a call; read_more read the rest of an answer that was cut at about 20 KB, or the same result in another view, for 24 hours; account balance and the key’s spending limits, a receipt for one call, usage by day or capability; which capabilities are up, even without a key. Only call costs money. The catalog has 214 endpoints on 17 platforms.

None of this costs anything.

A first conversation

“What is on Weibo hot search right now?”

Tool callResultCost
find {"query":"weibo hot search"}weibo.trends.list · $0.002 per call · about 50 board entries per pageFree
call {"capability":"weibo.trends.list"}One page of about 50 entries$0.002

2 tool calls · 1 charged · $0.002

If something is off

What you seeWhyFix
n8n does not list the okdata toolsIt was started before the server was added, or the address differs from the one above.Check the entry, then restart n8n or start a new chat.
find works, call says unauthorizedThe key did not arrive. find and describe need none, so they still answer.Check the header is Authorization with Bearer and a key starting with okd_, then restart.
call says insufficient_balanceThe balance does not cover the most this call can cost. Nothing was charged.Ask it to run account, then top up in the console.

Connect once, then just ask.

Every new key comes with $0.10 to try it. One sentence connects your agent.

Start free
Connect your AI

Paste this into your agent

Read https://okdata.online/agents.md and set up okdata for me; my key is in the OKDATA_API_KEY environment variable.

Claude Code, Cursor, Codex and other agents that can open a link set themselves up from it.

MCP serverhttps://api.okdata.online/mcp