# What do view=compact and fields= do, and do they change the price?

> The view and fields parameters on every endpoint: what compact, standard and full return, how fields picks dotted paths, why ext needs view=full, and why the price stays the same.

Canonical page: https://okdata.online/answers/api-view-fields-params/

**Short answer: **view picks a preset: standard (the default) returns the shared fields, compact also drops every null field, and full adds platform extras under ext. fields keeps only the dotted paths you list. Neither changes the price or the number of items: a Xiaohongshu search page is $0.02 on okdata whatever shape you ask for.

Every okdata endpoint accepts two optional parameters that shape the answer without changing what is fetched: `view` and `fields`. They exist so that a script or an AI agent can ask for exactly the columns it needs. The idea is the same as `part` and `fields` in Google's YouTube Data API, which call it partial resources.

## view: three presets

| `view` | What each object holds | Example on a Douyin search result |
|---|---|---|
| `standard` (default) | The shared fields of the object kind, nulls included | `title: null` is present |
| `compact` | Standard minus every field that is null | `title` is gone |
| `full` | Standard plus `ext`, the platform's extras | `ext.duration_ms`, `ext.music`, `ext.region` |

On a [Xiaohongshu note search](/apis/xiaohongshu/notes/search/) result, `full` adds `ext.ip_location` and `ext.xsec_token`; on a [Douyin video search](/apis/douyin/videos/search/) result, the extras are the video's length, its music title and region. The [objects reference](/docs/objects/post/) lists the shared fields.

## fields: keep only what you name

`fields=id,title,metrics.likes,author.name` returns objects with just those paths, nested where they were. Dots reach into objects. Paths are applied after `view`, which has one practical consequence: `ext` only exists in `full`, so `fields=id,ext.duration_ms` needs `view=full` as well. Ask for a path that matches nothing and the call still succeeds; the response lists the miss in `warnings`, such as `fields matched nothing: ext.duration_ms`.

## Price and item count

| Request | Items | Cost |
|---|---|---|
| `query=露营装备` | about 20 | $0.02 |
| the same with `view=compact` | about 20 | $0.02 |
| the same with `view=full&fields=id,metrics.likes,ext.duration_ms` | about 20 | $0.02 |

You pay per call, so a slim page and a fat page cost the same. The saving is in bandwidth and, when a model reads the result, in tokens.

## Example

```python
import os, requests

URL = "https://api.okdata.online/v1/xiaohongshu/notes/search"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}

body = requests.get(URL, headers=H, timeout=60, params={
    "query": "防晒霜 推荐", "sort": "popular",
    "view": "full",
    "fields": "id,title,metrics.likes,metrics.favorites,author.name,ext.ip_location",
}).json()
if body["code"] != "ok":
    raise SystemExit(body["message"])
print(body["warnings"])            # [] when every path matched
print(body["meta"]["unavailable"]) # why a field is null, e.g. metrics.views: platform
for note in body["data"]["items"]:
    print(note)
```

## Things to watch

- **Compact hides nulls, it does not explain them.** A missing `metrics.views` in compact output is not zero. `meta.unavailable` still says which fields are null and whether the platform never shows them (`platform`) or the source cannot fetch them yet (`capability`).
- **Paging.** You may change `view` and `fields` between pages of one listing; the cursor stays valid.
- **Agents.** Over MCP the same names go inside `params`, for example `{"query": "露营装备", "fields": "id,title,metrics.likes"}`.

For the token side of this, with field lists for common jobs, see [reducing LLM tokens on social data](/answers/reduce-llm-tokens-social-data/).

## Endpoints used

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

## More about Xiaohongshu (RedNote)

- [Xiaohongshu (RedNote) API](https://okdata.online/apis/xiaohongshu/)
- [Douyin API in Python: videos, profiles and comments (2026)](https://okdata.online/guides/douyin-api-python/)
- [How to export Douyin video comments in bulk](https://okdata.online/guides/douyin-video-comments/)
- [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/)
- [Why can't Perplexity or ChatGPT search find Douyin and Xiaohongshu posts?](https://okdata.online/answers/ai-search-cant-find-douyin-xiaohongshu/)
- [How do I stop an AI agent from overspending on a paid data API?](https://okdata.online/answers/cap-ai-agent-spend-data-api/)
- [Can I connect ChatGPT to Douyin or Xiaohongshu data?](https://okdata.online/answers/chatgpt-douyin-xiaohongshu-data/)
- [How do I give a LangChain or LangGraph agent social media data tools?](https://okdata.online/answers/langchain-mcp-social-data-tools/)
- [How do I use an LLM to find customer pain points in Douyin and Xiaohongshu comments?](https://okdata.online/answers/llm-comment-pain-points-douyin-xiaohongshu/)
- [How to collect Douyin comments: API, crawler or no-code (2026)](https://okdata.online/compare/douyin-comment-scraping/)
- [Douyin data APIs: official vs third-party vs open-source (2026)](https://okdata.online/compare/douyin-data-apis/)

## Sources

- [YouTube Data API: Partial resources, the part and fields parameters](https://developers.google.com/youtube/v3/getting-started) (read 2026-11-12)

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

- https://stackoverflow.com/questions/56315185
- https://stackoverflow.com/questions/30872674
- https://devcommunity.x.com/t/do-tweet-expansions-add-user-read-charges-on-top-of-post-read-when-looking-up-my-own-posts-by-id/275286

Updated 2026-11-12
