← Resources

Playbooks

Triplewhale api

How to authenticate against the Triple Whale API, query attribution data, push events, and pipe everything to your data warehouse. The 8-step playbook with code, pitfalls, and the realistic time budget.

Updated

Before you start

  • An active Triple Whale account on the Scale tier or above (the API is gated above the Pro tier in 2026)
  • Admin access to your Triple Whale workspace to generate API keys
  • A target data warehouse (Snowflake, BigQuery, or Redshift) if you're piping data for analytics
  • Familiarity with REST APIs, OAuth-style token auth, and either Node, Python, or your preferred HTTP client
  • A scheduler (Airflow, Prefect, GitHub Actions, or a serverless cron) for recurring data pulls
  • Estimated time budget: 1-2 days for a working integration, 1-2 weeks for production-grade pipeline with monitoring

The playbook

8 steps

0/8
  1. Step 1: Generate an API key in the Triple Whale workspace

    Log in to Triple Whale, navigate to Settings → Integrations → API. Click 'Generate API Key', label it for the integration you're building (e.g., 'snowflake-pipeline-prod'), and copy the key to a secret manager. The key is shown once; if you lose it, you regenerate. Treat it like a database password.

    TipGenerate separate API keys per environment (dev / staging / prod) and per consumer. When something goes wrong you want to revoke one key without breaking every integration.
  2. Step 2: Confirm your API base URL and rate limits

    Triple Whale's API base is `https://api.triplewhale.com/api/v2` in 2026. Rate limits are documented per endpoint but the default is 60 requests per minute per key with burst tolerance. Heavy historical backfills should be paginated and throttled to avoid 429 responses.

    BASE_URL = "https://api.triplewhale.com/api/v2"
    # Default rate limit: 60 req/min per key
    # 429 responses include Retry-After header - respect it

    Expected outcome

    You have the base URL and know the throttle ceiling before you start coding.

  3. Step 3: Authenticate a test request

    All Triple Whale API requests use Bearer token authentication with the API key generated in Step 1. Run a smoke test against the `/me` or `/workspace` endpoint to confirm the key works and returns the expected workspace ID. If authentication fails, the most common cause is a copy-paste truncation or trailing whitespace in the key.

    curl -X GET "$BASE_URL/me" \
      -H "Authorization: Bearer $TRIPLEWHALE_API_KEY" \
      -H "Content-Type: application/json"

    Expected outcome

    A 200 response with your workspace metadata confirms the auth is working.

  4. Step 4: Query the attribution endpoint for a date range

    The attribution endpoint returns ad-level attribution data with per-channel deduplication. Start with a 7-day query to validate the response shape, then expand to your full historical range. The response includes spend, revenue, ROAS, attributed conversions per ad, ad set, and campaign across every connected ad platform.

    curl -X GET "$BASE_URL/attribution" \
      -G \
      --data-urlencode "start_date=2026-05-13" \
      --data-urlencode "end_date=2026-05-20" \
      --data-urlencode "granularity=ad" \
      --data-urlencode "model=time_decay" \
      -H "Authorization: Bearer $TRIPLEWHALE_API_KEY"
    TipAlways pass an explicit attribution model. Defaults can change; explicit parameters keep your data reproducible.

    Expected outcome

    JSON array of ad-level attribution rows, one per ad per day in the range.

  5. Step 5: Paginate historical backfills

    Triple Whale paginates large responses via cursor or page parameters. Historical backfills (90+ days of ad-level data) should chunk the request by week or month to stay under per-response size limits and avoid timeout-induced retries. Persist the cursor between chunks so you can resume on failure.

    # Pseudocode: chunk by week for historical backfill
    for week_start in date_range("2024-01-01", "2026-05-20", step="7d"):
        week_end = week_start + 7d
        response = fetch_attribution(week_start, week_end)
        store_to_warehouse(response.rows)
        persist_cursor(week_end)
        sleep(1)  # throttle to stay under rate limit

    Expected outcome

    Full historical attribution loaded into your warehouse with resumable progress markers.

  6. Step 6: Pull Shopify orders, products, and customers via the data endpoints

    Beyond attribution, Triple Whale exposes the underlying Shopify-derived data (orders, products, customers, cohorts) via dedicated endpoints. For most warehouse-export use cases, the right pattern is to pull attribution + orders + customers + products as separate tables and join them in your warehouse - not in the API requests.

    # Four parallel pulls for the data warehouse:
    # /attribution  → ad-level spend + attributed revenue
    # /orders       → order-level data with customer + product references
    # /customers    → customer-level data with cohort + LTV
    # /products     → product catalog with SKU-level metadata

    Expected outcome

    Four populated warehouse tables ready for joins in your BI tool.

  7. Step 7: Schedule incremental refreshes

    After the initial backfill, run incremental refreshes on a schedule. The recommended cadence is hourly for attribution (the underlying data updates throughout the day as the optimizer rebalances) and daily for orders / customers / products. Use the `updated_after` query parameter on each endpoint to fetch only records changed since the last successful run.

    # Hourly cron, attribution incremental:
    last_run = read_state("attribution_last_run")
    response = fetch_attribution(
        start_date=last_run - 1d,  # 1-day overlap for late-arriving data
        end_date=now,
        updated_after=last_run,
    )
    upsert_to_warehouse(response.rows, key=["date", "ad_id"])
    write_state("attribution_last_run", now)
    TipAlways include a 1-day overlap window on incremental pulls. Attribution data updates retroactively as Triple Whale processes late-arriving conversions; overlapping windows catch the updates.

    Expected outcome

    Continuous incremental sync keeping the warehouse within 1 hour of Triple Whale source-of-truth.

  8. Step 8: Set up monitoring and alerting on the pipeline

    API integrations fail silently if you don't monitor them. At minimum, alert on: failed authentication (401), rate-limit-induced backoff exceeding 5 minutes (429), no rows returned in an expected refresh window (data gap), and per-endpoint latency exceeding 30 seconds (degraded API or oversized query). Log every request-response pair to your observability stack for diagnosis.

    # Pseudocode: minimal monitoring
    on_failure(
        auth_error=alert("page:on-call", "TW API auth failed"),
        rate_limit=alert("slack:#data", "TW API throttled, backing off"),
        empty_response=alert("slack:#data", f"TW API returned 0 rows for {date}"),
        high_latency=alert("slack:#data", f"TW API >30s for {endpoint}"),
    )

    Expected outcome

    Pipeline runs unattended in production with the right people notified on real failures.

