MerchantFlow Metrics API

The Metrics API from MerchantFlow — 4 operation(s) for metrics.

GitHub OpenAPI

Operations 4

GET /metrics/mer Marketing Efficiency Ratio for a window #
GET /metrics/revenue D2C gross revenue for a window #
GET /metrics/ad-spend Advertising spend for a window #
GET /metrics/contribution-profit Contribution profit for a window #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/merchantflow-ai:merchantflow-ai-metrics-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

merchantflow-ai-metrics-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: MerchantFlow Public Metrics API
  version: 1.0.0
  summary: Read-only access to a merchant's headline metrics, orders, products, and profitability.
  description: 'The MerchantFlow Public API lets an authorised third-party application read a

    merchant''s headline metrics, order economics, products, and profit and loss.


    **Read-only.** Every endpoint is `GET`. There are no write scopes to request.


    **Ask for the narrowest scope that works.** The `metrics:*` scopes each return

    ONE figure. If your integration needs MER, request `metrics:mer:read` rather than

    `profitability:read` - the latter returns the entire P&L waterfall including COGS,

    expenses and net profit, and merchants decline it far more often. MerchantFlow

    provisions each partner with an allowlist of the scopes it may request at all; a

    scope outside that list is refused at `/authorize`, before any merchant sees a

    consent screen.


    **No customer PII.** Customer names, email addresses, phone numbers and shipping

    addresses are never returned. Orders carry `customer_ref`, a pseudonymous

    identifier that is stable for your application and for one merchant, and is not

    correlatable with any other application''s identifiers.


    **Two numbers need care.** `ad_spend_allocated` is a blended daily allocation, not

    measured per-order ad spend - no ad platform reports spend at order granularity.

    And `cogs_coverage_pct` tells you how much of an order actually has cost data;

    a high margin on an order with low coverage is missing costs, not profit.'
  contact:
    name: MerchantFlow
    url: https://docs.merchantflow.ai/docs/integrations/api
servers:
- url: https://merchantflow.ai/api/v1
  description: Production
