Data Access Path · 3/7
Recommended reading order, not completion status. Optional steps can be skipped.
View all steps
Before you start: Complete your first query and decide between keyword matching and exact author, topic or tag filters.
Keyword Search
By the end of this page you can find documents by keyword, platform and time range, and page through every result.
To pull everything from a specific user, topic or tag, use browse by filters instead.
Search for a keyword
curl -sS "$WHALE_BASE_URL/v1/search/history" \
-H "Authorization: Bearer $WHALE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mode": "keyword", "query": "electric vehicle", "limit": 20}'Results are ranked by relevance:
{
"mode": "keyword",
"results": [
{
"document_id": "doc_01J...",
"source_platform": "reddit",
"title": "...",
"body": "matching snippet",
"published_at": "2026-12-01T08:00:00Z",
"score": 0.83
}
],
"total": 20,
"cursor": "eyJv..."
}The fields you’ll use most:
document_id: use it to read the full body.body: the matching snippet, not the full text.score: relevance for this search; not popularity or credibility.
A document appears at most once per page.
Filter by platform, language and time
{
"mode": "keyword",
"query": "electric vehicle",
"platforms": ["reddit", "x"],
"languages": ["en"],
"published_from": "2026-11-01T00:00:00Z",
"published_to": "2026-12-01T00:00:00Z"
}Note: Without a time range, only documents published in the last 30 days are searched. To search older content, always pass
published_from.
Platform values are listed in platform coverage. Without platforms, every platform in your access is searched.
Page through all results
If the response has a cursor, there’s another page. Send it back unchanged in the next request and keep the other parameters the same:
{"mode": "keyword", "query": "electric vehicle", "limit": 100, "cursor": "eyJv..."}No cursor means this is the last page.
- Up to 100 documents per page.
totalis the count on this page, not the total number of matches.- To keep syncing new data, use the change feed; to take a lot at once, use bulk exports.
Filter by sentiment, entities and intent
You can filter by analysis results alongside the keyword, or drop query and filter only by these:
{
"mode": "keyword",
"query": "battery",
"sentiments": ["negative"],
"entities": ["brand:Xiaomi"],
"intents": ["complaint"]
}| Parameter | Values | Multiple values |
|---|---|---|
sentiments | positive, negative, neutral | Any of them |
emotions | anger, disgust, fear, joy, sadness, surprise, neutral | Any of them |
entities | type:name (such as brand:Xiaomi) or just a name, up to 10 | All must be mentioned |
intents | See read intents | Any of them |
quality_statuses | normal, low, spam, duplicate, empty | Any of them |
Required field access:
- Sentiment and emotion filters:
affect - Entity filters:
entities - Intent filters:
intents
Only documents that have been analyzed can match. No match doesn’t mean the document lacks that emotion or entity.
Sentiment buckets: a score above 0.3 is positive, below -0.3 is negative, otherwise neutral. Documents with confidence below 0.4 fall into no bucket.
Return only what you need
| Parameter | Effect |
|---|---|
fields | Return only the listed fields, for smaller responses |
include_highlights | Return highlights marked with <em> |
include_chunks | Return each matching chunk in matched_chunks |
include_non_current | Let older versions match too; results are still one per document |
Collect fresh data at the same time
While searching stored data, you can ask the platform to collect a new batch. Use /v1/search and add live:
curl -sS "$WHALE_BASE_URL/v1/search" \
-H "Authorization: Bearer $WHALE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"mode": "keyword",
"query": "electric vehicle",
"platforms": ["youtube"],
"live": {"enabled": true, "resource_kind": "video", "deadline_seconds": 300}
}'The response returns stored results immediately, plus a live_query:
"live_query": {
"id": "lq_01J...",
"status": "pending",
"runs": [{"platform": "youtube", "status": "pending"}]
}Read the newly collected data separately: use live_query.id to poll and read the live query.
Requirements:
- An
Idempotency-Keyheader is required. platformsmust list 1 to 5 platforms.live.resource_kind:content,account,user,channelorvideo.
Note: Live collection reserves credits per platform. See live queries.
About the deadline:
- Collection can take more than 2 minutes. Set
deadline_seconds: 300(10 to 900). - The deadline counts from creation; queuing and retries don’t extend it.
- The old
max_wait_secondsis an alias for the deadline, not a wait time. Passing10ends collection after 10 seconds. Don’t use it in new code.
Choose an endpoint
| Endpoint | Use |
|---|---|
POST /v1/search/history | Searches stored data only, never triggers collection. The recommended default |
POST /v1/search | Same, plus live collection |
/v1/contents/search and /v1/search/keyword are legacy; don’t use them in new code. mode=vector and mode=hybrid are retired; see vector analysis (retired).
All parameters: API reference.
When results are incomplete
If part of the search backend times out, you still get 200, with degraded: true and warnings:
warnings[].code | Meaning | What to do |
|---|---|---|
keyword_search_partial | Timed out before searching everything; newest content may be missing | Narrow platforms, time range or keywords, then retry |
keyword_search_timed_out | The search timed out; results are empty | Same as above |
live_query_unavailable | Live collection wasn’t created; only stored results returned | Retry later, or create a live query directly |
When something fails
See Error codes.
Completion check: Use keyword mode with platform, time and field filters and cursor pagination; distinguish snippets and page counts from full bodies and global totals.
Not needed? Skip optional steps: Read Content & Versions