Skip to main content
GET
/
reporting
/
margin
Get storefront margin (P&L) reporting
curl --request GET \
  --url https://api.interchange.io/api/v2/storefront/reporting/margin \
  --header 'Authorization: Bearer <token>'
{
  "buyers": [
    {
      "buyerCustomerId": 0,
      "buyerName": "<string>",
      "amounts": {
        "settlementCurrency": "<string>",
        "sellBooked": 123,
        "sellRealized": 123,
        "buyBooked": 123,
        "buyRealized": 123,
        "spreadBooked": 123,
        "spreadRealized": 123,
        "marginBookedPct": 123,
        "marginRealizedPct": 123,
        "bookedComplete": true,
        "realizedComplete": true
      },
      "mediaBuys": [
        {
          "mediaBuyId": "<string>",
          "amounts": {
            "settlementCurrency": "<string>",
            "sellBooked": 123,
            "sellRealized": 123,
            "buyBooked": 123,
            "buyRealized": 123,
            "spreadBooked": 123,
            "spreadRealized": 123,
            "marginBookedPct": 123,
            "marginRealizedPct": 123,
            "bookedComplete": true,
            "realizedComplete": true
          },
          "packages": [
            {
              "packageId": "<string>",
              "productId": "<string>",
              "amounts": {
                "settlementCurrency": "<string>",
                "sellBooked": 123,
                "sellRealized": 123,
                "buyBooked": 123,
                "buyRealized": 123,
                "spreadBooked": 123,
                "spreadRealized": 123,
                "marginBookedPct": 123,
                "marginRealizedPct": 123,
                "bookedComplete": true,
                "realizedComplete": true
              },
              "sources": [
                {
                  "sourceId": "<string>",
                  "upstreamMediaBuyId": "<string>",
                  "upstreamPackageId": "<string>",
                  "amounts": {
                    "settlementCurrency": "<string>",
                    "sellBooked": 123,
                    "sellRealized": 123,
                    "buyBooked": 123,
                    "buyRealized": 123,
                    "spreadBooked": 123,
                    "spreadRealized": 123,
                    "marginBookedPct": 123,
                    "marginRealizedPct": 123,
                    "bookedComplete": true,
                    "realizedComplete": true
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "totals": [
    {
      "settlementCurrency": "<string>",
      "sellBooked": 123,
      "sellRealized": 123,
      "buyBooked": 123,
      "buyRealized": 123,
      "spreadBooked": 123,
      "spreadRealized": 123,
      "marginBookedPct": 123,
      "marginRealizedPct": 123,
      "bookedComplete": true,
      "realizedComplete": true
    }
  ],
  "periodStart": "<string>",
  "periodEnd": "<string>"
}

Authorizations

Authorization
string
header
required

API key or access token

Query Parameters

inventorySourceId
string

Narrow to the buy legs sourced from a single inventory source (storefront_spread_ledger.source_id). When omitted, includes every source on the storefront.

buyerCustomerId
integer

Narrow to a single buyer customer. Can only narrow within the calling storefront — it never widens scope.

Required range: x <= 9007199254740991

Response

Get storefront margin (P&L) reporting

Hierarchical storefront margin (P&L) response: buyer → media buy → package → source leg

buyers
object[]
required

Buyer-level P&L data

totals
object[]
required

Aggregated totals, one entry per settlement currency (amounts are never summed across currencies)

periodStart
string | null
required

As-of start: earliest booked_at of the included edges (YYYY-MM-DD), null when empty

Pattern: ^\d{4}-\d{2}-\d{2}$
periodEnd
string | null
required

As-of end: latest realized_through (or booked_at) of the included edges (YYYY-MM-DD), null when empty

Pattern: ^\d{4}-\d{2}-\d{2}$