Shuttergen

Triple Whale data in warehouse. Shuttergen ships the ads.

Once your Triple Whale data is in the warehouse, Shuttergen reads your winners and generates 10 new variants tuned to your brand and your category's competitors. Close the loop.

Pitfalls

What goes wrong

  • Treating the API key like an environment variable instead of a secret

    API keys in committed .env files leak constantly. Use a real secret manager (Vault, AWS Secrets Manager, GCP Secret Manager) and rotate quarterly. Triple Whale lets you regenerate without downtime if you handle key rotation in your secret manager rather than in code.

  • Pulling without explicit attribution model parameters

    Triple Whale's default attribution model can change in product updates. Always pass `model=time_decay` (or your preferred model) explicitly. Otherwise a silent product change rewrites your historical attribution and you won't know why the reports moved.

  • Skipping the overlap window on incremental pulls

    Attribution data updates retroactively as late conversions get processed. Without a 1-day (or longer) overlap on each incremental pull, you'll permanently lose those updates. Always include overlap; let the upsert handle de-duplication.

  • Building joins in the API request instead of the warehouse

    It's tempting to ask the API for 'attribution + orders + customers in one response'. Don't. Pull each entity separately, store in warehouse tables, and join in your BI layer. The API joins are slower, harder to maintain, and produce uncacheable responses.

  • Ignoring 429 responses by retrying immediately

    429 (Too Many Requests) responses include a Retry-After header. Respect it. Immediate-retry loops compound the throttle and can get your key temporarily blocked. Exponential backoff with jitter is the right pattern.

  • Pulling at higher granularity than you need

    Ad-level attribution is the highest-resolution but also the largest response. If your reporting only needs campaign or channel granularity, request that level - it's faster, cheaper to store, and produces cleaner aggregates. Granularity should match the reporting need.

Limits

When this playbook won't work

  • You're on the Pro tier - the API is gated above Pro in 2026 (verify with Triple Whale support if pricing has changed)
  • Your store isn't on Shopify - the Triple Whale data model is Shopify-shaped; non-Shopify ecommerce produces sparse, lower-fidelity API responses
  • You need real-time webhook delivery - Triple Whale's API is pull-based; for push-based updates you need to poll on a tight schedule
  • You're trying to backfill more than 2 years of historical attribution - Triple Whale's retention varies by tier and may not have the full window
  • You need write access to push custom events back into Triple Whale - the v2 API supports reads cleanly but writes are limited to specific endpoints

Why warehouse the Triple Whale data rather than living in the dashboard

Triple Whale's dashboards are excellent for marketing-team operational use. They're less suited for the kind of bespoke analysis a finance team needs, the kind of cross-business reporting a multi-brand holding company runs, or the kind of long-horizon LTV modeling a serious DTC analytics function builds. For all of those use cases, the right pattern is to pull Triple Whale data into your warehouse and build custom analysis on top.

