## Data Access Path

Recommended reading order, not a record of completed steps. Optional steps can be skipped.

1. [Get & Use an API Key](/en/docs/authentication)
2. [Make Your First Query](/en/docs/quickstart) ← current page
3. [Keyword & Semantic Search](/en/docs/search)
4. [Users, Topics, Tags & Categories](/en/docs/browse) (optional)
5. [Read Content & History](/en/docs/documents)
6. [Download Images & Attachments](/en/docs/attachments) (optional)
7. [Limits, Retries & Troubleshooting](/en/docs/production)

**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

1. Whale has opened a Portal account for your organization.
2. Your organization has an application.
3. The application inherits the platform default access policy or has an explicit policy assigned by Whale.
4. An organization owner/admin has created a Consumer API Key under **Applications → Application Keys** in Portal and delivered it to you securely.
5. Your machine has Bash, curl (with `--fail-with-body` support) and jq.

This guide only queries existing data; it does not request fresh collection.

Production Base URL:


```text
https://www.marsyoo.com
```


## Run Your First Query


```bash
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](/en/docs/search) for every field):


```json
{
  "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:


```bash
: "${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](/en/docs/documents) for fields.

Full content:


```bash
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](/en/docs/production). Never put keys in logs or agent conversations.

After a successful query and content read, continue to [Keyword & Semantic Search](/en/docs/search) to choose a search mode and filters for your application.

## Check and Continue

**Completion Check**：Obtain a document_id and read its content; for empty results, check the query and subscription before requesting collection.

Previous step：[Get & Use an API Key](/en/docs/authentication)

**Recommended Next Step**：[Keyword & Semantic Search](/en/docs/search)