> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnicommerce.sg/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Profit Analytics

> Revenue, costs, fees, and profit with a waterfall, cost breakdowns, a daily trend, the most and least profitable products, and products missing a cost price. Session members also need finance access. Matches the P&L Analysis page. Requires `analytics:read`.

Amounts are in `data.filters.currency`. Only orders in that currency are counted; nothing is converted. A range covers at most 366 days.



## OpenAPI

````yaml /openapi.json get /api/v1/analytics/profit
openapi: 3.1.0
info:
  title: OmniCommerce API
  version: 1.0.0
  license:
    name: Proprietary
    url: https://omnicommerce.sg/terms
  description: >-
    OmniCommerce API surface for agents and developer integrations. Includes
    public endpoints (merchant discovery, product search, compare, catalog, ACO
    retrieval) and authenticated endpoints (product management via API key
    Bearer tokens).
servers:
  - url: https://omnicommerce.sg
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: agentic-checkout
    description: Merchant-fulfilled agentic checkout
    x-group: Agentic Checkout
  - name: agents
    description: agents
    x-group: Agents
  - name: analytics
    description: Sales performance across marketplaces
    x-group: Analytics
  - name: aops
    description: Agent operating procedures
    x-group: AOPs
  - name: campaigns
    description: Campaign briefs, offer windows, and marketplace runs
    x-group: Campaigns
  - name: developer-platform
    description: Authenticated developer platform APIs
    x-group: Developer Platform
  - name: looks
    description: AI-styled product looks
    x-group: Looks
  - name: oauth
    description: OAuth token endpoints
    x-group: OAuth
  - name: orders
    description: Workspace and agentic orders
    x-group: Orders
  - name: organizations
    description: Organization management
    x-group: Organizations
  - name: price-books
    description: Marketplace list-price markup rules
    x-group: Price Books
  - name: products
    description: Product CRUD, bulk import, enrichment, publish, and delist
    x-group: Products
  - name: promotions
    description: Central promotions and marketplace sync
    x-group: Promotions
  - name: public-agent
    description: Public agent discovery and catalog APIs
    x-group: Public Agent
  - name: returns
    description: returns
    x-group: Returns
  - name: reviews
    description: Marketplace product reviews and seller replies
    x-group: Reviews
  - name: settlements
    description: settlements
    x-group: Settlements
  - name: ucp
    description: Universal Commerce Protocol
    x-group: UCP
