Read as needed; not a required onboarding step. Path：[Data Access Path](/en/docs)

# Scheduled Collection & Keyword Monitoring

Open **Keyword monitoring** in the customer console to subscribe to keywords and fetch new content from source platforms periodically. This is separate from a data-access subscription. Select an application, platform, keyword, interval and item ceiling (optionally a language and region) to create a monitoring subscription. Keywords can be pasted in bulk (one per line or comma-separated, up to 50 at a time); the console creates one subscription per keyword and skips keywords the platform already monitors. This screen uses your portal session without creating another API key. Organization owners and administrators may create, pause and resume; other authorized members have read-only access.

When you need new content from a platform user or channel on an ongoing basis, create a recurring collection subscription. Whale dispatches collection tasks at the interval you set, the results are written to the data center, and you read them with [search](/en/docs/search), [browse by user or topic](/en/docs/browse), or [change sync](/en/docs/change-feed).

| `resource_kind` | What is synchronized | Task type |
| --- | --- | --- |
| `keyword` | Search for new content periodically using a keyword or search expression | `keyword_search` |
| `user` | A platform user's identity, public profile and public content | `user_sync` |
| `channel` | A channel, topic, hashtag, RSS/feed or other public stream | `channel_sync` |

To read profiles or content that have already been collected, use [Users, Topics, Tags & Categories](/en/docs/browse) directly; no subscription is needed.

## Prerequisites

- `WHALE_BASE_URL` and `WHALE_API_KEY` are configured as in [Get & Use an API Key](/en/docs/authentication), and you have curl and jq.
- Applications with no access-policy history inherit all platforms and recurring collection from the platform default. Once Whale saves an explicit policy, it must include the target platform and enable `collection_subscription_enabled`; otherwise creation returns `403`.
- Where collected content is stored is managed by the platform. Do not send `dataset_id`; a request that does gets `400 dataset_id_not_allowed`.
- The target platform needs an online collector that supports the task type; otherwise creation returns `403`.

## Create a Subscription

Collect a Weibo keyword hourly, at most 100 items per run:


```bash
curl -sS --fail-with-body -X POST "$WHALE_BASE_URL/v1/collection/subscriptions" \
  -H "Authorization: Bearer $WHALE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "OpenAI monitoring",
    "source_platform": "weibo",
    "resource_kind": "keyword",
    "keyword": "OpenAI",
    "interval_seconds": 3600,
    "max_items": 100
  }'
```


Keyword monitoring is incremental: the first run collects content from the last interval, and each later run continues from the last successful position. Time ranges are not supported. After a pause, a resumed subscription catches up at most 7 days. For older content, first run a [live query](/en/docs/live-query) with a publish-time window (at most 7 days), then create the monitor.

One subscription targets one platform and one keyword expression. Create separate subscriptions for multiple platforms or expressions. Keywords contain 1–200 characters; `max_items` is required, from 1 to 1000. This is an upper bound, not a promise of a full result set or an increase to a collector's native limit. Optional `language` and `region` are collection hints and never expand access. Keyword subscriptions support only `incremental` mode, which is the default.

Each application has a ceiling on active keyword subscriptions, 100 by default; contact us to change it. Creation or resume at the ceiling returns `409` with code `keyword_subscription_limit_reached`; pause an unused subscription first. This limit is separate from API request rate limits.

The platform needs an online collector that actually implements and declares `keyword_search`. A collector supporting only `live_query` is not automatically compatible. If creation reports no capable collector, ask the collector owner to implement the task contract rather than merely changing the declaration.

Synchronize a YouTube user every hour:


```bash
subscription_response="$(curl -sS --fail-with-body -X POST "$WHALE_BASE_URL/v1/collection/subscriptions" \
  -H "Authorization: Bearer $WHALE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "youtube-creator-watch",
    "source_platform": "youtube",
    "resource_kind": "user",
    "user_id": "channel_123",
    "interval_seconds": 3600
  }')"
printf '%s' "$subscription_response" | jq .
SUBSCRIPTION_ID="$(printf '%s' "$subscription_response" | jq -er '.subscription.id')"
```


To synchronize a Weibo topic every 15 minutes, use this body instead:


```json
{
  "source_platform": "weibo",
  "resource_kind": "channel",
  "topic": "ai-agent",
  "interval_seconds": 900
}
```


| Field | Required | Description |
| --- | ---: | --- |
| `source_platform` | Yes | Platform enum; must be explicitly granted in your subscription. See [Platform Coverage](/en/docs/platforms) |
| `resource_kind` | Yes | `keyword`, `user` or `channel` |
| `keyword` | Conditional | Required for `keyword`, 1–200 characters |
| `user_id` / `user_url` | Conditional | For `user`, at least one: platform user ID or profile URL |
| `channel_id` / `channel_url` / `topic` | Conditional | For `channel`, at least one: channel ID, channel URL or topic/hashtag |
| `interval_seconds` | Yes | Run interval, 60–604800 seconds (1 minute to 7 days) |
| `name` | No | A recognizable name |
| `sync_mode` | No | `all_content`: the first run backfills all visible content, then switches to incremental after success. `incremental`: continue from the last successful position and fetch only new content. Defaults: `all_content` for `user`, `incremental` for `channel` |
| `max_items` | Conditional | Required for keyword subscriptions, 1–1000; optional for user/channel subscriptions |
| `next_run_at` | No | First run time, RFC 3339; runs as soon as possible when omitted |
| `max_attempts` | No | Maximum attempts for a failed run, default 3 |