The warehouse-export pattern also future-proofs you against Triple Whale-specific product changes. Dashboards get redesigned; columns get renamed; default attribution models change. Your warehouse copy of the underlying data stays stable, and your custom reporting stays stable on top of it. For brands running Triple Whale as a critical input to financial reporting, this stability matters.

The cost is the engineering work to build and maintain the pipeline. A first cut takes 1-2 days for a developer comfortable with REST APIs and SQL. Production-grade with monitoring takes 1-2 weeks. Ongoing maintenance is light (~2 hours/month) unless Triple Whale ships an API breaking change, which happens roughly annually.

Triple Whale data in warehouse. Shuttergen ships the ads. Once your Triple Whale data is in the warehouse, Shuttergen reads your winners and generates 10 new variants tuned to your brand and your category's competitors. Close the loop.

Generate variants free

Common downstream use cases for the warehoused data

Cross-brand consolidated reporting. Multi-brand DTC operators pulling each brand's Triple Whale data into a shared warehouse for unified portfolio-level reporting. Lets finance teams produce monthly board decks that aggregate across brands cleanly.

Custom LTV models. Triple Whale's native cohort analytics are accessible but shallow. Brands with serious LTV needs (subscription DTC, repeat-purchase optimization, customer-segmentation strategy) build custom LTV models in the warehouse on top of Triple Whale's order and customer data.

Finance reconciliation. Net revenue reconciliation between Triple Whale's attributed revenue, Shopify's gross revenue, and your accounting system. The warehouse is the natural place to do this; the dashboards can't.

Anomaly detection at the BI layer. Triple Whale's anomaly detection is built into the dashboards; some brands prefer to build anomaly detection in Looker / Mode / Hex with custom thresholds and routing. The warehouse export feeds that workflow.

ML / forecasting models. Demand forecasting, budget allocation optimization, creative-performance prediction. All of these are model-building exercises that need the underlying data, not just the dashboards. Warehouse export is the prerequisite.

Triple Whale API vs Northbeam / Hyros / Rockerbox APIs

Triple Whale's API is the most accessible of the four - REST with bearer-token auth, clear endpoints per entity, decent documentation, and predictable rate limits. Aimed at the same DTC operator audience as the product itself; you don't need an enterprise data team to wire it up.

Northbeam's API is comparable in shape but assumes a more sophisticated consumer. The data model is deeper (cohort-level segmentation, incrementality experiment results, MMM output), and the documentation assumes you know what you're doing methodologically. For enterprise analytics teams, Northbeam's API is the better surface; for marketing-team operators, Triple Whale's is friendlier.

Hyros's API is more limited - it's a real API but the surface area is smaller, primarily focused on funnel-stage events and attribution lookups rather than full warehouse export. Reflects Hyros's positioning as a tool rather than a platform.

Rockerbox's API is enterprise-shaped. Powerful but requires more setup and is typically accessed via their professional services team rather than self-serve.

Internal: triplewhale-pricing for the tier where API access is gated; triple-whale-shopify for the underlying integration.

FAQ

Frequently asked

Is the Triple Whale API free?
It's included with the Scale tier and above. The Pro tier doesn't include API access in 2026. There's no separate API pricing - it's a feature of the subscription tier, not a metered product.
What authentication does the Triple Whale API use?
Bearer token via API key. Generate the key in Settings → Integrations → API in your Triple Whale workspace. Treat the key like a database password; store in a secret manager, rotate quarterly, and use separate keys per environment.
How often can I poll the Triple Whale API?
Default rate limit is 60 requests per minute per API key. The attribution endpoint refreshes hourly upstream, so polling more often than once an hour produces the same data. Schedule hourly incremental pulls for attribution and daily pulls for orders / customers / products.
Can I push data into Triple Whale via the API?
Partially - the v2 API supports specific write endpoints for custom events and offline conversions. Most use cases for the API are reads (pull data to warehouse), not writes. For full custom-event ingestion, the dedicated integrations (Shopify, Stripe, ad platforms) are the better path.
How much historical data is available via the API?
Generally 2+ years of historical attribution and Shopify-derived data, but retention varies by subscription tier. Verify with Triple Whale support for your specific account before designing around a historical depth assumption.
Does the Triple Whale API support webhooks?
The v2 API is primarily pull-based. Limited webhook support exists for specific events. For push-based delivery, the standard pattern is to poll on a tight schedule (every 5-15 minutes for high-velocity use cases).
What data warehouses does Triple Whale recommend for the export pattern?
Snowflake, BigQuery, and Redshift are the most common destinations. The API output is JSON; any warehouse with JSON ingest support works. dbt is the most common transformation layer on top.

Related

Keep reading

Sources

Triple Whale data in warehouse. Shuttergen ships the ads.

Once your Triple Whale data is in the warehouse, Shuttergen reads your winners and generates 10 new variants tuned to your brand and your category's competitors. Close the loop.