paths:
  /api/v1/analytics/profit:
    get:
      tags:
        - analytics
      summary: Get Profit Analytics
      description: >-
        Revenue, costs, fees, and profit with a waterfall, cost breakdowns, a
        daily trend, the most and least profitable products, and products
        missing a cost price. Session members also need finance access. Matches
        the P&L Analysis page. Requires `analytics:read`.


        Amounts are in `data.filters.currency`. Only orders in that currency are
        counted; nothing is converted. A range covers at most 366 days.
      operationId: get_v1_analytics_profit
      parameters:
        - name: organizationId
          in: query
          required: false
          description: >-
            Required for session auth. API keys already belong to one
            organization.
          schema:
            type: string
            maxLength: 160
        - name: from
          in: query
          required: false
          description: >-
            First day of the range (YYYY-MM-DD). Defaults to 29 days before
            `to`.
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
        - name: to
          in: query
          required: false
          description: Last day of the range, inclusive (YYYY-MM-DD). Defaults to today.
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
        - name: timeZone
          in: query
          required: false
          description: >-
            IANA time zone that defines each day, for example
            `Asia/Kuala_Lumpur`. Defaults to Asia/Singapore.
          schema:
            type: string
            maxLength: 80
        - name: marketplace
          in: query
          required: false
          description: Comma-separated marketplaces, for example `shopee,lazada`.
          schema:
            type: string
            maxLength: 200
        - name: country
          in: query
          required: false
          description: Comma-separated countries. One country selects its currency.
          schema:
            type: string
            maxLength: 200
        - name: store
          in: query
          required: false
          description: >-
            Comma-separated store (account) ids from `GET
            /api/v1/marketplaces/connected`.
          schema:
            type: string
            maxLength: 1000
        - name: currency
          in: query
          required: false
          description: >-
            ISO currency. Only orders in this currency are counted; amounts are
            not converted. Defaults to the single country's currency, otherwise
            SGD.
          schema:
            type: string
            maxLength: 3
        - name: sku
          in: query
          required: false
          description: Comma-separated SKUs to report only those products.
          schema:
            type: string
            maxLength: 1000
      responses:
        '200':
          description: Get Profit Analytics
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  apiVersion:
                    type: string
                    const: developer_v1
                  operationId:
                    type: string
                  status:
                    type: string
                    enum:
                      - accepted
                      - completed
                      - failed
                  jobId:
                    type: string
                  productId:
                    type: string
                  warnings:
                    type: array
                    items:
                      type: string
                  recommendations:
                    type: array
                    items:
                      type: string
                  links:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                  data:
                    type: object
                    properties:
                      filters:
                        type: object
                        properties:
                          from:
                            type: string
                          to:
                            type: string
                          marketplace:
                            type: string
                          country:
                            type: string
                          store:
                            type: string
                          currency:
                            type: string
                            description: Currency of every amount in the response.
                          timeZone:
                            type: string
                          sku:
                            type: string
                        required:
                          - from
                          - to
                          - marketplace
                          - country
                          - store
                          - currency
                          - timeZone
                          - sku
                      reportingBasis:
                        type: string
                        enum:
                          - earnings
                          - profit
                        description: >-
                          `profit` when cost prices cover sales, otherwise
                          `earnings` (revenue after fees).
                      currentRange:
                        type: object
                        properties:
                          from:
                            type: string
                          to:
                            type: string
                        required:
                          - from
                          - to
                      previousRange:
                        type: object
                        properties:
                          from:
                            type: string
                          to:
                            type: string
                        required:
                          - from
                          - to
                      metricCards:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              enum:
                                - net_revenue
                                - total_costs
                                - net_profit
                                - net_margin
                                - marketplace_costs
                                - earnings_after_fees
                                - earnings_rate
                            label:
                              type: string
                            value:
                              anyOf:
                                - type: number
                                - type: 'null'
                            unit:
                              type: string
                              enum:
                                - currency
                                - percent
                            changePercent:
                              anyOf:
                                - type: number
                                - type: 'null'
                              description: >-
                                Change against the previous period of equal
                                length. Null without a baseline.
                          required:
                            - id
                            - label
                            - value
                            - unit
                            - changePercent
                      dailyTrend:
                        type: array
                        items:
                          type: object
                          properties:
                            date:
                              type: string
                            netRevenue:
                              type: number
                            netProfit:
                              anyOf:
                                - type: number
                                - type: 'null'
                            earningsAfterFees:
                              type: number
                          required:
                            - date
                            - netRevenue
                            - netProfit
                            - earningsAfterFees
                      waterfall:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              enum:
                                - gross_sales
                                - discounts
                                - returns
                                - platform_fees
                                - cogs
                                - fulfillment
                                - operating
                                - net_profit
                                - earnings_after_fees
                            label:
                              type: string
                            amount:
                              anyOf:
                                - type: number
                                - type: 'null'
                            kind:
                              type: string
                              enum:
                                - positive
                                - negative
                                - result
                          required:
                            - id
                            - label
                            - amount
                            - kind
                      breakdownSections:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              enum:
                                - revenue
                                - platform_fees
                                - cogs
                                - fulfillment
                                - operating
                            title:
                              type: string
                            total:
                              type: number
                            rows:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  label:
                                    type: string
                                  amount:
                                    type: number
                                  unit:
                                    type: string
                                    enum:
                                      - currency
                                      - percent
                                required:
                                  - id
                                  - label
                                  - amount
                                  - unit
                          required:
                            - id
                            - title
                            - total
                            - rows
                      insights:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            title:
                              type: string
                            description:
                              type: string
                            tone:
                              type: string
                              enum:
                                - positive
                                - warning
                                - neutral
                          required:
                            - id
                            - title
                            - description
                            - tone
                      profitabilitySnapshot:
                        type: object
                        properties:
                          marketplaceCosts:
                            type: number
                          earningsAfterFees:
                            type: number
                          earningsRate:
                            type: number
                          totalKnownCosts:
                            type: number
                          ordersInRange:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          costRatio:
                            type: number
                          shippingRatio:
                            type: number
                          uncostedUnits:
                            type: number
                        required:
                          - marketplaceCosts
                          - earningsAfterFees
                          - earningsRate
                          - totalKnownCosts
                          - ordersInRange
                          - costRatio
                          - shippingRatio
                          - uncostedUnits
                      missingCostProducts:
                        type: array
                        items:
                          type: object
                          properties:
                            productId:
                              type: string
                            variantId:
                              anyOf:
                                - type: string
                                - type: 'null'
                            name:
                              type: string
                            variantName:
                              anyOf:
                                - type: string
                                - type: 'null'
                            thumbnailUrl:
                              anyOf:
                                - type: string
                                - type: 'null'
                            sku:
                              anyOf:
                                - type: string
                                - type: 'null'
                            soldUnits:
                              type: number
                            marketplaces:
                              type: array
                              items:
                                type: string
                            countries:
                              type: array
                              items:
                                type: string
                          required:
                            - productId
                            - variantId
                            - name
                            - variantName
                            - thumbnailUrl
                            - sku
                            - soldUnits
                            - marketplaces
                            - countries
                        description: Sold products without a cost price.
                      topProducts:
                        type: array
                        items:
                          type: object
                          properties:
                            productId:
                              type: string
                            variantId:
                              anyOf:
                                - type: string
                                - type: 'null'
                            name:
                              type: string
                            variantName:
                              anyOf:
                                - type: string
                                - type: 'null'
                            thumbnailUrl:
                              anyOf:
                                - type: string
                                - type: 'null'
                            sku:
                              anyOf:
                                - type: string
                                - type: 'null'
                            unitsSold:
                              type: number
                            totalRevenue:
                              type: number
                            totalCogs:
                              type: number
                            totalFees:
                              type: number
                              description: >-
                                Marketplace and fulfillment fees allocated to
                                the product.
                            earningsAfterFees:
                              type: number
                            earningsRate:
                              type: number
                            totalProfit:
                              anyOf:
                                - type: number
                                - type: 'null'
                              description: Null until every sold unit has a cost price.
                            profitMargin:
                              anyOf:
                                - type: number
                                - type: 'null'
                            knownCostProfit:
                              type: number
                              description: Profit counting only units with a cost price.
                            knownCostMargin:
                              type: number
                            costCoverage:
                              type: number
                              description: Share of sold units with a cost price, 0 to 1.
                            marketplaces:
                              type: array
                              items:
                                type: string
                          required:
                            - productId
                            - variantId
                            - name
                            - variantName
                            - thumbnailUrl
                            - sku
                            - unitsSold
                            - totalRevenue
                            - totalCogs
                            - totalFees
                            - earningsAfterFees
                            - earningsRate
                            - totalProfit
                            - profitMargin
                            - knownCostProfit
                            - knownCostMargin
                            - costCoverage
                            - marketplaces
                      underperformingProducts:
                        type: array
                        items:
                          type: object
                          properties:
                            productId:
                              type: string
                            variantId:
                              anyOf:
                                - type: string
                                - type: 'null'
                            name:
                              type: string
                            variantName:
                              anyOf:
                                - type: string
                                - type: 'null'
                            thumbnailUrl:
                              anyOf:
                                - type: string
                                - type: 'null'
                            sku:
                              anyOf:
                                - type: string
                                - type: 'null'
                            unitsSold:
                              type: number
                            totalRevenue:
                              type: number
                            totalCogs:
                              type: number
                            totalFees:
                              type: number
                              description: >-
                                Marketplace and fulfillment fees allocated to
                                the product.
                            earningsAfterFees:
                              type: number
                            earningsRate:
                              type: number
                            totalProfit:
                              anyOf:
                                - type: number
                                - type: 'null'
                              description: Null until every sold unit has a cost price.
                            profitMargin:
                              anyOf:
                                - type: number
                                - type: 'null'
                            knownCostProfit:
                              type: number
                              description: Profit counting only units with a cost price.
                            knownCostMargin:
                              type: number
                            costCoverage:
                              type: number
                              description: Share of sold units with a cost price, 0 to 1.
                            marketplaces:
                              type: array
                              items:
                                type: string
                          required:
                            - productId
                            - variantId
                            - name
                            - variantName
                            - thumbnailUrl
                            - sku
                            - unitsSold
                            - totalRevenue
                            - totalCogs
                            - totalFees
                            - earningsAfterFees
                            - earningsRate
                            - totalProfit
                            - profitMargin
                            - knownCostProfit
                            - knownCostMargin
                            - costCoverage
                            - marketplaces
                      retailUplift:
                        anyOf:
                          - type: object
                            properties:
                              currency:
                                type: string
                              soldUnits:
                                type: number
                              coveredUnits:
                                type: number
                              missingBaselineUnits:
                                type: number
                              priceBookRecordedUnits:
                                type: number
                              retailValue:
                                anyOf:
                                  - type: number
                                  - type: 'null'
                              salesValue:
                                anyOf:
                                  - type: number
                                  - type: 'null'
                              upliftAmount:
                                anyOf:
                                  - type: number
                                  - type: 'null'
                              markupRate:
                                anyOf:
                                  - type: number
                                  - type: 'null'
                            required:
                              - currency
                              - soldUnits
                              - coveredUnits
                              - missingBaselineUnits
                              - priceBookRecordedUnits
                              - retailValue
                              - salesValue
                              - upliftAmount
                              - markupRate
                          - type: 'null'
                        description: >-
                          Sales against the historical retail price, when price
                          books record one.
                      notes:
                        type: array
                        items:
                          type: string
                    required:
                      - filters
                      - reportingBasis
                      - currentRange
                      - previousRange
                      - metricCards
                      - dailyTrend
                      - waterfall
                      - breakdownSections
                      - insights
                      - profitabilitySnapshot
                      - missingCostProducts
                      - topProducts
                      - underperformingProducts
                      - retailUplift
                      - notes
                required:
                  - ok
                  - apiVersion
                  - operationId
                  - status
                  - warnings
                  - recommendations
                  - links
                  - data
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '403':
          description: Missing the `analytics:read` scope
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer API key for server-to-server access. Session auth is also
        supported in first-party UI flows.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.