A successful request returns `201`:


```json
{
  "subscription": {
    "id": "cspec_01K...",
    "source_platform": "youtube",
    "resource_kind": "user",
    "task_type": "user_sync",
    "payload": {"resource_kind": "user", "sync_mode": "all_content", "user_id": "channel_123"},
    "interval_seconds": 3600,
    "status": "active",
    "next_run_at": "2026-10-14T09:00:00Z",
    "created_at": "2026-10-14T08:00:00Z"
  }
}
```


Use `subscription.id` with every later call.

## List Subscriptions and Runs

List your application's subscriptions (`limit` 1–200, default 50):


```bash
curl -sS --fail-with-body "$WHALE_BASE_URL/v1/collection/subscriptions?limit=50" \
  -H "Authorization: Bearer $WHALE_API_KEY" | jq '.subscriptions[] | {id, status, next_run_at, last_run_at}'
```


When due and eligible for dispatch, a subscription creates an independent collection task. View its run history, optionally filtered by `status`:


```bash
curl -sS --fail-with-body "$WHALE_BASE_URL/v1/collection/subscriptions/$SUBSCRIPTION_ID/tasks?limit=20" \
  -H "Authorization: Bearer $WHALE_API_KEY" | jq '.tasks[] | {id, status, attempt_count, last_error, result, updated_at}'
```


| Task `status` | Meaning |
| --- | --- |
| `pending` | Dispatched, waiting for a collector |
| `leased` / `running` | A collector has claimed and is running it |
| `succeeded` | The run finished; `result` holds collection statistics |
| `failed` / `timeout` | The run failed or timed out; `last_error` explains why. It is retried until `max_attempts` |
| `paused` / `canceled` | Paused or cancelled |

Only checkpoints from `succeeded` tasks advance the sync position. Failed or timed-out runs do not commit a new position; subsequent runs reuse the last successful checkpoint.

New runs are deferred while a subscription has a `pending`, `leased`, `running` or `paused` task. Missed intervals are coalesced instead of replayed one by one. Offline collectors do not block other subscriptions. Access is checked again before dispatch; explicit loss of authorization pauses the subscription. Restore access and resume manually.

Keyword collection starts one interval before creation, with `since` and `until` on each task. A successful checkpoint restores the cursor; a `high_watermark` advances the lower bound with a 60-second overlap. Without a watermark, the initial lower bound is retained and repeated scanning may occur. Collectors must fully scan the window before committing a safe watermark; reaching `max_items` does not imply the window is complete. Source availability, upstream limits and collector implementation affect coverage, so zero source-content loss is not guaranteed.

This version supports creation, listing, run history, pause and resume. To change a keyword or interval, pause the old subscription and create another. It does not allow customers to delete ingested historical data.

A successful task means collection finished; content is then ingested and indexed asynchronously and may appear slightly later. Use [Synchronize Data Changes](/en/docs/change-feed) to read by change instead of reconciling task by task.

## Pause and Resume

Pausing only stops future dispatches; it does not interrupt a running task:


```bash
curl -sS --fail-with-body -X POST "$WHALE_BASE_URL/v1/collection/subscriptions/$SUBSCRIPTION_ID/pause" \
  -H "Authorization: Bearer $WHALE_API_KEY" | jq '.subscription.status'

curl -sS --fail-with-body -X POST "$WHALE_BASE_URL/v1/collection/subscriptions/$SUBSCRIPTION_ID/resume" \
  -H "Authorization: Bearer $WHALE_API_KEY" | jq '.subscription.status'
```


Subscription `status` is `active`, `paused` or `disabled`. `disabled` means Whale has deactivated the subscription; you cannot resume it yourself, so contact your organization administrator.

## Billing, Rate Limits and Errors

Each call to the subscription API is metered as one request and charged at your organization's pricing; failed requests are refunded. Requests share your application's rate limit.

| HTTP | code | Meaning and action |
| --- | --- | --- |
| 400 | `invalid_json` | The body is not valid JSON |
| 400 | `collection_request_failed` | Validation failed, such as a missing user or channel identifier or `interval_seconds` out of range; fix per `message` |
| 400 | `dataset_id_not_allowed` | The request sent `dataset_id`; remove it |
| 401 | `unauthorized` | The API key is invalid |
| 402 | `credit_insufficient` | Your organization's credit balance is insufficient |
| 403 | `collection_request_failed` | Recurring collection is not enabled, the platform is not explicitly granted, or no collector is available for the platform |
| 404 | `collection_request_failed` | The subscription does not exist or belongs to another application |
| 409 | `collection_request_failed` | Active keyword subscription ceiling reached; pause another subscription first |
| 409 | `platform_dataset_route_missing` | Monitoring is not yet available for the platform; contact the platform administrator |
| 429 | `rate_limit_exceeded` | Rate limited; back off per `Retry-After` |
| 503 | `collection_request_failed` | Temporarily unavailable; retry later |

See the [public API reference](/en/public-api-reference) for every field.

## Continue Your Task

[Return to the integration path](/en/docs); return to your task after consulting this reference.