MerchantFlow Orders API

The Orders API from MerchantFlow — 2 operation(s) for orders.

GitHub OpenAPI

Operations 2

GET /orders List orders with their economics #
GET /orders/{id} Fetch one order #

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-orders-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-orders-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: MerchantFlow Public Orders 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: Orders
paths:
  /orders:
    get:
      operationId: listOrders
      summary: List orders with their economics
      description: 'The main endpoint. Pass `updated_after` to receive only what has changed since

        your last sync, including orders whose COGS, fulfilment cost or attribution were

        corrected after they were placed.


        Results are ordered oldest-change-first, so the `updated_at` of the last record

        you successfully processed is always a safe watermark to resume from.


        When the store has exceeded its monthly order allowance, orders placed after the

        allowance-th order of the current month are not listed (and `GET /orders/{id}`

        answers 404 for them) until the allowance resets or the plan is upgraded. They are

        not lost, but an order that becomes visible later keeps its earlier `updated_at`,

        so re-read the current month in full after an upgrade rather than relying on the

        watermark.'
      tags:
      - Orders
      security:
      - oauth2:
        - orders:read
      parameters:
      - $ref: '#/components/parameters/updatedAfter'
      - name: created_after
        in: query
        description: Only orders placed on or after this date (YYYY-MM-DD), resolved as start-of-day in the store timezone.
        schema:
          type: string
          format: date
      - name: created_before
        in: query
        description: Only orders placed on or before this date (YYYY-MM-DD), resolved as end-of-day in the store timezone.
        schema:
          type: string
          format: date
      - name: status
        in: query
        description: Defaults to revenue-bearing orders only (paid, completed, processing, partially refunded, refunded; cancelled excluded) - the same definition the merchant's own dashboard totals use. Pass `all` to include cancelled orders for reconciliation.
        schema:
          type: string
          enum:
          - default
          - all
      - name: sales_channel
        in: query
        description: '`d2c` for storefront orders, `b2b` for wholesale.'
        schema:
          type: string
          enum:
          - d2c
          - b2b
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/cursor'
      responses:
        '200':
          description: A page of orders.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Order'
                  meta:
                    $ref: '#/components/schemas/Meta'
                  page:
                    $ref: '#/components/schemas/Page'
        '400':
          description: Invalid parameter, or a cursor reused with different filters (`CURSOR_FILTER_MISMATCH`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
  /orders/{id}:
    get:
      operationId: getOrder
      summary: Fetch one order
      tags:
      - Orders
      security:
      - oauth2:
        - orders:read
      parameters:
      - name: id
        in: path
        required: true
        description: A MerchantFlow order id, or `external:<platform order id>` to look up by the commerce platform's id - e.g. `external:5123456789012`.
        schema:
          type: string
      responses:
        '200':
          description: The order.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/Order'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  responses:
    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'
    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'
    NotFound:
      description: No such record for this store. Returned rather than 403 for a record belonging to another store, so ids cannot be probed.
      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
    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
    Page:
      type: object
      properties:
        has_more:
          type: boolean
        next_cursor:
          type:
          - string
          - 'null'
        limit:
          type: integer
    OrderLineItem:
      type: object
      properties:
        id:
          type: string
        sku:
          type:
          - string
          - 'null'
        name:
          type: string
        product_id:
          type:
          - string
          - 'null'
        variant_id:
          type:
          - string
          - 'null'
        quantity:
          type: integer
        price:
          type: number
          description: Unit price before discount.
        total:
          type: number
          description: Post-discount line revenue. Legitimately 0 for a fully discounted line such as a warranty replacement.
        cogs:
          type: number
          description: Amount in the order currency.
        fulfillment_cost:
          type: number
          description: Amount in the order currency.
        refund_amount:
          type: number
          description: Amount in the order currency.
        refunded_quantity:
          type: integer
    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'
    Order:
      type: object
      properties:
        id:
          type: string
          description: MerchantFlow order id.
        external_order_id:
          type: string
          description: The commerce platform's own order id. For Shopify this is the NUMERIC legacy id, e.g. "5123456789012".
        external_order_gid:
          type:
          - string
          - 'null'
          description: Shopify GraphQL global id, derived from external_order_id. Null for non-Shopify stores.
        order_number:
          type: string
        platform:
          type: string
        store_id:
          type: string
        created_at:
          type: string
          format: date-time
          description: When the order was placed.
        updated_at:
          type: string
          format: date-time
          description: The value updated_after compares against. Advances on financial changes, not only edits.
        canceled_at:
          type:
          - string
          - 'null'
          format: date-time
        refunded_at:
          type:
          - string
          - 'null'
          format: date-time
        currency:
          type: string
        financial_status:
          type: string
        fulfillment_status:
          type:
          - string
          - 'null'
        sales_channel:
          type: string
          enum:
          - d2c
          - b2b
        is_first_order:
          type: boolean
          description: True when this is the customer's first order with this store.
        customer_order_sequence:
          type:
          - integer
          - 'null'
          description: 1 for a first purchase, 2 for the second, and so on. Distinguishes new from repeat buyers with no identifier at all.
        is_subscription_renewal:
          type: boolean
        economics:
          $ref: '#/components/schemas/OrderEconomics'
        attribution:
          $ref: '#/components/schemas/OrderAttribution'
        shipping_country_code:
          type:
          - string
          - 'null'
          description: ISO 3166-1 alpha-2. The only location data returned.
        customer_ref:
          type:
          - string
          - 'null'
          description: Pseudonymous customer identifier. Stable for your application and this merchant, so you can group a customer's orders. Deliberately NOT stable across applications, and not reversible to an email address. Null for orders with no customer email.  This is pseudonymous personal data under GDPR, not anonymous data. Handle it accordingly and do not attempt re-identification.
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/OrderLineItem'
    OrderAttribution:
      type: object
      properties:
        primary_source:
          type:
          - string
          - 'null'
        is_paid:
          type: boolean
        utm_source:
          type:
          - string
          - 'null'
        utm_medium:
          type:
          - string
          - 'null'
        utm_campaign:
          type:
          - string
          - 'null'
        utm_term:
          type:
          - string
          - 'null'
        utm_content:
          type:
          - string
          - 'null'
        landing_page:
          type:
          - string
          - 'null'
          description: Landing URL with query parameters, fragments, and URL credentials removed.
        referrer:
          type:
          - string
          - 'null'
          description: Referring hostname only. Paths, query parameters, fragments, and URL credentials are removed.
        device_type:
          type:
          - string
          - 'null'
    OrderEconomics:
      type: object
      properties:
        gross_revenue:
          type: number
          description: Amount in the order currency.
        shipping_revenue:
          type: number
          description: Amount in the order currency.
        discount:
          type: number
          description: Amount in the order currency.
        tax:
          type: number
          description: Amount in the order currency.
        tax_included_in_price:
          type: boolean
        refunds:
          type: number
          description: Amount in the order currency.
        net_revenue:
          type: number
          description: gross_revenue minus refunds.
        cogs:
          type: number
          description: Amount in the order currency.
        cogs_source:
          type: string
          description: '`cogs_map` (resolved from the merchant''s cost table) or `3pl_actual` (billed by the fulfilment provider).'
        cogs_coverage_pct:
          type:
          - number
          - 'null'
          description: Percentage of units on this order that have cost data. Below 100 means `cogs` understates true cost and margin is overstated. Null when the order has no line items.
        fulfillment_cost:
          type:
          - number
          - 'null'
        fulfillment_cost_source:
          type:
          - string
          - 'null'
        payment_fee:
          type:
          - number
          - 'null'
          description: Payment processing fee for this order. See payment_fee_source - it may be an estimate from the merchant's payment fee rules rather than a fee the processor reported. Null when no fee is known.
        payment_fee_source:
          type:
          - string
          - 'null'
          enum:
          - platform
          - rule
          - manual
          - null
          description: 'Where payment_fee came from. `platform`: reported by the commerce platform or payment processor. `rule`: estimated from the merchant''s payment fee rule for this gateway (percentage plus fixed amount), because the platform reported no fee - label it as an estimate when displayed. `manual`: entered by the merchant on a manual order. Null when payment_fee is null.'
        ad_spend_allocated:
          type: number
          description: This order's share of the day's ad spend. See ad_spend_basis - it is an allocation, not measured spend.
        ad_spend_basis:
          type: string
          const: blended_daily_allocation
          description: How ad_spend_allocated was derived. A day's total spend is divided across that day's eligible orders; no ad platform reports spend per order. Do not present this as measured per-order or per-funnel ad spend.
        contribution_profit:
          type: number
          description: net_revenue - cogs - ad_spend_allocated - payment_fee - fulfillment_cost.
        contribution_margin_pct:
          type: number
        allocated_overhead:
          type: number
          description: This order's share of operating expenses not already deducted above.
        net_profit:
          type: number
          description: contribution_profit - allocated_overhead.
        net_margin_pct:
          type: number
  parameters:
    cursor:
      name: cursor
      in: query
      description: Opaque pagination cursor from a previous response's `page.next_cursor`. A cursor is bound to the exact filters it was created with - reusing one with different filters returns `400 CURSOR_FILTER_MISMATCH` rather than silently returning a page computed against the wrong query.
      schema:
        type: string
    limit:
      name: limit
      in: query
      description: Page size. Defaults to 100.
      schema:
        type: integer
        minimum: 1
        maximum: 250
        default: 100
    updatedAfter:
      name: updated_after
      in: query
      description: 'Return only records whose data changed at or after this instant (RFC 3339).

        This is the incremental-sync entry point, and it tracks FINANCIAL changes, not

        just edits: a COGS correction or a 3PL fulfilment cost arriving days after an

        order was placed will bring that order back through this filter.


        Resume from your last seen `updated_at` minus a few minutes and upsert

        idempotently - the feed is at-least-once, not exactly-once.'
      schema:
        type: string
        format: date-time
  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