security:
- oauth2: []
tags:
- name: Metrics
paths:
  /metrics/mer:
    get:
      operationId: getMer
      summary: Marketing Efficiency Ratio for a window
      description: 'MER for a date range, and nothing else. Use this instead of

        `/profitability/summary` when your integration needs the ratio rather than the

        full P&L - it is the narrowest scope that answers the question, and merchants

        approve it far more readily.


        `mer` is D2C gross revenue divided by deduplicated blended ad spend, the same

        definition as the merchant''s own dashboard. Wholesale (B2B) revenue is excluded

        from the numerator: it was not bought with ad spend.


        `mer` is `null` when no ad spend is recorded for the window - that is "no

        campaigns ran", not "campaigns returned nothing".


        `revenue` and `ad_spend` require `metrics:revenue:read` and

        `metrics:ad_spend:read` respectively, independently of `metrics:mer:read`. A

        field you do not hold the scope for is ABSENT from the payload and named in

        `meta.omitted_fields` - never returned as null.'
      tags:
      - Metrics
      security:
      - oauth2:
        - metrics:mer:read
      parameters:
      - $ref: '#/components/parameters/metricFrom'
      - $ref: '#/components/parameters/metricTo'
      responses:
        '200':
          description: MER for the window.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/MerMetric'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No advertising spend is recorded for the window, and the token carries neither `metrics:revenue:read` nor `metrics:ad_spend:read`, so there is nothing to return.
        '429':
          $ref: '#/components/responses/RateLimited'
  /metrics/revenue:
    get:
      operationId: getRevenueMetric
      summary: D2C gross revenue for a window
      description: 'Direct-to-consumer gross revenue for a date range, as a single total.

        Wholesale (B2B) revenue is excluded, matching the MER numerator.


        The standalone form of the `revenue` field on `/metrics/mer`, for integrations

        that hold `metrics:revenue:read` without `metrics:mer:read`. Both return the

        same figure for the same window.'
      tags:
      - Metrics
      security:
      - oauth2:
        - metrics:revenue:read
      parameters:
      - $ref: '#/components/parameters/metricFrom'
      - $ref: '#/components/parameters/metricTo'
      responses:
        '200':
          description: Revenue for the window.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/RevenueMetric'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
  /metrics/ad-spend:
    get:
      operationId: getAdSpendMetric
      summary: Advertising spend for a window
      description: 'Deduplicated blended advertising spend for a date range, as a single total.

        The same campaign arriving from two connected ad accounts is counted once.


        The standalone form of the `ad_spend` field on `/metrics/mer`, for integrations

        that hold `metrics:ad_spend:read` without `metrics:mer:read`. Both return the

        same figure for the same window.'
      tags:
      - Metrics
      security:
      - oauth2:
        - metrics:ad_spend:read
      parameters:
      - $ref: '#/components/parameters/metricFrom'
      - $ref: '#/components/parameters/metricTo'
      responses:
        '200':
          description: Advertising spend for the window.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/AdSpendMetric'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
  /metrics/contribution-profit:
    get:
      operationId: getContributionProfit
      summary: Contribution profit for a window
      description: 'Contribution profit (CM3) for a date range - revenue less COGS, shipping,

        fulfilment, payment fees and ad spend - as a single figure.


        The cost lines behind it are NOT returned. Request `profitability:read` if you

        need the waterfall; this endpoint exists so that you do not have to.'
      tags:
      - Metrics
      security:
      - oauth2:
        - metrics:contribution_profit:read
      parameters:
      - $ref: '#/components/parameters/metricFrom'
      - $ref: '#/components/parameters/metricTo'
      responses:
        '200':
          description: Contribution profit for the window.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/ContributionProfitMetric'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  responses:
    Forbidden:
      description: The token lacks the scope this endpoint requires.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, expired, or revoked token. The `WWW-Authenticate` header names the protected-resource metadata document so you can rediscover the authorization server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: 'Budget exhausted. `Retry-After` gives the seconds to wait and `X-RateLimit-Reason` says which limit was hit: `burst`, `hour`, `day`, `concurrency`, or `client_global`.  `concurrency` means too many requests are in flight for one store at once - page cursors sequentially rather than in parallel. `client_global` means your application exceeded its budget across ALL connected stores; stagger scheduled syncs instead of starting every store at the same moment.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
    RevenueMetric:
      type: object
      properties:
        currency:
          type: string
          description: ISO 4217.
        period:
          $ref: '#/components/schemas/MetricPeriod'
        revenue:
          type: number
          description: D2C gross revenue for the window, to 2dp.
      required:
      - currency
      - period
      - revenue
    AdSpendMetric:
      type: object
      properties:
        currency:
          type: string
          description: ISO 4217.
        period:
          $ref: '#/components/schemas/MetricPeriod'
        ad_spend:
          type: number
          description: Deduplicated blended advertising spend for the window, to 2dp.
      required:
      - currency
      - period
      - ad_spend
    MerMetric:
      type: object
      description: Marketing Efficiency Ratio. `revenue` and `ad_spend` are present only when the token carries their own scopes.
      properties:
        currency:
          type: string
          description: ISO 4217.
        period:
          $ref: '#/components/schemas/MetricPeriod'
        mer:
          type:
          - number
          - 'null'
          description: D2C gross revenue / deduplicated ad spend, to 2dp. Null when no ad spend is recorded for the window.
        revenue:
          type: number
          description: 'The MER numerator: D2C gross revenue. Requires `metrics:revenue:read`.'
        ad_spend:
          type: number
          description: 'The MER denominator: deduplicated blended ad spend. Requires `metrics:ad_spend:read`.'
      required:
      - currency
      - period
      - mer
    MetricPeriod:
      type: object
      description: The window actually computed. May start later than you asked if the store's plan history window is shorter, in which case `meta.truncated` is true.
      properties:
        from:
          type: string
          format: date
        to:
          type: string
          format: date
    Meta:
      type: object
      description: Provenance attached to every response.
      properties:
        store_id:
          type: string
        currency:
          type: string
          description: ISO 4217 for this store.
        timezone:
          type: string
          description: IANA timezone. All date-only filters resolve in it.
        as_of:
          type:
          - string
          - 'null'
          format: date-time
          description: When this store last synced. Not the request time.
        stale:
          type: boolean
          description: True when the last sync is more than 24 hours old.
        history_available_from:
          type:
          - string
          - 'null'
          description: Earliest date this store's plan includes (YYYY-MM-DD), or null for unlimited history.
        truncated:
          type: boolean
          description: True when the request reached further back than the plan includes. Everything from history_available_from onwards is present and complete.
        order_allowance:
          $ref: '#/components/schemas/OrderAllowance'
    OrderAllowance:
      type: object
      description: Present only on the metrics and profitability endpoints, and only when the store has exceeded its monthly order allowance and the window you asked for holds orders past it. The response still covers the whole window, but order-derived figures (revenue, COGS, fees, refunds, order counts, profit) leave those orders out; ad spend and expenses are complete. These are the same figures the merchant's own dashboard shows. Absent when every order in the window is counted.
      properties:
        status:
          type: string
          enum:
          - partial
        missing_orders:
          type: integer
          description: Orders in the requested window placed after the store passed its monthly allowance, left out of the figures.
        resets_at:
          type: string
          format: date-time
          description: When the allowance resets (the start of the store's next calendar month). Later months count every order again, and an upgrade includes them sooner.
      required:
      - status
      - missing_orders
      - resets_at
    ContributionProfitMetric:
      type: object
      properties:
        currency:
          type: string
          description: ISO 4217.
        period:
          $ref: '#/components/schemas/MetricPeriod'
        contribution_profit:
          type: number
          description: Revenue less COGS, shipping, fulfilment, payment fees and ad spend, to 2dp.
      required:
      - currency
      - period
      - contribution_profit
  parameters:
    metricTo:
      name: to
      in: query
      description: Last day of the window (inclusive), YYYY-MM-DD, resolved in the STORE's timezone. Defaults to today. Accepts `end_date` as an alias. A window may span at most 400 days.
      schema:
        type: string
        format: date
    metricFrom:
      name: from
      in: query
      description: First day of the window (inclusive), YYYY-MM-DD, resolved in the STORE's timezone rather than UTC. Defaults to 29 days before `to`. Accepts `start_date` as an alias, matching the other endpoints.
      schema:
        type: string
        format: date
  securitySchemes:
    oauth2:
      type: oauth2
      description: 'OAuth 2.1 authorization code flow with PKCE (S256 required).


        Send the RFC 8707 resource indicator `resource=https://merchantflow.ai/api/v1` at both

        the authorize and token endpoints. If you omit it, MerchantFlow infers it from

        your requested scopes, but sending it explicitly is strongly preferred.


        Request `offline_access` alongside your data scopes to receive a refresh token;

        without it your access token expires after one hour and the merchant has to

        repeat the browser consent flow.'
      flows:
        authorizationCode:
          authorizationUrl: https://merchantflow.ai/api/auth/oauth2/authorize
          tokenUrl: https://merchantflow.ai/api/auth/oauth2/token
          refreshUrl: https://merchantflow.ai/api/auth/oauth2/token
          scopes:
            store:read: Read your store name, currency, timezone, and data freshness
            metrics:mer:read: Read your Marketing Efficiency Ratio (MER) for a date range - the ratio only, not the underlying figures
            metrics:revenue:read: Read the revenue total used to calculate MER (D2C gross revenue) for a date range
            metrics:ad_spend:read: Read the advertising spend total used to calculate MER for a date range
            metrics:contribution_profit:read: Read your contribution profit total for a date range - the single figure, not the cost breakdown behind it
            orders:read: Read your orders and their economics (revenue, COGS, fees, profit). Includes a pseudonymous customer reference so the app can tell repeat buyers from new ones - never names, email addresses, phone numbers, or shipping addresses
            products:read: Read your products, variants, and cost of goods sold
            profitability:read: Read your full profit & loss summary and daily profit history, including COGS, expenses and net profit
            offline_access: Receive a refresh token
externalDocs:
  url: https://docs.merchantflow.ai/docs/integrations/api
  description: Integration guide
x-rate-limits:
  description: Per store per application, except client_global which is per application across every store it is connected to.
  burst_per_minute: 60
  per_hour: 1000
  per_day: 10000
  max_concurrent: 2
  client_global_per_minute: 200