# Venon Public API: full reference > Every endpoint with its required scope, parameters, request body and response fields, generated from the OpenAPI specification as one Markdown file for AI agents and tools that cannot run the interactive reference. - REST base URL: https://developer.venon.io - MCP server (Streamable HTTP, same API key or OAuth bearer token): https://developer.venon.io/mcp - OpenAPI 3.1 specification with complete JSON schemas: https://developerdocs.venon.io/openapi.json - Shipping profiles guide: https://developerdocs.venon.io/shipping-profiles.md The Venon Public API provides programmatic access to your advertising analytics and profit-tracking cost data. ## Start here - Order profit: use list_orders (GET /v1/orders) to find numeric Shopify IDs, then get_order_cost_breakdown (GET /v1/orders/{id}) for line costs and CM1/CM2, or list_order_cost_breakdowns (GET /v1/orders/cost-breakdowns) for a keyset export. These are order costs, not attributed channel profit. - Channel-credited order identities: use get_attributed_orders (GET /v1/attribution/orders), keeping attribution_model and attribution_window fixed. Returned amounts are full gross order totals, not fractional attributed revenue; use channel performance for credited totals. - Period shop profit: use get_profit_loss (GET /v1/analytics/profit-loss) for the period statement; get_analytics_summary for headline metrics and get_metrics_timeseries for trends. Summing order rows does not reconstruct the period statement. Do not sum statement subtotals. - SKU lookup: use lookup_products (GET /v1/products/catalog) with exact sku for catalog identity independent of sales. For sales by SKU, get_product_performance (GET /v1/products) needs level=variant and a date window. A SKU can match several variants. Check search_truncated on fuzzy q searches. - Saved-filter comparisons: consult the support matrix below. On supported reports, keep filter_mode and filter_ids, dates and attribution settings identical. Read effective data_filters and warnings before comparing. Unsupported reports do not become filtered by sending these parameters. Discover tools/list first; only granted tools may be called. ## Which report answers which question? | Question | Report/tool | Meaning and reconciliation limit | | ------------------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | | Headline shop revenue/profit? | summary / get_analytics_summary | Shop totals; displayed refunds follow refund date, stored profit follows order date. | | Period costs and contribution margin? | profit-loss / get_profit_loss | P&L Returns follows order date; this statement ends at CM3, before custom expenses. Operating profit is not returned. Do not sum subtotals. | | Which channel or ad gets credit? | channels / get_channel_performance | Weighted orders/gross revenue; model, spend scope and all_clicks can prevent reconciliation with summary. | | Which exact orders were matched? | attribution/orders / get_attributed_orders | Distinct identities with full order totals, not fractional credited amounts. | ## Saved-filter support matrix | MCP tool | REST endpoint | filter_mode / filter_ids | | ------------------------------- | ----------------------------- | ------------------------ | | get_channel_performance | GET /v1/analytics/channels | Yes | | get_campaign_performance | GET /v1/analytics/campaigns | Yes | | get_ad_set_performance | GET /v1/analytics/ad-sets | Yes | | get_ad_performance | GET /v1/analytics/ads | Yes | | get_analytics_summary | GET /v1/analytics/summary | Yes | | get_metrics_timeseries | GET /v1/analytics/timeseries | Yes | | get_attributed_orders | GET /v1/attribution/orders | Yes | | get_attributed_products | GET /v1/attribution/products | Yes | | get_non_ad_campaign_performance | GET /v1/attribution/campaigns | Yes | No saved-filter selection: list_orders, get_order_cost_breakdown, list_order_cost_breakdowns (GET /v1/orders and its breakdown routes); get_product_performance and lookup_products (GET /v1/products and /v1/products/catalog); get_profit_loss, get_cohorts, get_retention and get_product_relationships (their /v1/analytics routes). Their other named filters are separate features. Do not assume unsupported reports reproduce a filtered dashboard comparison. ## Field semantics - Gross revenue is Shopify total_price after discounts; includes VAT and customer-paid shipping, before refunds or costs. Shop reports declare shop currency. Ingestion attempts shop-money normalization; unresolved currency conversion can leave recorded amounts unconverted, so the currency label is not proof of complete conversion. - Summary/timeseries refunds are issued in the window by refund date, including refunds of older orders. Stored net revenue, contribution margins and P&L Returns use refunds of orders selected by order date. Do not subtract displayed summary refunds again from stored net revenue or profit. - tax is the raw order tax total even for VAT-ignoring shops. The current ignore_vat setting controls effective deducted tax, not raw tax; null settings are treated as false by calculations. Current settings do not certify stored economics were recomputed. - shipping_fees is merchant shipping cost resolved from shipping profiles, not customer-paid shipping revenue. Zero can mean unresolved, free or zero-priced shipping; partial resolution can retain positive fees from priced groups. - Tax deducted by the profit engine; zero when the shop ignores VAT. - Order net_revenue = gross total − effective_tax − raw refund amount. Recovered VAT is added back in CM1, not in this field; a negative refund amount increases net revenue. - CM1 = net_revenue + recovered_vat − total_cogs + recovered_cogs, equivalently (gross − refunds) − (effective_tax − recovered_vat) − (total_cogs − recovered_cogs). - CM2 = CM1 − payment fees − shipping fees. - Period CM3 = CM2 − ad spend; CM3 is unavailable per order. - Period Operating Profit = CM3 − custom expenses. - Order-level prorated COGS recovery when the global returns-COGS flag is enabled, capped at original COGS for nonnegative costs. This uses refund share, not evidence of restocking, and applies when the stored order is recomputed. - Order-level VAT recovery prorated by nonnegative refunds / gross, with a zero-gross guard; zero when the shop ignores VAT. This is a CM1 add-back. - Missing COGS, payment fees and shipping fees commonly default to zero. A zero does not prove all costs were configured; preserve null as a distinct unavailable value. Partial shipping resolution can retain positive fees from priced groups. - Per-unit live resolved COGS: variant rule > product rule > current Shopify variant cost > current global fallback. Unresolved live line cost is null, while stored order COGS can default to zero. Venon rule periods use the order’s shop-local date; Shopify/global fallback values also apply to older orders. Multiply by quantity for line cost. - Catalog and live line detail reflect their read sources; stored enriched summaries require recomputation, so sum(line cost × quantity) can differ from total_cogs. The current model’s default three-day CDC arrival lookback is not an order-age cutoff: older edits can trigger rebuilds; out-of-window cases use the existing cost-settings backfill path. No freshness SLA is implied. metadata.timestamp is response time, not source freshness. - Read each amount with its field-specific currency: an object’s currency or \*\_currency field can override shop currency. For example, budget_currency is the ad account's currency. shipping_profile_currency describes a representative profile, not every priced group in a combined shipping fee. Do not assume unlike currencies were converted or can be added. - Units are field-specific. Retention pct_repeat_purchasers and contribution_margin_pct are fractions: 0.5 means 50%. Non-ad profit_margin_pct, P&L percent and cohort active_customers_percentage are percentage points: 50 means 50%. Order net_margin is CM2 / net_revenue × 100; product margin_pct is margin / gross line revenue × 100. P&L Returns uses gross revenue; other percentage-bearing rows and waterfall pct use net revenue. Read each field’s base. - Reporting dates and Venon rule periods use shop-local calendar days. Order-detail timestamps are UTC YYYY-MM-DD HH:MM:SS.ffffff, with six fractional digits and no Z suffix. Attributed-order order_timestamp is instead shop-local wall-clock time without an offset; do not parse it as UTC. - Worked order: gross 120, effective tax 20, refund 30, COGS 40, recovered COGS 10, recovered VAT 5, payment fees 4 and shipping fees 6 give net revenue 70, CM1 45, CM2 35, net margin 50% and break-even ROAS 2. Returns 30/120 = 25%; CM1 45/70 ≈ 64.2857%, using different bases. If 50 is also refunded now for an older order, summary shows refund-date refunds 80, but this window’s order net revenue remains 70, not 120−20−80. - attributed_orders = SUM(attribution_weight), so credit can be fractional. attributed_revenue weights full gross order totals before refunds. Channel/ad net_profit = attributed CM2 − entity spend; non-ad net_profit = attributed CM2. Neither is shop operating profit. Channel/ad ROAS is zero without spend, while summary ratios can be null. Totals sum rows and recompute ratios; all_clicks can count one order in several channels. - Spend buckets use shop-local time and explicit conversion to shop currency. Recent spend can change as sources refetch; today is partial. Meta/Google hourly ingestion is bounded by source-specific rolling lookbacks (currently up to seven dates), not a universal freshness or rebuild SLA. - Reports read synced orders; universal inclusion or exclusion of cancelled/test orders is not guaranteed. Order staging filters usable timestamps and shops; ingestion paths differ, so do not infer these exclusions from a report total. Use the period profit-and-loss statement for shop profit; summing order rows does not reconstruct it. ## Authentication All endpoints (except /v1/health) require API key authentication. You can authenticate using either: 1. **Bearer Token** (recommended): ``` Authorization: Bearer vnon_xxx... ``` 2. **X-API-Key Header**: ``` X-API-Key: vnon_xxx... ``` API keys are created and managed through the Venon Dashboard. ## Rate Limiting Limits apply per credential: **60 requests per minute** per API key for REST (ads write endpoints: **10 per minute**), and 60 per minute per API key or OAuth token for MCP. Requests without credentials, and repeated failed authentication, are limited per IP address. Responses include `RateLimit-Policy`, `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the window resets). When rate limited, you'll receive a 429 response with a `Retry-After` header (seconds). ## Scopes API keys have specific scopes that control access: - `analytics:read` - Read analytics, product performance, attribution, and insight endpoints - `orders:read` - Read orders and per-order cost breakdowns - `cost:read` - Read profit-tracking cost settings: COGS, shipping, and payment fees - `cost:write` - Create and update profit-tracking cost settings - `ads:write` - Activate/pause campaigns, ad sets, and ads, and update campaign / ad-set daily budgets (Meta + Google) - `filters:read` - Read saved data filters (applying them to a report needs only that report's scope) - `filters:write` - Create, update and delete saved data filters ## Response Format All responses follow a consistent structure: **Success:** ```json { "success": true, "data": { ... }, "metadata": { "request_id": "req_xxx", "timestamp": "2025-04-15T12:00:00.000Z" } } ``` **Error:** ```json { "success": false, "error": { "code": "ERROR_CODE", "message": "Human-readable message", "details": [{ "field": "...", "message": "..." }] }, "metadata": { ... } } ``` ## Choosing an Endpoint Use the shop summary for headline profit, timeseries for trends, and profit-loss for a statement. Use channel/campaign/ad performance for attributed marketing results, and attribution drill-downs for the matching orders or products. Use the product catalog to resolve identities before a product/variant cost write; product performance only answers sales questions for a date window. Cost writes configure Venon's profit calculations. Ads writes change the connected ad platform immediately. A read-before-write workflow needs the relevant read scope as well as the write scope. ## Dates, Pagination and IDs Date parameters use shop-local calendar dates; keep dates, attribution settings and filters consistent when comparing reports. Follow each endpoint's range and result limits. Cohort follow-up depth and report breakdown limits are separate from pagination. Endpoints exposing `page`/`per_page` use 1-based pages (default 50 items, maximum 100 per page). Read the returned pagination metadata and keep filters unchanged between pages. COGS rules instead use `limit`/`offset`; shipping profiles and payment-gateway lists do not use page pagination. Totals covering the full filtered set must not be added again for each page. Use IDs returned by the corresponding read operation, preserving the schema's string/number type. Display names, SKUs, product IDs, cost-history row IDs and ad-platform IDs are not interchangeable. Resolve ambiguous matches before writing. ## Interpreting Results `metadata.timestamp` is the response creation time, not the last data-sync time. Use report-specific `data_updated_at` and availability fields where provided. Preserve null metrics when a value is unavailable or its denominator is zero. Ratios and cumulative totals are not additive. A successful bulk cost response can contain failed targets; inspect its `applied` and `failed` fields. A dry-run plan performs no write and does not reserve state. Keep `metadata.request_id` when reporting an error; on a REST 429, wait for `Retry-After` before retrying. ## MCP Conventions Use each tool's input schema: REST body wrappers are not automatically MCP arguments. For example, analytics multi-ID filters are comma-separated strings in REST and arrays of strings in MCP. Successful MCP results expose `structuredContent.data` while retaining the existing text result; handler business errors use `isError: true` and `structuredContent.error`. Inspect the error rather than treating the MCP transport's HTTP success as a successful operation. ## Attribution Models - linear_paid: equal credit per paid channel, split equally across that channel’s grouped ad identities; non-paid channels get 0. An order without paid touchpoints falls back to linear_all. - linear_all: equal credit per channel (paid or not), split equally across that channel’s grouped ad identities. - first_click: full credit to the grouped ad identity with the earliest eligible tracked visit. - last_click: full credit to the grouped ad identity with the latest eligible tracked visit. - last_paid_click: full credit to the latest paid grouped ad identity. An order without paid touchpoints falls back to last_click. - all_clicks: credit 1 per touched channel, split across that channel’s grouped ad identities, so one order can count in several channels and channel totals can exceed shop revenue. Touchpoints are eligible tracked visits with a source inside the attribution window; there is no view-through credit from ad impressions. Eligibility uses raw UTC event time at or before purchase time plus the configured post-purchase tolerance. With the current default of 300 seconds, inclusive, a sourced visit at +300 seconds is eligible; at +301 seconds is ineligible. The attribution window still applies; lifetime removes only the lookback limit, not this cutoff. An order with eligible tracked visits but no eligible source in the window is credited to direct. An order with no eligible tracked visit is non_attributed when no visits are linked or all linked visits are resolved and after the cutoff. Missing or pending visit evidence can remain direct. Both direct and non_attributed keep full credit. Example: three distinct Meta ad tuples and one Google tuple under linear_all give 50% per channel, 1/6 per Meta tuple and 1/2 for Google. Under all_clicks each channel gets 1, so summing channels gives 2 orders of credit for that one order. ## Attribution Windows - `1_day`, `7_day`, `14_day`, `28_day`, `90_day`, `lifetime` When omitted, `attribution_model` defaults to `last_paid_click` and `attribution_window` to `lifetime` on every endpoint and MCP tool. The dashboard opens on all_clicks with a lifetime window and remembers each user's choice; pass the model and window shown there to reproduce its numbers. ## MCP errors MCP tool failures return isError: true with structuredContent.error.code/message and structuredContent.request_id, even when HTTP succeeds. Advertised outputSchema uses oneOf: either the unchanged success envelope with data, or an error envelope with error and request_id (optional retry_after_seconds); the two cannot be mixed. Check isError before reading data. Safe validation details and shop_context remain readable; unexpected internal and output-validation details are masked. Ad-write tool limits also carry retry_after_seconds; wait that delay before retrying. Keep request_id when reporting a failure. JSON-RPC protocol errors and HTTP authentication, origin and endpoint rate-limit failures are separate protocols with their existing error shapes. ## Endpoint index ### System - `GET /v1/health`: Health check (no authentication) ### Analytics - `GET /v1/analytics/ad-sets`: Get ad set performance metrics (`analytics:read`) - `GET /v1/analytics/ads`: Get ad performance metrics (`analytics:read`) - `GET /v1/analytics/campaigns`: Get campaign performance metrics (`analytics:read`) - `GET /v1/analytics/channels`: Get channel performance metrics (`analytics:read`) - `GET /v1/analytics/cohorts`: Get cohort analysis (`analytics:read`) - `GET /v1/analytics/product-relationships`: Get product relationships (`analytics:read`) - `GET /v1/analytics/profit-loss`: Get profit & loss statement (`analytics:read`) - `GET /v1/analytics/retention`: Get retention report (`analytics:read`) - `GET /v1/analytics/summary`: Get shop P&L summary (`analytics:read`) - `GET /v1/analytics/timeseries`: Get core-metric timeseries (`analytics:read`) ### Orders - `GET /v1/orders`: List orders (`orders:read`) - `GET /v1/orders/cost-breakdowns`: List order cost breakdowns (`orders:read`) - `GET /v1/orders/{id}`: Get an order cost breakdown (`orders:read`) ### Products - `GET /v1/products`: Get product performance (`analytics:read`) - `GET /v1/products/catalog`: Look up the product catalog (`analytics:read`) ### Attribution - `GET /v1/attribution/campaigns`: Get non-ad channel campaign performance (`analytics:read`) - `GET /v1/attribution/orders`: List attributed orders (`analytics:read` + `orders:read`) - `GET /v1/attribution/products`: List attributed products (`analytics:read`) ### Cost - `POST /v1/cost/cogs/bulk`: Bulk-set product COGS (`cost:write`) - `GET /v1/cost/cogs/global`: Get global COGS settings (`cost:read`) - `PUT /v1/cost/cogs/global`: Update global COGS settings (`cost:write`) - `GET /v1/cost/cogs/rules`: List COGS rules (`cost:read`) - `POST /v1/cost/cogs/rules`: Create a COGS rule (`cost:write`) - `POST /v1/cost/cogs/rules/bulk`: Set different COGS rules in one batch (`cost:write`) - `POST /v1/cost/cogs/rules/bulk-read`: Read selected COGS rule histories in bulk (`cost:read`) - `POST /v1/cost/cogs/rules/history`: Set the full COGS history timeline (`cost:write`) - `POST /v1/cost/cogs/rules/ops`: Apply COGS history operations (`cost:write`) - `GET /v1/cost/cogs/rules/{id}`: Get a COGS rule (`cost:read`) - `GET /v1/cost/payment-gateways`: List payment gateways (`cost:read`) - `POST /v1/cost/payment-gateways`: Upsert a payment gateway (`cost:write`) - `POST /v1/cost/payment-gateways/bulk`: Bulk-set payment fees (`cost:write`) - `POST /v1/cost/payment-gateways/history`: Set the full payment gateway fee timeline (`cost:write`) - `POST /v1/cost/payment-gateways/ops`: Apply payment gateway history operations (`cost:write`) - `GET /v1/cost/shipping-methods`: List shipping methods (`cost:read`) - `GET /v1/cost/shipping-profiles`: List shipping profiles (`cost:read`) - `POST /v1/cost/shipping-profiles`: Upsert a shipping profile (`cost:write`) - `POST /v1/cost/shipping-profiles/bucket-history`: Set the full cost timeline for one shipping bucket (`cost:write`) - `POST /v1/cost/shipping-profiles/fee-history`: Set the full timeline for one scalar shipping fee (`cost:write`) - `POST /v1/cost/shipping-profiles/tiers`: Set weight/item shipping tiers (`cost:write`) - `GET /v1/cost/shipping-profiles/{id}`: Get a shipping profile (`cost:read`) - `DELETE /v1/cost/shipping-profiles/{id}`: Delete a shipping profile (`cost:write`) - `POST /v1/cost/shipping-profiles/{id}/cost-updates`: Update multiple tier costs from an effective date, preserving history (`cost:write`) ### Ads - `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget`: Update an ad set daily budget (meta-ads only) (`ads:write`) - `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/status`: Activate or pause an ad set (`ads:write`) - `PATCH /v1/ads/{channel}/ads/{ad_id}/status`: Activate or pause an ad (`ads:write`) - `PATCH /v1/ads/{channel}/campaigns/{campaign_id}/budget`: Update a campaign daily budget (`ads:write`) - `PATCH /v1/ads/{channel}/campaigns/{campaign_id}/status`: Activate or pause a campaign (`ads:write`) ### Data Filters - `GET /v1/data-filters`: List saved data filters (`filters:read`) - `POST /v1/data-filters`: Create a saved data filter (`filters:write`) - `GET /v1/data-filters/options`: List values for filter conditions (`filters:read`) - `PUT /v1/data-filters/{id}`: Replace a saved data filter (`filters:write`) - `DELETE /v1/data-filters/{id}`: Delete a saved data filter (`filters:write`) ## Endpoints ### System System and health endpoints #### GET /v1/health Health check Returns the health status of the Public API. **Authentication:** Not required This endpoint can be used for monitoring and uptime checks. A successful health check confirms this API route responds; it does not validate your API key, connected integrations, or the freshness of analytics data. Response (success envelope `data`): - `data`: HealthResponseData - `status`: "ok" — Service health status - `version`: string — API version - `service`: string — Service identifier ### Analytics Advertising analytics, performance metrics, and shop insights (P&L, timeseries, cohorts, retention) #### GET /v1/analytics/ad-sets Get ad set performance metrics Returns performance metrics for ad sets within a date range. **Two modes:** - **By-ID** — supply `ad_set_ids` (and `channel`) to get metrics for specific ad sets. - **List** — omit `ad_set_ids` to list every ad set with spend or attributed activity in the window. Filter by `channel` (omit for all ad-spend channels), `min_spend`/`max_spend`, `active_in_range`, `status`, and `q`; sort by `sort_by`/`order`; paginate with `page`/`per_page`. List items additionally carry the parent `campaign_id`, `active`, and `budget`; the response includes a `pagination` block and `totals` over the full filtered set. **Note:** list mode is join-driven over the window — it returns every ad set with **either** ad spend **or** attributed activity (orders/revenue) in the window. Because attribution is keyed on order date and spend on spend date, an ad set can appear with `ad_spend = 0` when it converted in-window from spend that landed outside it; pass `active_in_range=true` to keep only ad sets with spend > 0. Google Ads has no ad-set level, so `/ad-sets` is empty for `google-ads`. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Keep attribution_model and attribution_window identical when comparing channels or drilling down into campaigns, orders and products; changing them changes the credited results. List mode includes entities with spend OR attributed activity, including zero-spend conversions. List-mode status is the stored lifecycle state, not historical delivery; active_in_range filters for spend in the requested window. Use pagination to fetch further pages; totals cover the full filtered set, so do not add them again for each page. Totals are plain row sums with ratios recomputed from totals. Attribution selects orders by order date; spend uses spend date. List budgets retain their own nullable budget_currency, never inferred from shop currency. Meta/Google campaign and Meta ad-set budgets are daily; no lifetime-budget field is exposed. Other platforms retain source-specific budget semantics. filter_mode applies saved data filters to this report: none (default) applies none, enabled applies the filters currently enabled in the dashboard, selected applies exactly filter_ids (enabled or not) without changing their saved state. filter_ids is required with selected and rejected otherwise; an unknown id fails the request (404), and so does a selected filter whose saved rules are no longer valid (409). Enabled mode skips such a filter and still answers, with a warning (metadata.warnings over REST, warnings over MCP). Shopify filters narrow store orders. An ad channel filter removes the excluded spend and attributed credit of that channel only; the credit is not re-attributed and store orders stay unchanged. Several filters all apply (AND). Response metadata.data_filters names the applied filters. Query parameters: - `ad_set_ids` (string): Comma-separated platform ad set IDs (max 100). Omit for list mode. - `channel` ("meta-ads" | "google-ads" | "taboola" | "tiktok-ads" | "outbrain" | "microsoft-ads" | "pinterest-ads"): Ad channel identifier. Omit to span all ad-spend channels. - `start_date` (string, required): Start date (YYYY-MM-DD) - `end_date` (string, required): End date (YYYY-MM-DD) - `attribution_model` ("linear_paid" | "linear_all" | "first_click" | "last_click" | "last_paid_click" | "all_clicks", default "last_paid_click"): Attribution model. Credit is assigned per channel, then split across its grouped ad identities; see Attribution Models in the API overview for each model. - `attribution_window` ("1_day" | "7_day" | "14_day" | "28_day" | "90_day" | "lifetime", default "lifetime"): Attribution window - `filter_mode` ("none" | "enabled" | "selected"): Saved data filters to apply: none (default), enabled or selected - `filter_ids` (string): Comma-separated saved data filter ids (max 20); only with filter_mode=selected - `include` ("creative_metrics"): creative_metrics adds Meta creative metrics to meta-ads items. - `min_spend` (number | null): Filter: minimum ad_spend in the window (inclusive) - `max_spend` (number | null): Filter: maximum ad_spend in the window (inclusive) - `active_in_range` ("true" | "false"): Filter: keep only entities with ad_spend > 0 in the window ("active in time range") - `status` ("active" | "paused" | "all", default "all"): Filter on the platform lifecycle flag (time-independent). Default `all`. - `q` (string): Case-insensitive substring match on the entity name - `sort_by` ("ad_spend" | "name" | "attributed_revenue" | "roas" | "attributed_orders", default "ad_spend"): List-mode sort field. Default `ad_spend`. - `order` ("asc" | "desc", default "desc"): List-mode sort order. Default `desc`. - `page` (integer, default 1): List-mode page number. Default 1. - `per_page` (integer, default 50): List-mode items per page (max 100). Default 50. Response (success envelope `data`): - `data`: AdSetPerformanceResponseData - `ad_sets`: AdSetPerformanceData[] — Performance data for each ad set - `ad_set_id`: string — Platform ad set ID - `ad_set_name`: string | null — Ad set name - `channel`: string — Channel identifier - `campaign_id`: string — Parent campaign platform ID (list mode) - `active`: boolean — Platform lifecycle flag (list mode) - `budget`: number | null — Ad set budget (list mode). Quoted in the AD ACCOUNT currency, which can differ from the shop currency that every other monetary field here uses. - `budget_currency`: string | null — Ad-account currency of budget (list mode); null when unknown. Never inferred from the shop currency. - `metrics`: AdMetrics - `ad_spend`: number — Ad spend of this entity in the window by spend date, converted to shop currency. - `attributed_orders`: number — SUM(attribution_weight): fractional order credit under the chosen model, not a count of distinct orders. - `attributed_revenue`: number — Weighted gross order totals (attribution_weight × Shopify total_price), before refunds. - `roas`: number — attributed_revenue / ad_spend; 0 when ad_spend is 0, not null. - `net_profit`: number — Attributed CM2 − ad_spend of this entity. Not shop operating profit and not the P&L statement. - `first_time_customer_orders`: number — Weighted credit for first orders of first-time customers. - `first_time_customer_costs`: number — Attributed product, shipping and payment costs of first orders, excluding ad spend. Loaded CAC = (ad_spend + first_time_customer_costs) / first_time_customer_orders. - `first_time_customer_revenue`: number — Weighted gross totals of first orders of first-time customers, before refunds. - `first_time_customer_roas`: number — first_time_customer_revenue / ad_spend; 0 when ad_spend is 0. - `impressions`: number - `clicks`: number - `platform_conversions`: number — Conversions reported by the ad platform itself (Meta: purchase actions; Google: the account’s configured conversion actions, which need not be purchases), using the platform’s own attribution. Only present for meta-ads and google-ads; absent for other channels. Compare with attributed_orders (Venon-attributed). - `platform_conversion_value`: number — Conversion value reported by the ad platform itself, converted to the shop currency, using the platform’s own attribution. Only present for meta-ads and google-ads; absent for other channels. Compare with attributed_revenue (Venon-attributed). - `creative_metrics`: object — Meta creative metrics; meta-ads only, with include=creative_metrics. - `totals`: PerformanceTotals — Aggregated totals across the filtered set - `impressions`: number - `clicks`: number - `ad_spend`: number — Ad spend of this entity in the window by spend date, converted to shop currency. - `attributed_orders`: number — SUM(attribution_weight): fractional order credit under the chosen model, not a count of distinct orders. - `first_time_customer_orders`: number — Weighted credit for first orders of first-time customers. - `first_time_customer_costs`: number — Attributed product, shipping and payment costs of first orders, excluding ad spend. Loaded CAC = (ad_spend + first_time_customer_costs) / first_time_customer_orders. - `attributed_revenue`: number — Weighted gross order totals (attribution_weight × Shopify total_price), before refunds. - `roas`: number — attributed_revenue / ad_spend; 0 when ad_spend is 0, not null. - `pagination`: PaginationMetadata — Pagination metadata — present in list mode only - `page`: number — Current page number - `per_page`: number — Items per page - `total_items`: number — Total number of items - `total_pages`: number — Total number of pages - `has_next`: boolean — Whether there is a next page - `has_previous`: boolean — Whether there is a previous page #### GET /v1/analytics/ads Get ad performance metrics Returns performance metrics for ads (creative-level) within a date range. **Two modes:** - **By-ID** — supply `ad_ids` (and `channel`) to get metrics for specific ads. - **List** — omit `ad_ids` to list every ad with spend or attributed activity in the window. Filter by `channel` (omit for all ad-spend channels), `min_spend`/`max_spend`, `active_in_range`, `status`, and `q`; sort by `sort_by`/`order`; paginate with `page`/`per_page`. List items additionally carry the parent `campaign_id` and `ad_set_id` plus `active`; the response includes a `pagination` block and `totals` over the full filtered set. **Note:** list mode is join-driven over the window — it returns every ad with **either** ad spend **or** attributed activity (orders/revenue) in the window. Because attribution is keyed on order date and spend on spend date, an ad can appear with `ad_spend = 0` when it converted in-window from spend that landed outside it; pass `active_in_range=true` to keep only ads with spend > 0. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `ad_ids` (string): Comma-separated platform ad IDs (max 100). Omit for list mode. - `channel`: as under `GET /v1/analytics/ad-sets` - `start_date` (required): as under `GET /v1/analytics/ad-sets` - `end_date` (required): as under `GET /v1/analytics/ad-sets` - `attribution_model`: as under `GET /v1/analytics/ad-sets` - `attribution_window`: as under `GET /v1/analytics/ad-sets` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` - `include`: as under `GET /v1/analytics/ad-sets` - `min_spend`: as under `GET /v1/analytics/ad-sets` - `max_spend`: as under `GET /v1/analytics/ad-sets` - `active_in_range`: as under `GET /v1/analytics/ad-sets` - `status`: as under `GET /v1/analytics/ad-sets` - `q`: as under `GET /v1/analytics/ad-sets` - `sort_by`: as under `GET /v1/analytics/ad-sets` - `order`: as under `GET /v1/analytics/ad-sets` - `page`: as under `GET /v1/analytics/ad-sets` - `per_page`: as under `GET /v1/analytics/ad-sets` Response (success envelope `data`): - `data`: AdPerformanceResponseData - `ads`: AdPerformanceData[] — Performance data for each ad - `ad_id`: string — Platform ad ID - `ad_name`: string | null — Ad name - `channel`: string — Channel identifier - `campaign_id`: string — Parent campaign platform ID (list mode) - `ad_set_id`: string — Parent ad-set platform ID (list mode) - `active`: boolean — Platform lifecycle flag (list mode) - `metrics`: AdMetrics (fields as under `GET /v1/analytics/ad-sets`) - `totals`: PerformanceTotals — Aggregated totals across the filtered set (fields as under `GET /v1/analytics/ad-sets`) - `pagination`: PaginationMetadata — Pagination metadata — present in list mode only (fields as under `GET /v1/analytics/ad-sets`) #### GET /v1/analytics/campaigns Get campaign performance metrics Returns performance metrics for campaigns within a date range. **Two modes:** - **By-ID** — supply `campaign_ids` (and `channel`) to get metrics for specific campaigns. - **List** — omit `campaign_ids` to list every campaign with spend or attributed activity in the window. Filter by `channel` (omit for all ad-spend channels), `min_spend`/`max_spend`, `active_in_range`, `status`, and `q`; sort by `sort_by`/`order`; paginate with `page`/`per_page`. List items additionally carry `active` and `budget`; the response includes a `pagination` block and `totals` over the full filtered set. **Note:** list mode is join-driven over the window — it returns every campaign with **either** ad spend **or** attributed activity (orders/revenue) in the window. Because attribution is keyed on order date and spend on spend date, a campaign can appear with `ad_spend = 0` when it converted in-window from spend that landed outside it; pass `active_in_range=true` to keep only campaigns with spend > 0. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `campaign_ids` (string): Comma-separated platform ad campaign IDs (max 100). Omit for list mode. - `channel`: as under `GET /v1/analytics/ad-sets` - `start_date` (required): as under `GET /v1/analytics/ad-sets` - `end_date` (required): as under `GET /v1/analytics/ad-sets` - `attribution_model`: as under `GET /v1/analytics/ad-sets` - `attribution_window`: as under `GET /v1/analytics/ad-sets` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` - `include`: as under `GET /v1/analytics/ad-sets` - `min_spend`: as under `GET /v1/analytics/ad-sets` - `max_spend`: as under `GET /v1/analytics/ad-sets` - `active_in_range`: as under `GET /v1/analytics/ad-sets` - `status`: as under `GET /v1/analytics/ad-sets` - `q`: as under `GET /v1/analytics/ad-sets` - `sort_by`: as under `GET /v1/analytics/ad-sets` - `order`: as under `GET /v1/analytics/ad-sets` - `page`: as under `GET /v1/analytics/ad-sets` - `per_page`: as under `GET /v1/analytics/ad-sets` Response (success envelope `data`): - `data`: CampaignPerformanceResponseData - `campaigns`: CampaignPerformanceData[] — Performance data for each campaign - `campaign_id`: string — Platform ad campaign ID - `campaign_name`: string | null — Campaign name - `channel`: string — Channel identifier - `active`: boolean — Platform lifecycle flag (list mode) - `budget`: number | null — Campaign budget (list mode). Quoted in the AD ACCOUNT currency, which can differ from the shop currency that every other monetary field here uses. - `budget_currency`: string | null — Ad-account currency of budget (list mode); null when unknown. Never inferred from the shop currency. - `metrics`: AdMetrics (fields as under `GET /v1/analytics/ad-sets`) - `totals`: PerformanceTotals — Aggregated totals across the filtered set (fields as under `GET /v1/analytics/ad-sets`) - `pagination`: PaginationMetadata — Pagination metadata — present in list mode only (fields as under `GET /v1/analytics/ad-sets`) #### GET /v1/analytics/channels Get channel performance metrics Returns performance metrics for all or specified channels within a date range. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Keep attribution_model and attribution_window identical when comparing channels or drilling down into campaigns, orders and products; changing them changes the credited results. Use this report for attributed channel comparisons and the shop summary for blended shop-wide performance. Channel totals are plain row sums (including non_attributed when selected) and ratios are recomputed from totals. all_clicks can over-count orders/revenue across channels; do not promise equality with summary. Channels include paid ad channels (meta-ads, google-ads, …) and non-paid ones: organic (dashboard "Search / Social Media"), direct ("Direct Traffic"), email such as klaviyo, and others; non-paid channels report ad_spend 0 and ROAS 0. (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `channels` (string): Comma-separated channel identifiers — paid (meta-ads, google-ads, …) or non-paid (organic, direct, klaviyo, …). Omit for all channels. - `start_date` (required): as under `GET /v1/analytics/ad-sets` - `end_date` (required): as under `GET /v1/analytics/ad-sets` - `attribution_model`: as under `GET /v1/analytics/ad-sets` - `attribution_window`: as under `GET /v1/analytics/ad-sets` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` Response (success envelope `data`): - `data`: ChannelPerformanceResponseData - `channels`: ChannelPerformanceData[] — Performance data for each channel - `channel`: string — Channel identifier - `metrics`: ChannelMetrics — Channel performance metrics - `ad_spend`: number — Ad spend of this entity in the window by spend date, converted to shop currency. - `attributed_orders`: number — SUM(attribution_weight): fractional order credit under the chosen model, not a count of distinct orders. - `attributed_revenue`: number — Weighted gross order totals (attribution_weight × Shopify total_price), before refunds. - `roas`: number — attributed_revenue / ad_spend; 0 when ad_spend is 0, not null. - `net_profit`: number — Attributed CM2 − ad_spend of this entity. Not shop operating profit and not the P&L statement. - `first_time_customer_orders`: number — Weighted credit for first orders of first-time customers. - `first_time_customer_costs`: number — Attributed product, shipping and payment costs of first orders, excluding ad spend. Loaded CAC = (ad_spend + first_time_customer_costs) / first_time_customer_orders. - `first_time_customer_revenue`: number — Weighted gross totals of first orders of first-time customers, before refunds. - `first_time_customer_roas`: number — first_time_customer_revenue / ad_spend; 0 when ad_spend is 0. - `totals`: ChannelTotals — Aggregated totals across all channels - `ad_spend`: number — Ad spend of this entity in the window by spend date, converted to shop currency. - `attributed_orders`: number — SUM(attribution_weight): fractional order credit under the chosen model, not a count of distinct orders. - `first_time_customer_orders`: number — Weighted credit for first orders of first-time customers. - `first_time_customer_costs`: number — Attributed product, shipping and payment costs of first orders, excluding ad spend. Loaded CAC = (ad_spend + first_time_customer_costs) / first_time_customer_orders. - `attributed_revenue`: number — Weighted gross order totals (attribution_weight × Shopify total_price), before refunds. - `roas`: number — attributed_revenue / ad_spend; 0 when ad_spend is 0, not null. #### GET /v1/analytics/cohorts Get cohort analysis Cohort retention matrix: customers grouped by acquisition week/month/quarter/year, with per-period incremental and cumulative metrics — active customers, retention %, orders, net revenue, CM1/CM3, AOV, LTV-to-date, LTV:CAC ratios, and payback flag — plus cohort size, ad spend, and CAC per cohort. Optionally filter to customers whose first order contained a specific product/variant. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key The date window selects acquisition cohorts. max_periods controls follow-up depth, not pagination. Compare cohorts at the same elapsed period; a recent cohort has less observed history. active_customers_percentage uses percentage points: 50 means 50% of the cohort. Cumulative metrics already include earlier periods and must not be summed. Query parameters: - `start_date` (string, required): First cohort start date (YYYY-MM-DD) - `end_date` (string): Last cohort end date (YYYY-MM-DD). Defaults to today. - `cohort_type` ("week" | "month" | "quarter" | "year", required): Cohort bucketing period - `max_periods` (integer): Retention periods per cohort (defaults per cohort_type) - `filter_product_id` (integer | null): Only cohorts whose first order contained this product - `filter_variant_id` (integer | null): Only cohorts whose first order contained this variant Response (success envelope `data`): - `data`: CohortsResponseData - `cohorts`: CohortData[] - `cohort`: string — Cohort start date (YYYY-MM-DD) - `cohort_size`: number — Customers acquired in the cohort period - `cohort_ad_spend`: number — Ad spend during the cohort period - `cac_per_customer`: number - `periods`: object[] - `period`: number — Periods since acquisition (0 = cohort period itself) - `metrics`: object - `cohort_type`: string - `max_periods`: number - `currency`: string — Shop currency code #### GET /v1/analytics/product-relationships Get product relationships Cross-sell and repurchase relationships between products: which products are bought together in one order, what customers buy next, and per-product stats (customers, orders, units, repurchase rate, first-order vs repeat-order share) with related-product breakdowns. The underlying data is rebuilt daily — see `data_updated_at`. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key product_limit, related_limit and top_limit cap different result lists; these are not page sizes for traversing the complete catalog. Check data_updated_at for freshness. These relationships describe observed purchases and do not establish that one product caused another sale. Query parameters: - `start_date` (string, required): Start date (YYYY-MM-DD, shop-local) - `end_date` (string): End date (YYYY-MM-DD). Defaults to today. - `product_limit` (integer): Anchor products returned, highest customer count first - `related_limit` (integer): Related products per anchor - `top_limit` (integer): Rows in the top-bought-together / top-buy-next lists Response (success envelope `data`): - `data`: ProductRelationshipsResponseData - `top_bought_together`: object[] - `product_a_id`: string - `product_a`: string - `product_b_id`: string - `product_b`: string - `order_count`: number — Orders containing both products - `pair_rate`: number — order_count / product A's orders - `top_buy_next`: object[] - `first_product_id`: string - `first_product`: string - `next_product_id`: string - `next_product`: string - `customer_count`: number — Customers whose next order contained the next product - `next_rate`: number — customer_count / first product's customers - `products`: object[] - `product_id`: string - `product_name`: string - `image_url`: string - `customers`: number - `orders`: number - `total_units_sold`: number - `avg_units_per_customer`: number - `repurchase_rate`: number - `first_order_rate`: number - `repeat_order_rate`: number - `related_products`: object[] - `product_id`: string - `product_name`: string - `same_order_count`: number — Orders containing both products - `same_order_rate`: number - `first_order_together_count`: number - `first_order_together_rate`: number - `bought_directly_after_count`: number - `bought_directly_after_rate`: number - `bought_after_count`: number - `bought_after_rate`: number - `same_customer_count`: number - `same_customer_rate`: number - `data_updated_at`: string | null — When the relationships were last rebuilt (daily job) - `currency`: string #### GET /v1/analytics/profit-loss Get profit & loss statement Profit & loss statement for a date window as ordered rows (gross revenue, deductions, and subtotals through CM3 — each with its value and field-specific percentage base) plus waterfall-chart steps. This is the same P&L statement the merchant sees on the dashboard. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Use the ordered rows for a statement or waterfall. Subtotal rows already include earlier components; summing every row would count the same amounts more than once. CM1–CM3 retain their contribution definitions. Returns uses order-date refunds; its percent divides by gross revenue. Other percentage-bearing rows divide by net revenue. Operating Profit is CM3 less Custom Expenses. Preserve null when costs or percentage bases are incomplete; known_custom_expenses is only the calculable portion. Completeness flags do not certify CDC freshness. Period CM3 = CM2 − ad spend; CM3 is unavailable per order. Period Operating Profit = CM3 − custom expenses. Query parameters: - `start_date` (required): as under `GET /v1/analytics/product-relationships` - `end_date` (string, required): End date (YYYY-MM-DD, shop-local) Response (success envelope `data`): - `data`: ProfitLossResponseData - `custom_expenses`: number | null — Signed shop-currency custom costs; null when calculation is incomplete - `known_custom_expenses`: number — Known portion of custom costs; may be partial - `operating_profit`: number | null — CM3 less custom costs; null when costs or percentage bases are incomplete - `custom_expense_status`: object - `missing_shop_settings`: boolean - `incomplete_ad_currency`: number - `invalid_base_rows`: number - `null_base_rows`: number - `calculation_complete`: boolean - `base_observation_complete`: boolean - `missing_fx`: boolean - `max_fx_rate_age_days`: number | null - `rows`: ProfitLossRow[] — P&L statement rows, top to bottom - `key`: string — Stable row identifier (e.g. gross_revenue, cm1) - `label`: string — Human-readable row label - `kind`: "currency" | "number" — Value unit - `emphasis`: "subtotal" — Present on subtotal rows - `muted`: boolean - `inverted`: boolean — True when the value is a deduction - `value`: number | null - `percent`: number | null — Percentage points: returns use gross revenue; taxes, COGS, fees and CM subtotals use net revenue. Null when the numerator or denominator is unavailable, or the denominator is zero. - `waterfall`: object | null — Waterfall chart data (null when the statement is empty) - `steps`: ProfitLossWaterfallStep[] - `key`: string - `label`: string - `type`: "subtotal" | "cost" - `value`: number - `from`: number - `to`: number - `pct`: number | null - `max`: number #### GET /v1/analytics/retention Get retention report Retention report for customers acquired in the window: CLV, repeat-purchase rate, days to second purchase, CLV:CAC, new vs returning AOV, order-gap distribution, expected-next-order timing (winback / at-risk / lost thresholds), channel-level retention, repurchase windows, LTV by first product, and period LTV (90/180/365 days). `metadata.availability` flags sections with insufficient data. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Check the report metadata.availability, including reasons and sample sizes, before drawing conclusions. pct_repeat_purchasers and contribution_margin_pct are fractions (0.5 means 50%). Missing or null metrics are not evidence of zero retention. Keep refund_attribution consistent across comparisons; product_limit and channel_limit cap breakdown sizes, not pages. Query parameters: - `start_date` (required): as under `GET /v1/analytics/product-relationships` - `end_date` (required): as under `GET /v1/analytics/profit-loss` - `refund_attribution` ("refund_date" | "order_date" | "ignore_refunds", default "refund_date"): How refunds are assigned to periods - `product_limit` (integer, default 50): Max products in the LTV-by-first-product section - `channel_limit` (integer, default 20): Max channels in the channel breakdown Response (success envelope `data`): - `data`: RetentionResponseData - `metadata`: object - `start_date`: string - `end_date`: string - `currency`: string - `timezone`: string - `refund_attribution`: "refund_date" | "order_date" | "ignore_refunds" - `data_updated_at`: string | null - `availability`: object - `limits`: object - `product_limit`: number - `channel_limit`: number - `kpis`: object - `avg_clv`: number | null — Average customer lifetime value - `pct_repeat_purchasers`: number | null — Fraction of cohort customers who ordered again: 0.5 means 50% - `avg_days_to_second_purchase`: number | null - `clv_to_cac_ratio`: number | null - `avg_days_between_orders`: number | null - `new_customer_aov`: number | null - `returning_customer_aov`: number | null - `avg_orders_per_customer`: number | null - `avg_products_per_order`: number | null - `avg_contribution_profit`: number | null - `avg_net_profit`: number | null - `contribution_margin_pct`: number | null — Fraction CM2 / net revenue: 0.5 means 50% - `avg_cm_per_order`: number | null - `paid_new_customer_cac`: number | null - `clv_cac_trend`: object[] - `period_label`: string - `clv`: number | null - `cac`: number | null - `clv_to_cac`: number | null - `expected_next_order`: object | null - `avg_days_to_second_purchase`: number - `avg_days_between_orders`: number - `winback_start_days`: number - `at_risk_days`: number - `lost_days`: number - `sample_size`: number - `method`: string - `aov_timeseries`: object[] - `date`: string - `new_aov`: number | null - `returning_aov`: number | null - `order_gap_distribution`: object[] - `from_order`: number - `to_order`: number - `avg_days`: number - `sample_size`: number - `channel_breakdown`: object[] - `channel`: string - `customer_count`: number - `new_customer_aov`: number | null - `repeat_rate`: number | null - `avg_days_to_second_purchase`: number | null - `paid_new_customer_cac`: number | null - `cm3_per_customer`: number | null - `is_paid`: boolean | null - `repurchase_windows`: object[] - `window_days`: number - `pct_customers`: number | null - `mature_customer_count`: number - `repeat_customer_count`: number - `ltv_by_first_product`: object[] - `product_id`: string - `product_name`: string - `image_url`: string - `first_purchase_customers`: number - `ltv_90d`: number | null - `ltv_180d`: number | null - `ltv_365d`: number | null - `repeat_rate`: number | null - `net_ltv_90d`: number | null - `net_ltv_180d`: number | null - `net_ltv_365d`: number | null - `contribution_margin_pct`: number | null — Fraction of 365-day CM2 over 365-day revenue: 0.5 means 50% - `mature_customers`: object - `days_90`: number - `days_180`: number - `days_365`: number - `period_ltv`: object[] - `window_days`: number - `ltv`: number | null - `cumulative_revenue`: number | null - `profit_ltv`: number | null - `cumulative_profit`: number | null - `mature_customer_count`: number #### GET /v1/analytics/summary Get shop P&L summary Shop-wide P&L summary for a date window: orders, gross/net revenue, refunds, raw tax and the current ignore_vat setting, COGS, payment fees, shipping fees, ad spend, the contribution-margin ladder (CM1, CM2 and CM3), blended ROAS/MER (gross revenue ÷ ad spend), POAS (CM2 ÷ ad spend), AOV, new customers, new-customer revenue, and CAC. Figures are shop-wide absolutes — no attribution model applies. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Use this single aggregate for a headline shop report. Null ratios mean the denominator does not support a value; preserve null instead of displaying zero performance. Gross revenue is Shopify total_price after discounts; includes VAT and customer-paid shipping, before refunds or costs. Shop reports declare shop currency. Ingestion attempts shop-money normalization; unresolved currency conversion can leave recorded amounts unconverted, so the currency label is not proof of complete conversion. Summary/timeseries refunds are issued in the window by refund date, including refunds of older orders. Stored net revenue, contribution margins and P&L Returns use refunds of orders selected by order date. Do not subtract displayed summary refunds again from stored net revenue or profit. tax is the raw order tax total even for VAT-ignoring shops. The current ignore_vat setting controls effective deducted tax, not raw tax; null settings are treated as false by calculations. Current settings do not certify stored economics were recomputed. CM1 = net_revenue + recovered_vat − total_cogs + recovered_cogs, equivalently (gross − refunds) − (effective_tax − recovered_vat) − (total_cogs − recovered_cogs). Period CM3 = CM2 − ad spend; CM3 is unavailable per order. (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `start_date` (required): as under `GET /v1/analytics/product-relationships` - `end_date` (required): as under `GET /v1/analytics/profit-loss` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` Response (success envelope `data`): - `data`: AnalyticsSummaryData - `orders`: number — Total orders in the window - `gross_revenue`: number — Shopify total_price of orders placed in the window: after discounts, including VAT and customer-paid shipping, before refunds - `refunds`: number — Refunds issued in the window by refund date, including refunds of older orders. Not the refunds inside net_revenue/CM; do not subtract it again - `net_revenue`: number — Stored order net revenue of orders placed in the window = gross − effective tax − refunds of those orders (order date). Differs from gross_revenue − tax − refunds - `tax`: number — Raw order tax total, including tax for VAT-ignoring shops. Effective deducted tax is zero when ignore_vat is true. - `ignore_vat`: boolean | null — Current saved shop VAT setting; null when missing or unknown. Calculations treat a null setting as false. This is not a historical snapshot or proof that stored order economics were rebuilt with the current setting; tax remains the raw tax total. - `cogs`: number — Cost of goods sold - `payment_fees`: number — Payment provider fees - `shipping_fees`: number — Merchant shipping cost resolved from shipping profiles, not customer-paid shipping revenue. Zero can mean unresolved, free or zero-priced; partial resolution can retain positive fees from priced groups - `ad_spend`: number — Total ad spend across all connected channels - `cm1`: number — CM1 = net_revenue + recovered VAT − COGS + recovered COGS, from stored order economics - `cm2`: number — Contribution margin 2 = CM1 − payment − shipping - `cm3`: number — Period CM3 = CM2 − ad spend. Before custom expenses: not operating profit - `roas`: number | null — Blended ROAS = gross_revenue / ad_spend; null when ad_spend is 0 - `mer`: number | null — Marketing efficiency ratio = gross_revenue / ad_spend (identical to blended ROAS here); null when ad_spend is 0 - `poas`: number | null — Profit on ad spend = CM2 / ad_spend; null when ad_spend is 0 - `aov`: number | null — Average order value = gross_revenue / orders; null when orders is 0 - `new_customers`: number — First-time customers acquired in the window - `new_customer_revenue`: number — Gross revenue of first orders by first-time customers in the window; later orders by those customers are excluded - `cac`: number | null — Customer acquisition cost = ad_spend / new_customers; null when 0 new customers #### GET /v1/analytics/timeseries Get core-metric timeseries Timeseries of core shop metrics per bucket: orders, gross revenue, refunds, COGS, ad spend, payment/shipping fees, tax, net revenue, CM1/CM2/profit (CM3), blended ROAS, new customers, new-customer revenue/ROAS, and CAC. `granularity=auto` (default) returns hourly buckets for single-day ranges and daily otherwise; `daily` forces day buckets; `weekly` re-buckets to ISO weeks (bucket timestamp = Monday). **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Choose a fixed granularity when comparing periods. Ratios such as ROAS and CAC are per-bucket values; recompute whole-period ratios from their totals instead of summing or taking an unweighted average of bucket ratios. auto uses hourly buckets for a single-day range and daily otherwise; empty buckets are omitted. Zero-denominator ROAS/new_customer_roas/CAC return zero here, unlike nullable summary ratios. new_customer_revenue covers first orders only. Summary/timeseries refunds are issued in the window by refund date, including refunds of older orders. Stored net revenue, contribution margins and P&L Returns use refunds of orders selected by order date. Do not subtract displayed summary refunds again from stored net revenue or profit. Spend buckets use shop-local time and explicit conversion to shop currency. Recent spend can change as sources refetch; today is partial. Meta/Google hourly ingestion is bounded by source-specific rolling lookbacks (currently up to seven dates), not a universal freshness or rebuild SLA. (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `start_date` (required): as under `GET /v1/analytics/product-relationships` - `end_date` (required): as under `GET /v1/analytics/profit-loss` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` - `granularity` ("auto" | "daily" | "weekly", default "auto"): Bucket size. `auto` (default) = hourly for a single-day range, daily otherwise; `daily` forces day buckets; `weekly` re-buckets to ISO weeks (bucket timestamp = Monday). Response (success envelope `data`): - `data`: MetricsTimeseriesResponseData - `timeseries`: MetricsTimeseriesPoint[] - `timestamp`: string — Bucket start (shop-local). Buckets without data are omitted, not zero-filled - `total_orders`: number - `total_revenue`: number — Gross revenue in the bucket - `total_refunds`: number — Refunds issued in the bucket by refund date, including refunds of older orders - `total_cogs`: number - `total_ad_spend`: number - `total_payment_fees`: number - `total_shipping_fees`: number — Merchant shipping cost from shipping profiles, not customer-paid shipping - `total_tax`: number — Raw order tax total, also for VAT-ignoring shops - `net_revenue`: number — Stored net revenue of orders placed in the bucket, with their own refunds (order date) - `cm1`: number - `cm2`: number - `profit`: number — CM3 = CM2 − ad spend - `roas`: number — Blended ROAS in the bucket (0 when no spend) - `new_customer_count`: number - `new_customer_revenue`: number — Gross revenue of first orders by first-time customers in the bucket - `new_customer_roas`: number — new_customer_revenue / ad spend in the bucket (0 when no spend) - `cac`: number — Ad spend / new customers in the bucket (0 when none) - `aggregation_level`: "hourly" | "daily" | "weekly" — Bucket size actually used ### Orders Orders — list with financials, and per-order cost breakdowns #### GET /v1/orders List orders Lists Shopify orders in a shop-local date window with per-order financials: gross total, tax, refunds (plus a derived `refund_status`), net revenue, CM1/CM2 contribution margins, first-order flag, customer name, payment gateway, and shipping country. Searchable by order number or customer name, sortable, and paginated. Monetary values are in the shop currency. Venon does not mirror Shopify's `financial_status`; use `refund_status` (none | partial | full, derived from refunded amounts) instead. **Required scope:** `orders:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Use the returned id for an order-detail request; the displayed name/number (for example #1001) is not that ID. Page through results using page/per_page (default 50, maximum 100). Offset pagination is not a snapshot; ties and changing rows can cause duplicates or skips. Do not treat page traversal as a stable export. For bulk cost syncing, use GET /v1/orders/cost-breakdowns or list_order_cost_breakdowns with a fixed date window and follow next_cursor. Query parameters: - `start_date` (required): as under `GET /v1/analytics/product-relationships` - `end_date` (required): as under `GET /v1/analytics/profit-loss` - `q` (string): Case-insensitive substring match on order number or customer name - `sort_by` ("date" | "total_price" | "order_number", default "date"): Sort field. Default `date` (order timestamp). - `order` ("asc" | "desc", default "desc"): Sort order. Default `desc`. - `page` (integer, default 1): Page number. Default 1. - `per_page` (integer, default 50): Items per page (max 100). Default 50. Response (success envelope `data`): - `data`: OrdersListResponseData - `orders`: OrderSummaryData[] — Orders in the requested window - `id`: string — Shopify order ID - `order_number`: string | null — Shopify order name/number (e.g. "#1001") - `order_timestamp`: string | null — Order creation timestamp (UTC YYYY-MM-DD HH:MM:SS.ffffff, six fractional digits, no Z) - `total_price`: number | null — Gross order total (shop currency) - `total_tax`: number | null — Order tax total - `total_refund_amount`: number | null — Total refunded amount - `refund_status`: "none" | "partial" | "full" — Derived refund state: none (no refund), partial (refunded < order total), full (refunded >= order total). Venon does not mirror Shopify financial_status. - `net_revenue`: number | null — Order net_revenue = gross total − effective_tax − raw refund amount. Recovered VAT is added back in CM1, not in this field; a negative refund amount increases net revenue. - `cm1`: number | null — CM1 = net_revenue + recovered_vat − total_cogs + recovered_cogs, equivalently (gross − refunds) − (effective_tax − recovered_vat) − (total_cogs − recovered_cogs). - `cm2`: number | null — CM2 = CM1 − payment fees − shipping fees. - `is_first_customer_order`: boolean | null — Whether this is the customer's first order in the shop - `customer_first_name`: string | null — Customer first name - `customer_last_name`: string | null — Customer last name - `payment_gateway`: string | null — Payment gateway that processed the order - `shipping_country`: string | null — Shipping country code - `pagination`: PaginationMetadata (fields as under `GET /v1/analytics/ad-sets`) #### GET /v1/orders/cost-breakdowns List order cost breakdowns Returns up to 100 full cost breakdowns, each with exactly the fields of GET /v1/orders/{id}. Dates are inclusive and shop-local; the maximum span is 366 days. Orders are sorted by UTC creation time then order ID. Pass pagination.next_cursor unchanged with the same start_date and end_date until has_more is false. next_cursor is null on the last page. There is no total count or updated_since filter. Pagination is not a snapshot: late-arriving orders or retroactive cost/catalog updates require re-reading the date window. **Required scope:** `orders:read` **Rate limit:** 60 requests per minute per API key; a page uses one request. Resolve the order ID from the order list. has_cost_data means at least one cost component resolved, not that every component is complete. Inspect unavailable_metrics and preserve nulls. unavailable_metrics currently lists the CM3 limitation only, not every missing cost. Line costs are per unit; use quantity when comparing them with the order-level summary. Per-unit live resolved COGS: variant rule > product rule > current Shopify variant cost > current global fallback. Unresolved live line cost is null, while stored order COGS can default to zero. Venon rule periods use the order’s shop-local date; Shopify/global fallback values also apply to older orders. Multiply by quantity for line cost. CM1 = net_revenue + recovered_vat − total_cogs + recovered_cogs, equivalently (gross − refunds) − (effective_tax − recovered_vat) − (total_cogs − recovered_cogs). CM2 = CM1 − payment fees − shipping fees. Catalog and live line detail reflect their read sources; stored enriched summaries require recomputation, so sum(line cost × quantity) can differ from total_cogs. The current model’s default three-day CDC arrival lookback is not an order-age cutoff: older edits can trigger rebuilds; out-of-window cases use the existing cost-settings backfill path. No freshness SLA is implied. metadata.timestamp is response time, not source freshness. Read each amount with its field-specific currency: an object’s currency or \*\_currency field can override shop currency. For example, budget_currency is the ad account's currency. shipping_profile_currency describes a representative profile, not every priced group in a combined shipping fee. Do not assume unlike currencies were converted or can be added. Query parameters: - `start_date` (string, required): Inclusive start date (shop-local) - `end_date` (string, required): Inclusive end date (shop-local) - `limit` (integer, default 100): Orders per page (1–100). Default 100. - `cursor` (string): Opaque next_cursor from the previous page of the same date window. Response (success envelope `data`): - `data`: OrderCostBreakdownsResponseData - `orders`: OrderCostBreakdownResponseData[] - `order`: object - `id`: string — Shopify order ID - `name`: string — Shopify order name/number - `has_cost_data`: boolean — Some cost resolved or a nonzero cost/refund/recovery component exists; not a completeness check. - `line_items`: OrderCostLineItem[] - `id`: string — Line item ID - `product_id`: string | null — Shopify product ID - `variant_id`: string | null — Shopify variant ID - `title`: string — Product title (falls back to variant/line label) - `variant_title`: string | null — Variant title - `sku`: string | null — Merchant-assigned Shopify SKU (null when unset or not yet re-synced) - `image_url`: string | null — Product image URL - `quantity`: number — Quantity ordered - `sale_price`: number | null — Per-unit sale price - `product_cost`: number | null — Per-unit live resolved COGS: variant rule > product rule > current Shopify variant cost > current global fallback. Unresolved live line cost is null, while stored order COGS can default to zero. Venon rule periods use the order’s shop-local date; Shopify/global fallback values also apply to older orders. Multiply by quantity for line cost. - `product_cost_source`: string | null — Source selected by the live line-cost resolver (variant_rule, product_rule, shopify_variant, global_fallback, or none); null when unavailable. A resolved zero cost remains zero. - `product_profit`: number | null — Per-unit sale price − per-unit COGS - `summary`: OrderCostSummary - `gross_revenue`: number | null — Gross revenue is Shopify total_price after discounts; includes VAT and customer-paid shipping, before refunds or costs. Shop reports declare shop currency. Ingestion attempts shop-money normalization; unresolved currency conversion can leave recorded amounts unconverted, so the currency label is not proof of complete conversion. - `effective_tax`: number | null — Tax deducted by the profit engine; zero when the shop ignores VAT. - `net_revenue`: number | null — Order net_revenue = gross total − effective_tax − raw refund amount. Recovered VAT is added back in CM1, not in this field; a negative refund amount increases net revenue. - `total_cogs`: number | null — Stored total COGS; unresolved costs can default to zero. - `payment_fees`: number | null — Stored payment provider fees; missing fees can default to zero. - `shipping_fees`: number | null — Stored sum of shipping fees from priced profile groups; unpriced groups contribute zero. Groups can use different profile currencies; the representative profile currency does not prove the combined total is in one currency or was converted. - `shipping_resolution_status`: string | null — Stored order-wide shipping resolution status from the same enriched row as shipping_fees (for example resolved, no_profile, partially_resolved); null when unavailable. Partially resolved orders can have positive fees from priced groups. The representative profile does not determine this status. - `shipping_profile`: string | null — One representative shipping profile; the total fee can combine several groups. - `shipping_profile_currency`: string | null — Currency of the representative shipping profile; it can differ from shop currency and does not establish every group’s currency in the total shipping fee. Null when no profile resolved. No conversion is guaranteed. - `total_refund_amount`: number | null — Total refunded amount - `recovered_cogs`: number | null — Order-level prorated COGS recovery when the global returns-COGS flag is enabled, capped at original COGS for nonnegative costs. This uses refund share, not evidence of restocking, and applies when the stored order is recomputed. - `recovered_vat`: number | null — Order-level VAT recovery prorated by nonnegative refunds / gross, with a zero-gross guard; zero when the shop ignores VAT. This is a CM1 add-back. - `cm1`: number | null — CM1 = net_revenue + recovered_vat − total_cogs + recovered_cogs, equivalently (gross − refunds) − (effective_tax − recovered_vat) − (total_cogs − recovered_cogs). - `cm2`: number | null — CM2 = CM1 − payment fees − shipping fees. - `net_margin`: number | null — CM2 / net revenue × 100 in percentage points; null when net revenue is zero/unavailable or CM2 is unavailable. - `break_even_roas`: number | null — Net revenue / CM2; null when CM2 <= 0, CM2 is unavailable, or net revenue is zero/unavailable. Null does not by itself mean cost data is missing. - `cm3`: null — Period CM3 = CM2 − ad spend; CM3 is unavailable per order. - `unavailable_metrics`: string[] — Currently describes the per-order CM3 limitation only; not an inventory of missing costs. - `pagination`: object - `limit`: integer - `has_more`: boolean - `next_cursor`: string | null — Pass unchanged with the same dates; null on the last page. #### GET /v1/orders/{id} Get an order cost breakdown Returns the full cost breakdown of a single order: every line item with its resolved per-unit COGS (variant rule > product rule > Shopify variant cost > global fallback, dated Venon rules and current fallbacks) and per-unit profit, plus an order-level summary — gross/net revenue, effective tax, COGS, payment fees, shipping fees with one representative shipping profile, refunds, recovered COGS/VAT, CM1, CM2, net margin, and break-even ROAS. **Required scope:** `orders:read` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/orders/cost-breakdowns`.) Path parameters: - `id` (integer, required): Shopify order ID (numeric) Response (success envelope `data`): - `data`: OrderCostBreakdownResponseData (fields as under `GET /v1/orders/cost-breakdowns`) ### Products Product performance — units, revenue, COGS, and margin per product/variant #### GET /v1/products Get product performance Sales performance per product — or per variant with `level=variant` — over a shop-local date window: units sold, distinct orders, gross line-item revenue (unit price × quantity, before order-level discounts/tax/refunds), resolved COGS, margin, and margin %. Variant rows carry the merchant `sku`, and `q` matches SKUs too — this endpoint doubles as the SKU ↔ variant-ID lookup for integrations. Filterable by name, sortable, and paginated; `totals` aggregates the full filtered set. Product status (including ACTIVE/UNLISTED) is not exposed or filterable here. Do not infer status from catalog presence, sales, or soft-deletion filtering. If a task requires status-based selection, obtain an explicit product/variant selection from the user or another authorized source. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. SKU search requires level=variant; product-level q searches product names only. Product margin is gross line revenue minus COGS, before order discounts, tax, refunds and fees; it is not order CM1. Product performance currently parses raw rule dates differently from order breakdowns; CDC integer day encodings can leave rules unmatched. Do not assume identical resolved costs. Shopify variant cost/global fallback are current values, including for older orders; unresolved lines contribute zero and completeness is unknown. Use product-level rows to compare products and variant-level rows for SKU-level analysis. Sales in this window do not establish current catalog availability. totals cover the full filtered result, not just the current page. Query parameters: - `start_date` (required): as under `GET /v1/analytics/product-relationships` - `end_date` (required): as under `GET /v1/analytics/profit-loss` - `level` ("product" | "variant", default "product"): Aggregation level: one row per product (default) or per variant. - `q` (string): Case-insensitive substring match on product name; variant title/SKU requires level=variant - `sort_by` ("gross_revenue" | "units" | "orders" | "cogs" | "margin" | "name", default "gross_revenue"): Sort field. Default `gross_revenue`. - `order`: as under `GET /v1/orders` - `page`: as under `GET /v1/orders` - `per_page`: as under `GET /v1/orders` Response (success envelope `data`): - `data`: ProductPerformanceResponseData - `products`: ProductPerformanceData[] - `product_id`: string | null — Shopify product ID (null if unresolvable) - `product_name`: string | null — Product name - `variant_id`: string | null — Shopify variant ID (present when level=variant) - `variant_title`: string | null — Variant title (present when level=variant) - `sku`: string | null — Merchant-assigned SKU from Shopify (present when level=variant; null when the merchant left it empty or the variant hasn't re-synced since SKU support shipped) - `units`: number — Units sold in the window - `orders`: number — Distinct orders containing this product/variant - `gross_revenue`: number — Gross line-item revenue (unit price × quantity) - `cogs`: number — Total resolved COGS; unresolved lines contribute zero, so completeness is unknown. Raw rule dates use the product-report parser; current Shopify/global fallbacks also apply to older orders. - `margin`: number — Gross line revenue − COGS, before order discounts, tax, refunds and fees; not order CM1 - `margin_pct`: number | null — margin / gross_revenue × 100 in percentage points; null when gross revenue <= 0 - `totals`: ProductPerformanceTotals — Totals over the full filtered set - `units`: number - `gross_revenue`: number - `cogs`: number - `margin`: number - `pagination`: PaginationMetadata (fields as under `GET /v1/analytics/ad-sets`) #### GET /v1/products/catalog Look up the product catalog Reads the shop catalog independent of sales, within the scan limits below, with variant IDs, titles, merchant SKUs, and prices. This is the resolution surface for turning a SKU or product name into the `product_id` / `variant_id` the other endpoints accept (e.g. before writing a COGS rule): `sku` filters to an exact SKU match, `q` does a fuzzy search over product names, variant titles, and SKUs. Soft-deleted variants are excluded. For sales metrics use `GET /v1/products` instead. (Same note as under `GET /v1/products`.) **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Pagination counts products, each with a nested variants array; a page is not a flat list of variants. Fuzzy q searches at most 1000 name-ordered active product candidates: search_truncated is true when candidates remain, even for zero matches or later pages. Counts/pages then describe only matches in the scanned set; an empty result is not proof of no match. Browse and exact sku return false for this product-scan flag. Nested variant reads retain their existing 1000-row cap per 200-product batch; false does not certify every variant was returned. Follow pagination metadata to inspect returned matches. A SKU can identify multiple variants: resolve the intended product/variant ID before making cost changes. Query parameters: - `q` (string): Case-insensitive substring match on product name, variant title, or SKU - `sku` (string): Exact SKU match (returns every variant carrying this SKU) - `page`: as under `GET /v1/orders` - `per_page` (integer, default 50): Products per page (max 100). Default 50. Response (success envelope `data`): - `data`: ProductCatalogResponseData - `products`: CatalogProduct[] - `product_id`: string — Shopify product ID - `product_name`: string — Product name - `product_type`: string | null — Shopify product type - `variants`: CatalogVariant[] - `variant_id`: string — Shopify variant ID - `variant_title`: string | null — Variant title - `sku`: string | null — Merchant-assigned Shopify SKU (null when unset or not yet re-synced) - `price`: number | null — Variant price - `search_truncated`: boolean — True when q searched only part of the active product candidates (currently at most 1000, name-ordered). Pagination totals then cover matches in that scan only, even when zero. False for browse/exact SKU; this flag does not certify nested variant completeness. - `pagination`: PaginationMetadata (fields as under `GET /v1/analytics/ad-sets`) ### Attribution Attribution drill-downs — orders and products a channel/campaign drove, non-ad campaign performance #### GET /v1/attribution/campaigns Get non-ad channel campaign performance Campaign-level attributed performance for a NON-ad channel (email, organic, direct, referral, …): attributed orders and revenue, COGS, payment fees, tax, net profit, profit margin %, AOV, and first-time-customer metrics per campaign (campaign names come from tracking parameters). For paid ad channels use `GET /v1/analytics/campaigns` instead — this endpoint rejects them with 400. **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Keep attribution_model and attribution_window identical when comparing channels or drilling down into campaigns, orders and products; changing them changes the credited results. A campaign here is a tracking campaign name, not an ad-platform campaign ID. Discover the channel from channel performance and keep its exact identifier when requesting this breakdown. gross_revenue here means attributed gross minus effective attributed tax (raw tax is not deducted when ignore_vat is true). net_profit is attributed CM2, and profit_margin_pct is net_profit / attributed_revenue × 100, zero when attributed_revenue is not positive. (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `channel` (string, required): Non-ad channel identifier (e.g. organic, email, direct, referral). For paid ad channels use GET /v1/analytics/campaigns instead. - `start_date` (string, required): Start date (YYYY-MM-DD; orders are selected by order date) - `end_date` (required): as under `GET /v1/analytics/ad-sets` - `attribution_model`: as under `GET /v1/analytics/ad-sets` - `attribution_window`: as under `GET /v1/analytics/ad-sets` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` Response (success envelope `data`): - `data`: NonAdCampaignsResponseData - `campaigns`: NonAdCampaign[] — Campaign-level attributed performance - `channel`: string - `campaign`: string | null — Campaign name from tracking parameters (null = no campaign tag) - `attributed_orders`: number — SUM(attribution_weight): fractional order credit - `attributed_revenue`: number — Weighted gross order totals (Shopify total_price), before refunds - `distinct_orders_touched`: number — Distinct orders with any credit in this row - `attributed_cogs`: number - `attributed_payment_fees`: number - `attributed_tax`: number — Weighted raw order tax - `gross_revenue`: number — attributed_revenue − effective attributed tax: raw tax is not deducted when the shop ignores VAT - `net_profit`: number — Attributed CM2 (these channels have no ad spend); not shop operating profit - `profit_margin_pct`: number — Percentage points: net_profit / attributed_revenue × 100 (50 means 50%); 0 when attributed_revenue is not positive - `avg_order_value`: number — attributed_revenue / attributed_orders; 0 when there is no credit - `revenue_per_order_touched`: number — attributed_revenue / distinct_orders_touched; 0 when none - `first_time_customer_orders`: number — Weighted credit for first orders - `first_time_customer_revenue`: number — Weighted gross totals of first orders, before refunds #### GET /v1/attribution/orders List attributed orders Lists the individual orders attributed to a channel — optionally narrowed to one campaign / ad set / ad. Answers "which orders did this campaign actually drive?". Paginated (`page`/`per_page`, max 100 per page) with a stable newest-first ordering; `pagination.total_items` carries the full count. **Scoping:** `channel` alone returns the whole channel. On paid ad channels, narrow with the platform IDs `campaign_id` / `ad_set_id` / `ad_id` (the same IDs the /v1/analytics endpoints return); on non-ad channels (organic, email, direct, referral, …) narrow with `campaign` (the campaign name from tracking parameters). Orders are selected by order date using click/window-based attribution — the same selection the dashboard drill-downs use. **Required scopes:** `analytics:read` **and** `orders:read` — this endpoint returns individual order records, so an analytics-only key cannot use it. **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Keep attribution_model and attribution_window identical when comparing channels or drilling down into campaigns, orders and products; changing them changes the credited results. total_items counts distinct matched order identities, not fractional attribution credit. order_timestamp is shop-local wall-clock time without an offset. total_price is the full gross total of each matched order. Summing these order totals is not a substitute for the analytics attributed_revenue metric. (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `channel` (string, required): Channel identifier — a paid ad channel (e.g. meta-ads, google-ads) or a non-ad channel (e.g. organic, email, direct). Use GET /v1/analytics/channels to discover the channels active in your shop. - `start_date` (required): as under `GET /v1/attribution/campaigns` - `end_date` (required): as under `GET /v1/analytics/ad-sets` - `attribution_model`: as under `GET /v1/analytics/ad-sets` - `attribution_window`: as under `GET /v1/analytics/ad-sets` - `campaign` (string): Campaign name filter for NON-ad channels (e.g. an email campaign). Ignored for paid ad channels — use campaign_id there. - `campaign_id` (string): Platform campaign ID filter (paid ad channels only) - `ad_set_id` (string): Platform ad-set ID filter (paid ad channels only) - `ad_id` (string): Platform ad ID filter (paid ad channels only) - `first_time_customers_only` ("true" | "false"): Keep only first-time customer orders - `page`: as under `GET /v1/orders` - `per_page`: as under `GET /v1/orders` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` Response (success envelope `data`): - `data`: AttributedOrdersResponseData - `orders`: AttributedOrder[] — Distinct orders with credit in the scope; pagination.total_items counts these identities, not fractional attributed_orders - `order_id`: string — Shopify order ID - `order_number`: string — Shopify order name/number - `order_timestamp`: string — Shop-local wall-clock order time without an offset; unlike order-detail timestamps it is not UTC - `total_price`: number — Full gross order total (shop currency), not the fractional credit attributed to the scope - `is_first_customer_order`: boolean — Whether this was the customer's first order - `pagination`: PaginationMetadata (fields as under `GET /v1/analytics/ad-sets`) #### GET /v1/attribution/products List attributed products Lists the products bought in the orders attributed to a channel — optionally narrowed to one campaign / ad set / ad — aggregated per product+variant with quantity and revenue. Answers "which products does this channel/campaign sell?". Paginated (`page`/`per_page`, max 100 per page), ordered by revenue descending; `pagination.total_items` carries the full count. (Same note as under `GET /v1/attribution/orders`.) **Required scope:** `analytics:read` **Rate limit:** 60 requests per minute per API key Dates are inclusive shop-local calendar days (YYYY-MM-DD), with start_date <= end_date and at most 366 days per request. Keep the same date range when comparing reports. Keep attribution_model and attribution_window identical when comparing channels or drilling down into campaigns, orders and products; changing them changes the credited results. Rows group purchased product/variant combinations; they are not catalog records or individual orders. Revenue is full selected orders’ line price × quantity, unweighted and before order discounts/refunds. Active-product/variant inner joins can omit deleted catalog entities. Use the attributed-orders report when the question needs order identities. (Same note as under `GET /v1/analytics/ad-sets`.) Query parameters: - `channel` (required): as under `GET /v1/attribution/orders` - `start_date` (required): as under `GET /v1/attribution/campaigns` - `end_date` (required): as under `GET /v1/analytics/ad-sets` - `attribution_model`: as under `GET /v1/analytics/ad-sets` - `attribution_window`: as under `GET /v1/analytics/ad-sets` - `campaign`: as under `GET /v1/attribution/orders` - `campaign_id`: as under `GET /v1/attribution/orders` - `ad_set_id`: as under `GET /v1/attribution/orders` - `ad_id`: as under `GET /v1/attribution/orders` - `first_time_customers_only`: as under `GET /v1/attribution/orders` - `page`: as under `GET /v1/orders` - `per_page`: as under `GET /v1/orders` - `filter_mode`: as under `GET /v1/analytics/ad-sets` - `filter_ids`: as under `GET /v1/analytics/ad-sets` Response (success envelope `data`): - `data`: AttributedProductsResponseData - `products`: AttributedProduct[] — Products bought in the attributed orders; products or variants no longer in the active catalog can be omitted - `product_id`: string — Shopify product ID - `product_name`: string — Product name - `variant_id`: string | null — Shopify variant ID - `variant_name`: string | null — Variant name - `sku`: string | null — Merchant-assigned Shopify SKU (null when unset or not yet re-synced) - `image_url`: string | null — Product image URL - `quantity`: number — Units bought in the attributed orders - `revenue`: number — Line price × quantity across the full selected orders: unweighted by attribution credit, before order discounts and refunds - `pagination`: PaginationMetadata (fields as under `GET /v1/analytics/ad-sets`) ### Cost Profit-tracking cost settings — COGS, payment fees, shipping profiles #### POST /v1/cost/cogs/bulk Bulk-set product COGS Applies one COGS rule to many products/variants. Pass dry_run=true to preview without writing. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key At most 100 product/variant targets per call. Each target is applied independently: a successful response can still contain failed entries. Inspect applied and failed before reporting success, and retry only intended failed targets after checking their current state. Dry-run plans report planned, valid, invalid and a sample; the sample is not the complete target list and applied remains 0. Request body (BulkSetCogsBody): - `targets` (BulkCogsTarget[], required): Products/variants to write the COGS rule for (one rule each). - `product_id` (integer): Shopify product id (set this XOR variant_id) - `variant_id` (integer): Shopify variant id (set this XOR product_id) - `mode` ("shopify" | "constant" | "percent", required): Cost mode: shopify (use Shopify cost), constant (absolute), or percent of price. - `value` (number): Cost value. Required for constant (>=0) and percent (0-100); omit/ignored for shopify. - `basis` ("selling"): Percent basis — only 'selling' is supported (required when mode=percent). - `recover_on_return` (boolean | null): Override charge-COGS-on-returns for these targets; null/omit inherits global. - `effective_from` (string): Reserved; accepted but not applied. First rules cover all orders; use set_cogs_history for dates. - `dry_run` (boolean, default false): When true, validate + plan only; performs NO write. Response (success envelope `data`): - `data`: any #### GET /v1/cost/cogs/global Get global COGS settings Returns the shop’s global COGS fallback settings. **COGS model:** each product or variant is a _scope_ with a day-grain timeline of rule periods (SCD). At calculation time a line item resolves its per-unit cost with this precedence: **variant rule → product rule → Shopify variant cost (`mode: "shopify"`) → global fallback percent**. A variant-level rule coexists with a product-level rule on the same product and simply wins for that variant — there is **no separate "inherit from product" toggle**, and none is needed: to give variants of one product different constant costs, create one rule per variant (`{"mode":"constant","value":4.2,"variant_id":…}`) while the product-level rule keeps covering the remaining variants. Exactly one of `product_id`/`variant_id` is set per rule; the create and list endpoints additionally accept `sku` as the scope (resolved to one variant — an ambiguous SKU is rejected with the candidate variant ids, since Shopify does not enforce unique SKUs; resolve names/SKUs to ids via `GET /v1/products/catalog`). Responses expose `mode` as `shopify | constant | percent` (the database stores these as from_shopify | absolute | percent_of_price). **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key These are Venon profit-calculation settings. They do not change Shopify product prices or the product/variant rule timelines. Percentages use percentage points: 30 means 30%, not 0.30. Response (success envelope `data`): - `data`: CogsGlobalSettingsResponse - `fallbackPercent`: number | null — Fallback COGS as % of price when no rule/variant cost resolves - `fallbackBasis`: "selling" | "compare_at" — Price the fallback % applies to - `chargeCogsOnReturns`: boolean — Whether returned items still incur COGS #### PUT /v1/cost/cogs/global Update global COGS settings Upserts the shop’s global COGS fallback settings. **Parameter naming:** request parameters are snake_case (e.g. `variant_id`, `as_of`, `effective_to`). The former camelCase spellings are still accepted as **deprecated aliases**; sending both spellings with different values is rejected with a 400. Unknown query parameters are rejected with a 400 listing the accepted names. Response bodies keep their documented camelCase fields. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/cost/cogs/global`.) Request body (CostCogsGlobalPutBody): - `fallback_percent` (number | null, required): Fallback COGS as % of price when no rule/variant cost resolves; null disables - `fallback_basis` ("selling", required): Price the fallback percent applies to — 'selling' - `charge_cogs_on_returns` (boolean, required): Whether returned items still incur COGS by default Response (success envelope `data`): - `data`: CogsGlobalSettingsResponse (fields as under `GET /v1/cost/cogs/global`) #### GET /v1/cost/cogs/rules List COGS rules Lists per-product/variant COGS rules grouped by scope. Every scope carries the rule effective at `as_of`, the currently active rule, and the full history — each with its `mode`. Filter to one scope with `product_id`, `variant_id`, or `sku` (at most one; e.g. `?variant_id=52778432299272`). (Same note as under `GET /v1/cost/cogs/global`.) (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key Pagination uses limit/offset (limit defaults to 50, maximum 100) over scopes, not page/per_page or individual history rows. as_of selects the effective period; it does not remove other history from the response. An absent explicit rule does not mean the resolved COGS is zero. Query parameters: - `product_id` (integer): Filter to one product scope (at most one of product_id / variant_id) - `variant_id` (integer): Filter to one variant scope (at most one of product_id / variant_id) - `sku` (string): Filter by merchant SKU (at most one of product_id / variant_id / sku) — resolved to one variant; an ambiguous SKU is rejected with the candidate variant ids - `as_of` (string | string): Resolve the effective rule at this historical point - `limit` (integer, default 50): Page size. Default 50. - `offset` (integer | null, default 0): Page offset. Default 0. Response (success envelope `data`): - `data`: CogsRulesListResponse - `scopes`: CogsRuleScopeView[] - `scope`: object - `productId`: number | null - `variantId`: number | null - `effectiveAt`: string — The as-of timestamp the `effective` row was resolved for - `effective`: CogsRuleRow | null — Rule effective at `effectiveAt` (null = none) - `id`: number — COGS rule row id - `productId`: number | null — Product scope (null for a variant-scoped rule) - `variantId`: number | null — Variant scope (null for a product-scoped rule) - `mode`: "shopify" | "constant" | "percent" — COGS mode: `shopify` = use the variant cost synced from Shopify; `constant` = fixed per-unit cost (`value`, shop currency); `percent` = percentage of the selling price (`value`, 0–100). - `value`: number | null — Cost value (constant: amount; percent: 0–100) - `basis`: "selling" | "compare_at" - `recoverOnReturn`: boolean | null — Per-rule return-recovery override (null = inherit the global setting) - `effectiveTo`: string | null — End of validity; null = currently active period - `current`: CogsRuleRow | null — Open-ended latest rule (null = none active) (fields as under `GET /v1/cost/cogs/rules`) - `history`: CogsRuleHistoryEntry[] — Prior periods, newest first - `id`: number - `effectiveFrom`: string — When the NEXT value took over (TimedValue polarity) - `mode`: "shopify" | "constant" | "percent" — COGS mode: `shopify` = use the variant cost synced from Shopify; `constant` = fixed per-unit cost (`value`, shop currency); `percent` = percentage of the selling price (`value`, 0–100). - `value`: number | null - `basis`: "selling" | "compare_at" - `recoverOnReturn`: boolean | null - `totalCount`: number - `limit`: number - `offset`: number #### POST /v1/cost/cogs/rules Create a COGS rule Sets the current COGS rule for one product or variant. With an active current period, same-mode writes preserve history; changing its mode resets the entire scope history. A first rule in an empty scope covers all orders; closed-only history gains a current period from its last end date. For a constant per-unit cost send `{"mode":"constant","value":5.5,"variant_id":…}` (or `"product_id"`, or `"sku"`). **Scope:** exactly one of `product_id` / `variant_id` / `sku`. A variant-level rule coexists with a product-level rule on the same product and **wins for that variant** at calculation time. (Same note as under `GET /v1/cost/cogs/global`.) (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key With an active current period, same-mode writes update its value and preserve history; changing its mode resets the entire scope history. A first rule in an empty scope covers all orders, including earlier orders. With only closed history, the new current period starts at the last saved end date and preserves all past rows, even when that boundary is in the future. Use the history editor or set_cogs_history for deliberate dates. After an uncertain response, read the scope before retrying. Saved rules can take time to reach order details and historical reports through synchronization and recalculation. A constant value is a per-unit cost; percent values use percentage points (30 means 30%). Request body (CostCogsRuleCreateBody): - `mode` ("shopify" | "constant" | "percent", required): Cost mode: shopify (use Shopify cost), constant (absolute), percent of price - `value` (number): Cost value. Required for constant (>=0) and percent (0-100); omit for shopify. - `basis` ("selling"): Percent basis — only 'selling' - `recover_on_return` (boolean | null): Override charge-COGS-on-returns for this rule; null/omit inherits global - `product_id` (integer): Product scope - `variant_id` (integer): Variant scope - `sku` (string): Merchant SKU of the target variant (set exactly one of product_id / variant_id / sku). Resolved to one variant id; an ambiguous SKU is rejected with the candidate ids. Response (success envelope `data`): - `data`: CogsRuleScopeView (fields as under `GET /v1/cost/cogs/rules`) #### POST /v1/cost/cogs/rules/bulk Set different COGS rules in one batch Accepts 1–100 unique targets, each with exactly one safe positive integer product_id or variant_id. Only canonical snake_case request fields are accepted; unknown body or query fields are rejected. Results remain in request order and include index and target. Missing and other-shop targets are indistinguishable. One HTTP request replaces up to 100 single-target requests; database writes remain sequential. Same-mode writes update the current value in place and preserve history. A mode change resets ALL history for that scope. An absent active row is seeded on the shop-local calendar day. Dates are day-grain. Dry runs make no rule mutations, return every target validity outcome and history_reset for valid entries, and can become stale before execution. Ownership is checked again by each real write. Entries are independent, without cross-target atomicity. Always inspect every result: a failed sibling does not roll back successful entries. Never automatically replay the batch. WRITE_UNCERTAIN can mean a write committed but readback failed; re-read that target using bulk-read before deciding whether to retry. CONFLICT and INVALID_RULE also require a re-read before retry. applied counts confirmed successes only; uncertain outcomes may have persisted. Read targets first with POST /v1/cost/cogs/rules/bulk-read, preview with dry_run: true, inspect history_reset, then submit dry_run: false. Malformed entries reject the whole request before any writes. Dry-run selected histories have the same 10,000-row ceiling as bulk-read. cost:write is required even for dry_run. The existing shared-value /cogs/bulk endpoint remains available. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Request body (CogsBulkWriteBody): - `entries` (object[], required) - `mode` ("shopify" | "constant" | "percent", required): Cost mode: shopify (use Shopify cost), constant (absolute), percent of price - `value` (number): Cost value. Required for constant (>=0) and percent (0-100); omit for shopify. - `basis` ("selling"): Percent basis — only 'selling' - `recover_on_return` (boolean | null): Override charge-COGS-on-returns for this rule; null/omit inherits global - `product_id` (integer) - `variant_id` (integer) - `dry_run` (boolean, default false) Response (success envelope `data`): - `data`: CogsBulkWriteResult - `dry_run`: boolean - `planned`: integer — Requested entry count - `valid`: integer — Valid preview entries, or confirmed successful writes for a real batch - `applied`: integer — Confirmed successful writes; always zero for a dry run - `failed`: integer — Failed or uncertain outcomes; uncertain entries may have persisted - `results`: object[] - Option `success` = true: - `index`: integer - `target`: object — Exactly one of product_id or variant_id, as a safe positive integer - `product_id`: integer - `variant_id`: integer - `success`: true - `history_reset`: boolean - Option `success` = true: - `index`: integer - `target`: object — Exactly one of product_id or variant_id, as a safe positive integer - `product_id`: integer - `variant_id`: integer - `success`: true - Option `success` = false: - `index`: integer - `target`: object — Exactly one of product_id or variant_id, as a safe positive integer - `product_id`: integer - `variant_id`: integer - `success`: false - `error`: object - `code`: "NOT_FOUND" | "CONFLICT" | "INVALID_RULE" | "WRITE_UNCERTAIN" - `message`: string - `requires_reread`: boolean — Re-read this target before retrying; never replay the whole batch #### POST /v1/cost/cogs/rules/bulk-read Read selected COGS rule histories in bulk Accepts 1–100 unique targets, each with exactly one safe positive integer product_id or variant_id. Only canonical snake_case request fields are accepted; unknown body or query fields are rejected. Results remain in request order and include index and target. Missing and other-shop targets are indistinguishable. One HTTP request replaces up to 100 single-target requests; database writes remain sequential. This POST is a read and does not require cost:write. Owned targets without explicit rules return an empty scope view (current/effective null, history empty); this is not resolved zero cost, and variant/global fallbacks can still apply. as_of accepts a YYYY-MM-DD shop-local day or an ISO instant converted to the shop timezone; omitted means shop-local today. Complete selected histories are returned up to 10,000 total rows, including the active rows. Above that ceiling the whole read fails with 422: use smaller target chunks; histories are never silently truncated. **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key Request body (CogsBulkReadBody): - `targets` (object[], required): Exactly one of product_id or variant_id, as a safe positive integer - `product_id` (integer) - `variant_id` (integer) - `as_of` (string | string): Shop-local YYYY-MM-DD day or ISO instant converted to the shop timezone Response (success envelope `data`): - `data`: CogsBulkReadResult - `results`: object[] - Option `success` = true: - `index`: integer - `target`: object — Exactly one of product_id or variant_id, as a safe positive integer - `product_id`: integer - `variant_id`: integer - `success`: true - `data`: CogsRuleScopeView (fields as under `GET /v1/cost/cogs/rules`) - Option `success` = false: - `index`: integer - `target`: object — Exactly one of product_id or variant_id, as a safe positive integer - `product_id`: integer - `variant_id`: integer - `success`: false - `error`: object - `code`: "NOT_FOUND" - `message`: "Product or variant not found" #### POST /v1/cost/cogs/rules/history Set the full COGS history timeline Declaratively REPLACES one product/variant scope’s entire COGS chain with the supplied ordered periods (ascending by `until`; the final period has until=null = the active row). One `mode` for the whole timeline. Pass dry_run=true to preview without writing. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Read the existing timeline first and include every period that should survive; omitted periods are removed. until is an exclusive END date, not a start date. A dry run does not reserve state or guarantee a later write succeeds. Request body (SetCogsHistoryBody): - `product_id` (integer): Shopify product id (set this XOR variant_id). - `variant_id` (integer): Shopify variant id (set this XOR product_id). - `mode` ("shopify" | "constant" | "percent", required): Cost mode for EVERY period: shopify, constant (absolute), or percent of price. - `recover_on_return` (boolean | null): Override charge-COGS-on-returns for every period; null/omit inherits global. - `periods` (CogsHistoryPeriod[], required): Full timeline, ascending by `until`. Every period except the last has a finite `until`; the last has until=null (the active row). REPLACES the existing chain for this scope. - `value` (number): Cost value for this period. Required for constant (>=0) / percent (0-100). - `until` (string | null, required): Period END (ISO datetime). null marks the final, currently-active period. - `dry_run` (boolean, default false): When true, validate + read existing + return a plan; performs NO write. Response (success envelope `data`): - `data`: any #### POST /v1/cost/cogs/rules/ops Apply COGS history operations Applies a batch of add/update/delete operations against one scope’s COGS history in one transaction. Each op’s `effective_to` marks when that row’s period ends; the chain is re-stitched afterwards so periods stay contiguous. **Note:** a batch whose deletes remove the scope’s last remaining row currently returns the empty scope view (`current`/`effective` null, empty history) rather than an error. (Same note as under `POST /v1/cost/cogs/rules`.) (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Send 1–20 operations; empty batches are rejected. Use list_cogs_rules or GET /v1/cost/cogs/rules to read history with cost:read. Use history-row IDs from the selected scope for update/delete operations. The transaction covers this scope only; a sequence of requests for different scopes is not one atomic change. Request body (CostCogsRulesOpsBody): - `product_id` (integer): Product scope - `variant_id` (integer): Variant scope - `ops` (CostCogsHistoryOp[], required): Diff operations against the scope’s history (1–20 per call; empty batches are rejected) - Option `kind` = "delete": - `kind` ("delete", required): Remove one history row - `id` (integer, required): COGS rule (SCD row) id to delete - Option `kind` = "update": - `kind` ("update", required): Edit one history row - `id` (integer, required): COGS rule (SCD row) id to update - `effective_to` (string | string, required): When this row's period ends - `mode` ("shopify" | "constant" | "percent", required): Cost mode of this period: shopify | constant | percent - `value` (number): Cost value. Required for constant (>=0) and percent (0-100); omit for shopify. - `basis` ("selling"): Percent basis — only 'selling' - `recover_on_return` (boolean | null): Override charge-COGS-on-returns; null/omit inherits global - Option `kind` = "add": - `kind` ("add", required): Insert a new past period - `effective_to` (string | string, required): When this row's period ends - `mode` ("shopify" | "constant" | "percent", required): Cost mode of this period: shopify | constant | percent - `value` (number): Cost value. Required for constant (>=0) and percent (0-100); omit for shopify. - `basis` ("selling"): Percent basis — only 'selling' - `recover_on_return` (boolean | null): Override charge-COGS-on-returns; null/omit inherits global Response (success envelope `data`): - `data`: CogsRuleScopeView (fields as under `GET /v1/cost/cogs/rules`) #### GET /v1/cost/cogs/rules/{id} Get a COGS rule Gets a single COGS rule (SCD row) by id. **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key The id is a COGS history-row ID returned by the rules list, not a product or variant ID. Use the scope list to inspect the complete timeline before updating or deleting individual rows. Path parameters: - `id` (integer, required) Response (success envelope `data`): - `data`: CogsRuleRow (fields as under `GET /v1/cost/cogs/rules`) #### GET /v1/cost/payment-gateways List payment gateways Lists payment gateways and their cost/fee settings (e.g. `?history=1&name=shopify_payments` for one gateway’s full timeline). (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key By default only active rows are returned; use history=1 in REST or history=true in MCP for historical rows. Use a returned row id to update that gateway. These settings model costs in Venon; they do not change the fees charged by the payment provider. Query parameters: - `history` ("1" | "true"): Return the full fee history instead of only the active rows - `name` (string): Filter to one gateway by name Response (success envelope `data`): - `data`: any #### POST /v1/cost/payment-gateways Upsert a payment gateway Updates a payment gateway’s cost/fee (SCD upsert). Omit `effective_at` to supersede the active row now; supply it to period-split at that date. (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key id is a required existing gateway-row ID that identifies the gateway timeline; this does not create a gateway from a new name. Supply both cost (fixed amount per transaction) and fee (percentage points, so 2.9 means 2.9%). Read back the timeline after changing an effective date. Request body (CostPaymentGatewayUpsertBody): - `id` (integer, required): Id of any existing row in the gateway’s (shop, name) chain - `cost` (number | null, required): Fixed fee per transaction in the shop currency (e.g. 0.35), NOT a percent; or null - `fee` (number | null, required): Percent fee 0-100 (e.g. 2.99 = 2.99%), NOT a fixed amount; or null - `effective_at` (string | string): Omit to supersede the active row now; supply to period-split at this date Response (success envelope `data`): - `data`: any #### POST /v1/cost/payment-gateways/bulk Bulk-set payment fees Upserts many payment gateways in one call. Pass dry_run=true to preview without writing. (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key At most 50 gateways per call. Each target is applied independently: a successful response can still contain failed entries. Inspect applied and failed before reporting success, and retry only intended failed targets after checking their current state. Dry-run plans report planned, valid, invalid and a sample; the sample is not the complete target list and applied remains 0. Request body (CostBulkSetPaymentFeesBody): - `gateways` (CostPaymentGatewayUpsertBody[], required): Payment-gateway upserts to apply (one upsert each) - `id` (integer, required): Id of any existing row in the gateway’s (shop, name) chain - `cost` (number | null, required): Fixed fee per transaction in the shop currency (e.g. 0.35), NOT a percent; or null - `fee` (number | null, required): Percent fee 0-100 (e.g. 2.99 = 2.99%), NOT a fixed amount; or null - `effective_at` (string | string): Omit to supersede the active row now; supply to period-split at this date - `dry_run` (boolean, default false): When true, validate + plan only; performs NO write Response (success envelope `data`): - `data`: any #### POST /v1/cost/payment-gateways/history Set the full payment gateway fee timeline Declaratively REPLACES one gateway’s entire fee chain (by name) with the supplied ordered periods (ascending by `until`; the final period has until=null = the active row). Each period carries cost + fee. Pass dry_run=true to preview without writing. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key (Same note as under `POST /v1/cost/cogs/rules/history`.) Request body (SetPaymentFeeHistoryBody): - `name` (string, required): Payment gateway name (the (shop, name) chain to replace). - `periods` (PaymentFeeHistoryPeriod[], required): Full fee timeline, ascending by `until`; the last has until=null (active). REPLACES the chain. - `cost` (number | null, required): Fixed fee per transaction in the shop currency for this period (NOT a percent). - `fee` (number | null, required): Percent fee 0-100 for this period (NOT a fixed amount). - `until` (string | null, required): Period END (ISO datetime). null marks the final, currently-active period. - `dry_run` (boolean, default false): When true, validate + read existing + return a plan; performs NO write. Response (success envelope `data`): - `data`: any #### POST /v1/cost/payment-gateways/ops Apply payment gateway history operations Applies a batch of add/update/delete operations against one gateway’s fee history in one transaction. Each op’s `effective_to` marks when that row’s period ends; the literal `'infinity'` marks the active row. (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Send 1–20 operations; empty batches are rejected. Use list_payment_gateways or GET /v1/cost/payment-gateways to read history with cost:read. Use the exact gateway name and row IDs from its history. The batch is atomic for that gateway; reread its timeline after a validation failure before rebuilding the operations. Request body (CostPaymentGatewayOpsBody): - `name` (string, required): Gateway name (the (shop, name) chain to edit) - `ops` (CostPaymentGatewayHistoryOp[], required): Diff operations against the gateway’s fee history (1–20 per call; empty batches are rejected) - Option `kind` = "delete": - `kind` ("delete", required): Remove one history row - `id` (integer, required): Fee row id to delete - Option `kind` = "update": - `kind` ("update", required): Edit one history row - `id` (integer, required): Fee row id to update - `effective_to` (string | string | "infinity", required): When this row's period ends; the literal 'infinity' marks the active row - `cost` (number | null, required): Fixed fee per transaction in the shop currency (e.g. 0.35), NOT a percent; or null - `fee` (number | null, required): Percent fee 0-100 (e.g. 2.99 = 2.99%), NOT a fixed amount; or null - Option `kind` = "add": - `kind` ("add", required): Insert a new period - `effective_to` (string | string | "infinity", required): When this row's period ends; the literal 'infinity' marks the active row - `cost` (number | null, required): Fixed fee per transaction in the shop currency (e.g. 0.35), NOT a percent; or null - `fee` (number | null, required): Percent fee 0-100 (e.g. 2.99 = 2.99%), NOT a fixed amount; or null Response (success envelope `data`): - `data`: any #### GET /v1/cost/shipping-methods List shipping methods Lists shipping-method titles observed on the shop’s real orders. The list may be empty until an order with a shipping line is ingested. Use this endpoint only when pricing intentionally differs by method, then copy a returned title byte-for-byte into `shipping_methods`. **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key Response (success envelope `data`): - `data`: string[] — Observed shipping-method titles; copy each title byte-for-byte #### GET /v1/cost/shipping-profiles List shipping profiles Lists ALL shipping profiles (identity + scope, no fees or pagination). Accepts no query parameters. Use GET /v1/cost/shipping-profiles/{id} for costs and history. Shipping-profile scope uniqueness is independent of the profile name. Two non-default profiles conflict when their countries, shipping methods AND products/variants all overlap. An empty array matches every value on that dimension. Any intersecting combination is enough; the complete lists do not need to be equal. A product includes all its variants, so a product profile and one of its variant profiles conflict when country and method scopes also overlap. Distinct variants of the same product can coexist. The catch-all default is excluded from this overlap check; other profiles must narrow at least one dimension. **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key Response (success envelope `data`): - `data`: ShippingProfileSummary[] — All profiles in the authenticated shop, without fees or pagination - `id`: string — Profile id; pass as a string for upsert, as a number for MCP reads/tiers/history - `name`: string - `isDefault`: boolean — Catch-all fallback profile, excluded from non-default overlap checks - `countryCodes`: string[] — Country scope; [] matches every country - `shippingMethods`: string[] — Exact method titles; [] matches every method - `products`: object[] — Product/variant scope; [] matches every product. A product includes its variants. - Option `kind` = "product": - `kind`: "product" - `id`: integer - `label`: string - Option `kind` = "variant": - `kind`: "variant" - `id`: integer - `productId`: integer — Parent product id; 0 means the parent could not be resolved - `label`: string - `currency`: string — Currency for all fees on this profile #### POST /v1/cost/shipping-profiles Upsert a shipping profile Creates or updates a shipping profile’s identity and scope, optionally with its full fee setup via the nested `fees` block — one atomic request creates a fully configured profile (scalar fees plus flat or weight/item bucket axes; omitted values seed 0). An empty `shipping_methods` array matches all methods; non-empty values must exactly match titles returned by `GET /v1/cost/shipping-methods` or the request returns 422. Existing saved values are grandfathered when editing unless new unobserved values are added. On update, `fees` scalars overwrite the current value in place (history kept) and a provided axis REPLACES that axis, resetting its fee history (same semantics as /tiers). This is the single canonical call for creating or editing a profile; /tiers, /fee-history and /bucket-history are narrower cost-timeline utilities on top of it. **Shipping-method scope:** `shipping_methods: []` is the recommended default whenever fees do not intentionally vary by shipping method. An empty array means the profile applies to all current and future shipping methods; it does not disable the profile. Never invent generic values such as `Standard`. For differentiated pricing, first call `GET /v1/cost/shipping-methods` and copy returned titles byte-for-byte. Unknown, whitespace-changed, or case-changed titles receive a 422 response. Methods already saved on an existing profile remain grandfathered until that profile is re-scoped. Shipping-profile scope uniqueness is independent of the profile name. Two non-default profiles conflict when their countries, shipping methods AND products/variants all overlap. An empty array matches every value on that dimension. Any intersecting combination is enough; the complete lists do not need to be equal. A product includes all its variants, so a product profile and one of its variant profiles conflict when country and method scopes also overlap. Distinct variants of the same product can coexist. The catch-all default is excluded from this overlap check; other profiles must narrow at least one dimension. Provide the existing profile id to update; omit it to create. The server never finds an update target by name or matching scope. Updates exclude their own id from conflict detection but still check every other non-default profile in the shop. Names must be unique within the shop and there can be only one default; is_default cannot be changed on an existing profile. Upsert requires the complete identity/scope fields. Omit fees to preserve all costs and history. Provided scalar fees overwrite current values while preserving history; a provided per_order or per_order_return axis REPLACES that axis and resets its history, including for flat axes. Read each conflicting profile by id and inspect its complete scope and costs. Update by id only when it is the intended target; a profile may cover additional countries or products. Otherwise narrow the proposed scope or resolve the ambiguity with the user. Changing the name or retrying unchanged cannot fix a scope conflict. Do not delete or overwrite another profile merely because it conflicts. Read back the final profile after an authorized update. Identity, scope and nested fees commit in one transaction; a conflict rolls back all changes. Profile-scope writes are serialized within the shop, so concurrent overlapping creates cannot both commit. Preflight reads do not reserve a scope. No idempotency key or revision precondition is supported; after an uncertain timeout, re-read before retrying a create. [Worked examples and workflow guide](https://developerdocs.venon.io/shipping-profiles.md). (Same note as under `PUT /v1/cost/cogs/global`.) **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Request body (CostShippingProfileUpsertBody): - `profile` (object, required): Shipping-profile scope uniqueness is independent of the profile name. Two non-default profiles conflict when their countries, shipping methods AND products/variants all overlap. An empty array matches every value on that dimension. Any intersecting combination is enough; the complete lists do not need to be equal. A product includes all its variants, so a product profile and one of its variant profiles conflict when country and method scopes also overlap. Distinct variants of the same product can coexist. The catch-all default is excluded from this overlap check; other profiles must narrow at least one dimension. Provide the existing profile id to update; omit it to create. The server never finds an update target by name or matching scope. Updates exclude their own id from conflict detection but still check every other non-default profile in the shop. Names must be unique within the shop and there can be only one default; is_default cannot be changed on an existing profile. Upsert requires the complete identity/scope fields. Omit fees to preserve all costs and history. Provided scalar fees overwrite current values while preserving history; a provided per_order or per_order_return axis REPLACES that axis and resets its history, including for flat axes. - `id` (string): Existing profile id to update; omit to create. Never matched by name or scope. - `name` (string, required): Unique name within the shop. Changing it does not bypass scope conflicts. - `is_default` (boolean, required): The default profile is a pure catch-all (no scoping) - `country_codes` (string[], required): ISO 3166-1 alpha-2 codes; [] matches every country - `shipping_methods` (string[], required): [] (recommended default) applies to all current and future shipping methods. For differentiated pricing call GET /v1/cost/shipping-methods first and copy titles byte-for-byte. - `products` (object[], required): [] matches every product. A product includes all its variants; overlapping product/variant scopes conflict when countries and methods also overlap. - Option `kind` = "product": - `kind` ("product", required) - `id` (integer, required): Shopify product id - `label` (string) - Option `kind` = "variant": - `kind` ("variant", required) - `id` (integer, required): Shopify variant id - `product_id` (integer): Parent product id - `label` (string) - `currency` (string, required) - `fees` (object): On CREATE omitted chains seed at 0; on UPDATE scalars overwrite the active value and a provided axis payload REPLACES that axis (resets its history). - `packaging_fee` (number) - `picking_first_item_fee` (number) - `picking_following_items_fee` (number) - `other_per_item_fee` (number) - `per_item_return_fee` (number) - `per_order` (object): Ascending buckets; finite max_value boundaries must strictly increase and the LAST bucket must be open-ended (max_value: null). - Option `type` = "flat": - `type` ("flat", required): Single flat cost for the axis - `value` (number, required): Flat cost - Option `type` = "weight": - `type` ("weight", required): Weight-graduated buckets - `weight_display_unit` ("g" | "kg" | "lbs" | "oz", required) - `buckets` (object[], required) - `max_value` (integer | null, required): Upper bound of this bucket (in weight_display_unit for weight sets, item count for item sets). null = open-ended (∞), allowed only on the LAST bucket. - `cost` (number, required): Shipping cost for this bucket - Option `type` = "item": - `type` ("item", required): Item-count-graduated buckets - `buckets` (object[], required) - `max_value` (integer | null, required): Upper bound of this bucket (in weight_display_unit for weight sets, item count for item sets). null = open-ended (∞), allowed only on the LAST bucket. - `cost` (number, required): Shipping cost for this bucket - `per_order_return` (object): Ascending buckets; finite max_value boundaries must strictly increase and the LAST bucket must be open-ended (max_value: null). - Option `type` = "flat": - `type` ("flat", required): Single flat cost for the axis - `value` (number, required): Flat cost - Option `type` = "weight": - `type` ("weight", required): Weight-graduated buckets - `weight_display_unit` ("g" | "kg" | "lbs" | "oz", required) - `buckets` (object[], required) - `max_value` (integer | null, required): Upper bound of this bucket (in weight_display_unit for weight sets, item count for item sets). null = open-ended (∞), allowed only on the LAST bucket. - `cost` (number, required): Shipping cost for this bucket - Option `type` = "item": - `type` ("item", required): Item-count-graduated buckets - `buckets` (object[], required) - `max_value` (integer | null, required): Upper bound of this bucket (in weight_display_unit for weight sets, item count for item sets). null = open-ended (∞), allowed only on the LAST bucket. - `cost` (number, required): Shipping cost for this bucket Response (success envelope `data`): - `data`: ShippingProfileUpsertResult - `id`: integer — Created or updated profile id; GET the profile for full state #### POST /v1/cost/shipping-profiles/bucket-history Set the full cost timeline for one shipping bucket Declaratively REPLACES one existing bucket’s entire cost chain (by bucket_id) with the supplied ordered periods (ascending by `until`; the final period has until=null = the active row). Create buckets first with /tiers. Pass dry_run=true to preview without writing. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Request body (SetShippingBucketHistoryBody): - `profile_id` (integer, required): Target shipping profile id. - `bucket_id` (integer, required): Id of an existing bucket in this profile (from get_shipping_profile). - `periods` (ShippingBucketHistoryPeriod[], required): Full cost timeline for this bucket, ascending by `until`; the last has until=null (active). REPLACES the chain. - `cost` (number, required): Bucket cost for this period. - `until` (string | null, required): Period END (ISO datetime). null marks the final, currently-active period. - `dry_run` (boolean, default false): When true, validate + read existing + return a plan; performs NO write. Response (success envelope `data`): - `data`: ShippingProfile | ShippingBucketHistoryPlan - Option ShippingProfile: - `id`: string — Profile id; pass as a string for upsert, as a number for MCP reads/tiers/history - `name`: string - `isDefault`: boolean — Catch-all fallback profile, excluded from non-default overlap checks - `countryCodes`: string[] — Country scope; [] matches every country - `shippingMethods`: string[] — Exact method titles; [] matches every method - `products`: object[] — Product/variant scope; [] matches every product. A product includes its variants. - Option `kind` = "product": - `kind`: "product" - `id`: integer - `label`: string - Option `kind` = "variant": - `kind`: "variant" - `id`: integer - `productId`: integer — Parent product id; 0 means the parent could not be resolved - `label`: string - `currency`: string — Currency for all fees on this profile - `current`: ShippingFees — All scalar fees and axes, including each fee/bucket cost history - `perOrderShipping`: ShippingAxis - Option `type` = "flat": - `type`: "flat" - `value`: ShippingTimedValue - Option `type` = "weight": - `type`: "weight" - `bucketSetId`: integer | null - `buckets`: ShippingBucket[] - `displayUnit`: "g" | "kg" | "lbs" | "oz" - Option `type` = "item": - `type`: "item" - `bucketSetId`: integer | null - `buckets`: ShippingBucket[] - `packagingFee`: ShippingTimedValue - `current`: number — Current fee amount in the profile currency - `currentId`: integer | null — Active fee-row id - `history`: object[] — Historical values ordered by end boundary, newest first - `pickingFirstItemFee`: ShippingTimedValue (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) - `pickingFollowingItemsFee`: ShippingTimedValue (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) - `otherPerItemFee`: ShippingTimedValue (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) - `perOrderReturnFee`: ShippingAxis (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) - `perItemReturnFee`: ShippingTimedValue (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) - Option ShippingBucketHistoryPlan: - `dry_run`: true - `applied`: false - `currency`: string — Profile currency for the planned amounts; may differ from the shop currency - `note`: string — Planned effect; a dry run does not reserve state or guarantee a later write succeeds - `periods`: ShippingBucketHistoryPeriod[] - `cost`: number — Bucket cost for this period. - `until`: string | null — Period END (ISO datetime). null marks the final, currently-active period. #### POST /v1/cost/shipping-profiles/fee-history Set the full timeline for one scalar shipping fee Declaratively REPLACES one scalar fee chain on a profile (by value_name, e.g. packaging_fee) with the supplied ordered periods (ascending by `until`; the final period has until=null = the active row). For graduated weight/item tiers use /tiers or /bucket-history. Pass dry_run=true to preview without writing. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Request body (SetShippingFeeHistoryBody): - `profile_id` (integer, required): Target shipping profile id. - `value_name` ("per_order_flat" | "per_order_return_flat" | "packaging_fee" | "picking_first_item_fee" | "picking_following_items_fee" | "other_per_item_fee" | "per_item_return_fee", required): Which scalar fee chain to replace (e.g. packaging_fee, per_item_return_fee). - `periods` (ShippingFeeHistoryPeriod[], required): Full timeline for this fee, ascending by `until`; the last has until=null (active). REPLACES the chain. - `value` (number, required): Fee value for this period. - `until` (string | null, required): Period END (ISO datetime). null marks the final, currently-active period. - `dry_run` (boolean, default false): When true, validate + read existing + return a plan; performs NO write. Response (success envelope `data`): - `data`: ShippingProfile | ShippingFeeHistoryPlan - Option ShippingProfile: (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) - Option ShippingFeeHistoryPlan: - `dry_run`: true - `applied`: false - `currency`: string — Profile currency for the planned amounts; may differ from the shop currency - `note`: string — Planned effect; a dry run does not reserve state or guarantee a later write succeeds - `periods`: ShippingFeeHistoryPeriod[] - `value`: number — Fee value for this period. - `until`: string | null — Period END (ISO datetime). null marks the final, currently-active period. #### POST /v1/cost/shipping-profiles/tiers Set weight/item shipping tiers Sets graduated weight/item tiers (with costs) on a profile axis in ONE call — e.g. up to 1kg 4.50, up to 5kg 7.00, 5kg+ 12.00 (open-ended top tier = up_to:null). Replaces the axis, which resets its existing fee history; pass dry_run=true to preview without writing. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Request body (SetShippingTiersBody): - `profile_id` (integer, required): Target shipping profile id. - `axis` ("per_order" | "per_order_return", default "per_order"): Which axis: outbound shipping (per_order) or returns (per_order_return). - `type` ("weight" | "item", required): Tier basis: weight or item count. - `weight_unit` ("g" | "kg" | "lbs" | "oz"): Display unit for weight tiers (default kg); ignored for item tiers. - `tiers` (ShippingTier[], required): Graduated tiers, ascending. Exactly one may be open-ended (up_to:null) and it must be last. - `up_to` (integer | null, required): Upper bound of this tier (kg/g/lbs/oz for weight, count for item). null = open-ended top tier. - `cost` (number, required): Shipping cost for this tier. - `dry_run` (boolean, default false): When true, validate + return a plan only; performs NO write (axis replace is destructive). Response (success envelope `data`): - `data`: ShippingProfile | ShippingTiersPlan - Option ShippingProfile: (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) - Option ShippingTiersPlan: - `dry_run`: true - `applied`: false - `currency`: string — Profile currency for the planned amounts; may differ from the shop currency - `note`: string — Planned effect; a dry run does not reserve state or guarantee a later write succeeds - `profile_id`: integer — Target shipping profile id. - `axis`: "per_order" | "per_order_return" — Which axis: outbound shipping (per_order) or returns (per_order_return). - `type`: "weight" | "item" — Tier basis: weight or item count. - `tiers`: ShippingTier[] — Graduated tiers, ascending. Exactly one may be open-ended (up_to:null) and it must be last. - `up_to`: integer | null — Upper bound of this tier (kg/g/lbs/oz for weight, count for item). null = open-ended top tier. - `cost`: number — Shipping cost for this tier. #### GET /v1/cost/shipping-profiles/{id} Get a shipping profile Gets one shipping profile with its complete scope, current fees, buckets and each fee/bucket cost history. Response fields remain camelCase. history[].effectiveFrom is the exclusive END of a historical value, when the next value took over. Read each conflicting profile by id and inspect its complete scope and costs. Update by id only when it is the intended target; a profile may cover additional countries or products. Otherwise narrow the proposed scope or resolve the ambiguity with the user. Changing the name or retrying unchanged cannot fix a scope conflict. Do not delete or overwrite another profile merely because it conflicts. Read back the final profile after an authorized update. **Required scope:** `cost:read` **Rate limit:** 60 requests per minute per API key Path parameters: - `id` (required): as under `GET /v1/cost/cogs/rules/{id}` Response (success envelope `data`): - `data`: ShippingProfile (fields as under `POST /v1/cost/shipping-profiles/bucket-history`) #### DELETE /v1/cost/shipping-profiles/{id} Delete a shipping profile Deletes a non-default shipping profile and its fee history. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Path parameters: - `id` (required): as under `GET /v1/cost/cogs/rules/{id}` Response (success envelope `data`): - `data`: object - `deleted`: true #### POST /v1/cost/shipping-profiles/{id}/cost-updates Update multiple tier costs from an effective date, preserving history Update up to 50 existing shipping buckets in one atomic request, in the profile currency. First preview with dry_run=true, then apply with its revision as expected_revision. effective_from is an inclusive shop-local YYYY-MM-DD date; backdated and future changes are supported. Each new cost lasts until the next existing period boundary (effective_until in the result), or indefinitely if null. Earlier history, later scheduled costs, bucket boundaries and omitted buckets are preserved. At an existing start boundary only that period is updated. Equal costs are no-ops. A missing/cross-profile bucket fails the whole request with 404 and a field-level error. A changed profile returns SHIPPING_PROFILE_REVISION_CONFLICT (409); preview again before applying. Preview does not reserve the profile. There are no idempotency keys or saved responses. After an uncertain timeout, fetch the current profile and reconcile the requested costs. Repeating a committed change with its original revision returns 409; unchanged no-op requests may succeed again. Do not automatically refresh the revision and overwrite newer edits. Preview and review any remaining change before applying. The revision covers identity, scope, tiers and all fee histories. Use /tiers only to replace tier structure and /bucket-history only to explicitly replace a complete timeline. **Required scope:** `cost:write` **Rate limit:** 60 requests per minute per API key Path parameters: - `id` (required): as under `GET /v1/cost/cogs/rules/{id}` Request body (ShippingCostUpdateBody): - `effective_from` (string, required): Inclusive shop-local date (YYYY-MM-DD). Earlier costs and later scheduled periods are preserved. - `bucket_costs` (object[], required): Up to 50 distinct existing buckets from this profile. Omitted buckets are unchanged. - `bucket_id` (integer, required): Existing bucket id from get_shipping_profile; never a history-row id. - `cost` (number, required): New shipping cost in the profile currency. - `expected_revision` (string): Revision returned by a dry run. Required when applying; stale revisions return 409. - `dry_run` (boolean, default false): Preview without writing. Returns the revision required to apply the change. Response (success envelope `data`): - `data`: ShippingCostUpdateResult - `profile_id`: integer - `currency`: string - `effective_from`: string - `dry_run`: boolean - `applied`: boolean - `revision`: string — Profile revision at preview, or after the committed change. - `bucket_costs`: object[] - `bucket_id`: integer - `previous_cost`: number - `cost`: number - `effective_until`: string | null — Exclusive end: next existing period boundary, or null when open-ended. - `changed`: boolean ### Ads Ads management — campaign / ad-set / ad status and budget writes (Meta + Google) #### PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget Update an ad set daily budget (meta-ads only) Updates the daily budget of a Meta ad set. `meta-ads` only — Google Ads ad groups have no own budget (returns 400); update the campaign budget instead. The budget is the DAILY budget in the ad account currency (e.g. `50` = 50.00). The change is applied on the ad platform immediately and mirrored into Venon. Ids are platform ids as returned by the analytics endpoints. **Required scope:** `ads:write` **Rate limit:** 10 requests per minute per API key budget replaces the daily amount; it is not a delta or a lifetime budget. Send currency units with at most two decimal places, not cents or micros. These operations have no dry_run. The ad account currency may differ from the shop currency used in shop reports; read budget_currency. Google campaign writes change the underlying shared CampaignBudget and can affect sibling campaigns; Venon immediately mirrors only the named campaign, so sibling mirrors can lag. Meta currently assumes two-decimal currency scaling; zero-decimal currencies such as JPY/KRW are unsupported by this convention. Path parameters: - `channel` ("meta-ads" | "google-ads", required): Ad channel — only Meta and Google Ads support writes. - `ad_set_id` (string, required): Platform ad set id — as returned by the analytics endpoints/tools. Request body (object): - `budget` (number, required): New daily budget in the ad account currency (e.g. 50 = 50.00 EUR/USD), max 2 decimal places. Converted to platform units (cents / micros) server-side. Response (success envelope `data`): - `data`: AdsAdSetResult - `ad_set_id`: string — Platform ad set (ad group) ID - `channel`: "meta-ads" | "google-ads" — Ad channel — only Meta and Google Ads support writes. - `name`: string — Ad set name - `active`: boolean — Whether the ad set is active after the update - `budget`: number — Daily budget after the update (budget writes only) - `budget_currency`: string | null — ISO 4217 currency the `budget` value is expressed in — the ad account currency, NOT the shop currency in response metadata. Budget writes only. #### PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/status Activate or pause an ad set Activates or pauses a Meta ad set / Google Ads ad group. The change is applied on the ad platform immediately and mirrored into Venon. Ids are platform ids as returned by the analytics endpoints. **Required scope:** `ads:write` **Rate limit:** 10 requests per minute per API key enabled sets the requested state; it is not a toggle. These operations have no dry_run. A successful activation does not guarantee ad delivery, which also depends on parent state and platform eligibility. Google Performance Max child ad sets/ads cannot be edited individually; use their campaign instead. Google ad group IDs are not listed by the ad-set performance report (it is empty for google-ads, and Google ad rows carry no ad_set_id); take the ad group ID from Google Ads. Path parameters: - `channel` (required): as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget` - `ad_set_id` (required): as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget` Request body (object): - `enabled` (boolean, required): true → activate (status ACTIVE/ENABLED), false → pause. Response (success envelope `data`): - `data`: AdsAdSetResult (fields as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget`) #### PATCH /v1/ads/{channel}/ads/{ad_id}/status Activate or pause an ad Activates or pauses a single Meta / Google ad. (Same note as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/status`.) **Required scope:** `ads:write` **Rate limit:** 10 requests per minute per API key (Same note as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/status`.) Path parameters: - `channel` (required): as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget` - `ad_id` (string, required): Platform ad id — as returned by the analytics endpoints/tools. Request body (object): - `enabled` (boolean, required): true → activate (status ACTIVE/ENABLED), false → pause. Response (success envelope `data`): - `data`: AdsAdResult - `ad_id`: string — Platform ad ID - `channel`: "meta-ads" | "google-ads" — Ad channel — only Meta and Google Ads support writes. - `name`: string — Ad name - `active`: boolean — Whether the ad is active after the update #### PATCH /v1/ads/{channel}/campaigns/{campaign_id}/budget Update a campaign daily budget Updates the daily budget of a Meta / Google Ads campaign. (Same note as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget`.) **Required scope:** `ads:write` **Rate limit:** 10 requests per minute per API key (Same note as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget`.) Path parameters: - `channel` (required): as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget` - `campaign_id` (string, required): Platform campaign id — as returned by the analytics endpoints/tools. Request body (object): - `budget` (number, required): New daily budget in the ad account currency (e.g. 50 = 50.00 EUR/USD), max 2 decimal places. Converted to platform units (cents / micros) server-side. Response (success envelope `data`): - `data`: AdsCampaignResult - `campaign_id`: string — Platform ad campaign ID - `channel`: "meta-ads" | "google-ads" — Ad channel — only Meta and Google Ads support writes. - `name`: string — Campaign name - `active`: boolean — Whether the campaign is active after the update - `budget`: number — Daily budget after the update (budget writes only) - `budget_currency`: string | null — ISO 4217 currency the `budget` value is expressed in — the ad account currency, NOT the shop currency in response metadata. Budget writes only. #### PATCH /v1/ads/{channel}/campaigns/{campaign_id}/status Activate or pause a campaign Activates or pauses a Meta / Google Ads campaign. (Same note as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/status`.) **Required scope:** `ads:write` **Rate limit:** 10 requests per minute per API key (Same note as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/status`.) Path parameters: - `channel` (required): as under `PATCH /v1/ads/{channel}/ad-sets/{ad_set_id}/budget` - `campaign_id` (required): as under `PATCH /v1/ads/{channel}/campaigns/{campaign_id}/budget` Request body (object): - `enabled` (boolean, required): true → activate (status ACTIVE/ENABLED), false → pause. Response (success envelope `data`): - `data`: AdsCampaignResult (fields as under `PATCH /v1/ads/{channel}/campaigns/{campaign_id}/budget`) ### Data Filters Saved data filters: the dashboard report filters, and how to apply them to report endpoints #### GET /v1/data-filters List saved data filters Lists the shop's saved data filters (dashboard Settings > Data Filters) with their conditions and enabled state. Pass their ids to a report endpoint with `filter_mode=selected` to apply them. **Required scope:** `filters:read` **Rate limit:** 60 requests per minute per API key A saved data filter belongs to one source: shopify or an ad channel. Conditions in a group must all match and at least one group must match: (A AND B) OR (C AND D). Shopify fields: order_name, sales_channel and order_tags (contains, does_not_contain, starts_with, does_not_start_with, is_any_of, is_none_of), shipping_country (ISO 3166-1 alpha-2 code) and payment_gateway (is_any_of, is_none_of). sales_channel is the channel the Shopify admin shows for the order (e.g. Online Store, Point of Sale, Draft Orders, a marketplace or the creating app; Unknown without one), not the Venon attribution channel. order_tags matches each current tag on its own: is_any_of needs one exact tag, is_none_of drops orders with any listed tag. Orders whose tags and channel are not synced yet count as missing values. The values a field can pick (sales channels, tags, ad names and ids) are listed by the data filter options (REST GET /v1/data-filters/options, MCP list_data_filter_values). Ad fields: campaign_name, ad_set_name, ad_name (all operators) and campaign_id, ad_set_id, ad_id (platform ids; is_any_of, is_none_of). Matching ignores case; a missing value fails is_any_of, contains and starts_with and passes is_none_of, does_not_contain and does_not_start_with. At most 10 groups and 10 conditions in total, 100 values of up to 256 characters per condition, 5,000 bytes of values per filter and 20 saved filters per shop. An update replaces the whole filter. A stored filter that no longer passes these rules or limits is left out of lists and reports, and the response warns about it (warnings: how many filters are stored and which were skipped, by id and reason) instead of failing. ## Saved-filter support matrix | MCP tool | REST endpoint | filter_mode / filter_ids | | ------------------------------- | ----------------------------- | ------------------------ | | get_channel_performance | GET /v1/analytics/channels | Yes | | get_campaign_performance | GET /v1/analytics/campaigns | Yes | | get_ad_set_performance | GET /v1/analytics/ad-sets | Yes | | get_ad_performance | GET /v1/analytics/ads | Yes | | get_analytics_summary | GET /v1/analytics/summary | Yes | | get_metrics_timeseries | GET /v1/analytics/timeseries | Yes | | get_attributed_orders | GET /v1/attribution/orders | Yes | | get_attributed_products | GET /v1/attribution/products | Yes | | get_non_ad_campaign_performance | GET /v1/attribution/campaigns | Yes | No saved-filter selection: list_orders, get_order_cost_breakdown, list_order_cost_breakdowns (GET /v1/orders and its breakdown routes); get_product_performance and lookup_products (GET /v1/products and /v1/products/catalog); get_profit_loss, get_cohorts, get_retention and get_product_relationships (their /v1/analytics routes). Their other named filters are separate features. Do not assume unsupported reports reproduce a filtered dashboard comparison. Response (success envelope `data`): - `data`: DataFilterList - `data_filters`: DataFilter[] - `source`: "shopify" | "meta-ads" | "google-ads" | "taboola" | "tiktok-ads" | "outbrain" | "microsoft-ads" | "pinterest-ads" - `title`: string - `description`: string | null - `enabled`: boolean - `groups`: object[][] - `field`: "campaign_name" | "ad_set_name" | "ad_name" | "order_name" | "order_tags" | "sales_channel" | "campaign_id" | "ad_set_id" | "ad_id" | "shipping_country" | "payment_gateway" - `operator`: "is_any_of" | "is_none_of" | "contains" | "does_not_contain" | "starts_with" | "does_not_start_with" - `values`: string[] - `id`: string #### POST /v1/data-filters Create a saved data filter Creates a saved data filter. An enabled filter immediately narrows the dashboard and Pixel reports of every user of this shop. Create is not deduplicated and each duplicate consumes one of the 20 saved-filter slots. Read the filter list before an uncertain retry. **Required scope:** `filters:write` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/data-filters`.) ## Saved-filter support matrix (Same note as under `GET /v1/data-filters`.) Request body (DataFilterInput): - `source` ("shopify" | "meta-ads" | "google-ads" | "taboola" | "tiktok-ads" | "outbrain" | "microsoft-ads" | "pinterest-ads", required) - `title` (string, required) - `description` (string | null, required) - `enabled` (boolean, required) - `groups` (object[][], required) - `field` ("campaign_name" | "ad_set_name" | "ad_name" | "order_name" | "order_tags" | "sales_channel" | "campaign_id" | "ad_set_id" | "ad_id" | "shipping_country" | "payment_gateway", required) - `operator` ("is_any_of" | "is_none_of" | "contains" | "does_not_contain" | "starts_with" | "does_not_start_with", required) - `values` (string[], required) Response (success envelope `data`): - `data`: DataFilter (fields as under `GET /v1/data-filters`) #### GET /v1/data-filters/options List values for filter conditions Lists values a condition can use with is_any_of / is_none_of: the sales channels and order tags of the shop's orders (most used first), or the campaign, ad set and ad names and platform ids of an ad channel (ids labelled with their names). Search with `q`. At most 50 matching suggestions; narrow q to find a value. Absence from suggestions is not proof that no such value exists. **Required scope:** `filters:read` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/data-filters`.) ## Saved-filter support matrix (Same note as under `GET /v1/data-filters`.) Query parameters: - `source` ("shopify" | "meta-ads" | "google-ads" | "taboola" | "tiktok-ads" | "outbrain" | "microsoft-ads" | "pinterest-ads", required): Filter source: shopify or an ad channel - `field` ("sales_channel" | "order_tags" | "campaign_name" | "ad_set_name" | "ad_name" | "campaign_id" | "ad_set_id" | "ad_id", required): shopify: sales_channel or order_tags. Ad channels: campaign_name, ad_set_name, ad_name, campaign_id, ad_set_id or ad_id - `q` (string): Case-insensitive search within the values Response (success envelope `data`): - `data`: DataFilterOptions - `options`: object[] — Up to 50 values; order metadata most used first - `value`: string — Value to use in a condition - `label`: string — Display name (the entity name for platform ids) #### PUT /v1/data-filters/{id} Replace a saved data filter Replaces a saved data filter (title, description, enabled, source and all groups). Set `enabled` to switch it on or off for the dashboard. **Required scope:** `filters:write` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/data-filters`.) ## Saved-filter support matrix (Same note as under `GET /v1/data-filters`.) Path parameters: - `id` (string, required): Saved data filter id Request body (DataFilterInput): - `source` ("shopify" | "meta-ads" | "google-ads" | "taboola" | "tiktok-ads" | "outbrain" | "microsoft-ads" | "pinterest-ads", required) - `title` (string, required) - `description` (string | null, required) - `enabled` (boolean, required) - `groups` (object[][], required) - `field` ("campaign_name" | "ad_set_name" | "ad_name" | "order_name" | "order_tags" | "sales_channel" | "campaign_id" | "ad_set_id" | "ad_id" | "shipping_country" | "payment_gateway", required) - `operator` ("is_any_of" | "is_none_of" | "contains" | "does_not_contain" | "starts_with" | "does_not_start_with", required) - `values` (string[], required) Response (success envelope `data`): - `data`: DataFilter (fields as under `GET /v1/data-filters`) #### DELETE /v1/data-filters/{id} Delete a saved data filter Deletes a saved data filter; the dashboard and Pixel reports stop applying it. A delete 404 can mean the filter was already removed; read the list before deciding to retry. **Required scope:** `filters:write` **Rate limit:** 60 requests per minute per API key (Same note as under `GET /v1/data-filters`.) ## Saved-filter support matrix (Same note as under `GET /v1/data-filters`.) Path parameters: - `id` (required): as under `PUT /v1/data-filters/{id}` Response (success envelope `data`): - `data`: object - `deleted`: true