Data Access Path · 2/7
Recommended reading order, not completion status. Optional steps can be skipped.
View all steps
Before you start: Configure your Consumer API Key and have Bash, curl, and jq available.
Make Your First Query
Search existing data with an application API key, then read the full content of one result.
Prerequisites
- Whale has opened a Portal account for your organization.
- Your organization has an application.
- The application inherits the platform default access policy or has an explicit policy assigned by Whale.
- An organization owner/admin has created a Consumer API Key under Applications → Application Keys in Portal and delivered it to you securely.
- Your machine has Bash, curl (with
--fail-with-bodysupport) and jq.
This guide only queries existing data; it does not request fresh collection.
Production Base URL:
https://www.marsyoo.comRun Your First Query
export WHALE_BASE_URL="${WHALE_BASE_URL:-https://www.marsyoo.com}"
: "${WHALE_API_KEY:?Set the Consumer API Key from Portal}"
search_response="$(curl -sS --fail-with-body --request POST "$WHALE_BASE_URL/v1/search" \
--header "Authorization: Bearer $WHALE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"mode": "keyword",
"query": "artificial intelligence",
"limit": 10
}')"
printf '%s' "$search_response" | jq .
DOCUMENT_ID="$(printf '%s' "$search_response" | jq -r '.results[0].document_id // empty')"Response shape (see Keyword & Semantic Search for every field):
{
"mode": "keyword",
"results": [
{
"document_id": "doc_01J...",
"source_platform": "weibo",
"title": "...",
"body": "Best-matching chunk snippet",
"score": 0.87,
"published_at": "2026-09-10T12:00:00Z"
}
],
"total": 342,
"cursor": "eyJv..."
}Verify: the request succeeds and the response contains a results array. results=[] can still be a normal result. Check the query, existing data and subscription scope first; do not automatically create a live query because of it.
This example sends no platform filter and uses the application’s existing grants. To narrow platforms, add valid platforms enum values; filters never expand subscription access. /v1/contents/search is a legacy alias; new integrations use /v1/search.
Read Details
Only continue when results are nonempty. This step uses the document_id captured above:
: "${DOCUMENT_ID:?No matches; check the query and subscription before reading details}"
curl -sS --fail-with-body "$WHALE_BASE_URL/v1/documents/$DOCUMENT_ID" \
--header "Authorization: Bearer $WHALE_API_KEY"The response contains document metadata and current version information; see Read Content & History for fields.
Full content:
curl -sS --fail-with-body "$WHALE_BASE_URL/v1/documents/$DOCUMENT_ID/content" \
--header "Authorization: Bearer $WHALE_API_KEY"When Requests Fail
For 401, check key validity; 403, subscriptions and field grants; 429, back off according to rate limits. See Limits, Retries & Troubleshooting. Never put keys in logs or agent conversations.
After a successful query and content read, continue to Keyword & Semantic Search to choose a search mode and filters for your application.
Completion check: Obtain a document_id and read its content; for empty results, check the query and subscription before requesting collection.