Skip to main content
The Query API retrieves user data after they’ve granted consent through Emerge Link. Choose between synchronous (immediate response) or asynchronous (job-based) queries depending on your use case.

Available data types

Data TypeSync EndpointAsync EndpointDescription
Search History/v1/sync/get_search/v1/searchGoogle search queries
Browsing History/v1/sync/get_browsing/v1/browsingChrome browser history
YouTube History/v1/sync/get_youtube/v1/youtubeWatched videos
Ad Interactions/v1/sync/get_ads/v1/adsAd clicks and views
Receipts/v1/sync/get_receipts/v1/receiptsPurchase receipts with items and brands

Sync vs Async

Best for: Real-time needs, single users, simple integrations
const response = await fetch(
  `https://query.emergedata.ai/v1/sync/get_search?uid=${uid}`,
  { headers: { 'Authorization': `Bearer ${token}` } }
);

const data = await response.json();
// Data returned immediately in JSON format
Characteristics:
  • Single uid parameter
  • Response includes data directly as JSON
  • 30-second timeout
  • Supports pagination with cursor
  • Supports delta queries with ingested_begin/ingested_end

When to use each

Use CaseRecommendation
User-facing dashboardSync - immediate JSON response
Background data processingAsync - batch multiple users
Real-time personalizationSync - low latency
Batch analyticsAsync - Parquet format for big data tools
Mobile appSync - simpler error handling
Multi-user reportsAsync - query up to 25 users at once

Authentication

All Query API endpoints require a Bearer token:
curl 'https://query.emergedata.ai/v1/sync/get_search?uid=psub_c3d4e5f6789012345678901234abcdef' \
  -H 'Authorization: Bearer your_api_token'
Sync endpoints require uid. Use the callback uid you stored on your backend (or the same value you supplied in the Link URL). Never ask end-users for uid, and never call Query from the frontend since tokens and user mapping must stay server-side.

Categories and schema

  • Categories are Google Topics taxonomy paths (for example /Shopping/Apparel/Footwear).
  • Use GET /v1/sync/categories?table=searches (or browsing, youtube, ads, receipts) to list available category paths.
Response example:
{
  "categories": [
    "/Shopping/Apparel/Footwear",
    "/Sports/Running & Walking",
    "/Computers & Electronics/Software"
  ]
}
See:

Sync response format

Sync endpoints return JSON directly:
{
  "data": [
    {
      "user_id": "psub_c3d4e5f6789012345678901234abcdef",
      "event_id": 12345,
      "query": "best restaurants nearby",
      "timestamp": "2024-01-15T10:30:00Z",
      "ingested_at": "2024-01-15T11:00:00Z"
    }
  ],
  "count": 1,
  "has_more": true,
  "next_cursor": "eyJsYXN0X2lkIjogMTIzNH0=",
  "applied_ingested_end": "2024-01-15T12:00:00Z"
}
FieldDescription
dataArray of records
event_idUnique identifier for deduplication
ingested_atWhen record was added to Emerge
countNumber of records in this response
has_moreWhether more records exist
next_cursorPagination token for next page
applied_ingested_endActual end time used (for delta sync)

Async response format

Async endpoints return a job reference:
{
  "job_id": "82f80278-5e76-4d01-8f1d-b55e08f12a52",
  "status": "PENDING"
}
When completed, the job result includes a download URL:
{
  "task_id": "82f80278-5e76-4d01-8f1d-b55e08f12a52",
  "status": "COMPLETED",
  "url": "https://query-results.s3.amazonaws.com/82f80278-5e76-4d01-8f1d-b55e08f12a52.parquet",
  "created_at": "2026-02-12T09:10:11Z",
  "expire_at": "2026-02-19T09:10:11Z"
}
The download URL points to a Parquet file containing all results.

Error responses

StatusCodeDescription
401unauthorizedInvalid or missing API token
404user_not_foundNo consent for this user
429rate_limitedToo many requests
500internal_errorServer error (retry with backoff)

Next steps

Pagination

Handle large datasets with cursors and delta queries

Event Categories

First-level category list and filter patterns

Data Schema

Field-level schema for all Query event types