Knowledge Base

Aggregated Billing Total API Details


Aggregated Billing Reports APIs

Request Details

All aggregated billing APIs share the same request parameters and return aggregated totals.

Parameter

In

Type

Required

Description

resellerId

path

GUID

Yes

Reseller identifier.

startDate

query

date

Yes

  • Start of billing period (inclusive).

    • YYYY-MM-DD

endDate

query

date

Yes

  • End of billing period (inclusive).

    • YYYY-MM-DD

organizationIds

query

GUID[]

No

Filter by organization. Repeatable.

organizationGroupIds

query

GUID[]

No

Filter by organization group. Repeatable.

serviceIds

query

GUID[]

No

Filter by service. Repeatable.

convertToCurrency

query

string

No

If convertToCurrency is omitted, amounts are returned in the default sales/cost currency. If supplied, it must be a valid 3-letter ISO 4217 code.

pageToken

header

string

No

Page token from a previous response's nextPageToken header. See pagination section for more details in the API Guide for Billing Integration.

Common Response Fields

The following fields appear on the responses of all aggregated billing APIs.

Field

Definition

totalCost

Sum of cost for the group.

totalSales

Sum of sales for the group.

totalRecommendedPrice

Sum of the recommended price for the group.

totalDifferenceFromRecommended

Sum of the difference from recommended for the group (totalSales − totalRecommendedPrice).

totalMarginAmount

Sum of margin (totalSales − totalCost) for the group.

averageMarginPercentage

The average margin percentage; (SUM(totalSales) − SUM(totalCost)) / SUM(totalSales) × 100.

costCurrencyCode

Currency of the cost amounts.

salesCurrencyCode

Currency of the sales amounts.

Additional Response Fields

Field

Definition

Appears on

billingDate

The billing date the totals are grouped by.

  • BillingTotalByDate

organizationId

Identifier of the organization the totals belong to.

  • BillingTotalByOrganization

  • BillingTotalByOrganizationService

  • BillingTotalBySubscription

  • BillingTotalByCostCenter

organizationName

Display name of the organization.

  • BillingTotalByOrganization

  • BillingTotalByOrganizationService

  • BillingTotalBySubscription

  • BillingTotalByCostCenter

customerNumber

Reseller assigned customer number for the organization.

  • BillingTotalByOrganization

  • BillingTotalByOrganizationService

  • BillingTotalBySubscription

organizationGroups

Names of the organization groups the organization belongs to.

  • BillingTotalByOrganization

serviceId

Identifier of the service the totals belong to.

  • BillingTotalByService

  • BillingTotalByOrganizationService

  • BillingTotalBySubscription

serviceName

For Azure, reflects the Azure model type (see Azure service-name mapping in the API Guide for Billing Integration).

  • BillingTotalByService

  • BillingTotalByOrganizationService

  • BillingTotalBySubscription

subscriptionId

Identifier of the subscription the totals belong to.

  • BillingTotalBySubscription

subscriptionName

Friendly name of the subscription.

  • BillingTotalBySubscription

productId

The unique product identifier. Null for consumption based subscriptions.

  • BillingTotalBySubscription

productName

Name of the product. Null for consumption based subscriptions.

  • BillingTotalBySubscription

itemCode

Vendor item/SKU code. Null for consumption-based subscriptions.

  • BillingTotalBySubscription

paymentFrequency

  • How often the subscription is billed

    • One-time

    • Monthly

    • Every 3 months

    • Every 6 months

    • Annual

    • Every 2 years

    • Every 3 years

    • Every 4 years

    • Every 5 years

  • BillingTotalBySubscription

subscriptionPeriod

  • Term/commitment length of the subscription

    • 1 Month

    • 3 Months

    • 1 Year

    • 3 Years

    • 4 Years

    • 5 Years

  • BillingTotalBySubscription

purchaseOrderNumber

Optional purchase order number set by the reseller on the subscription.

  • BillingTotalBySubscription

costCenter

Name of the cost center the totals are grouped by.

  • BillingTotalByCostCenter

API Details

BillingTotalAll

API

Details

GET /api/resellers/{resellerId}/billing/reports/BillingTotalAll

Aggregates the entire billing for the period into one object. Not paginated (the pageToken header is ignored).

Example Response
{
  "totalCost": 9327.50,
  "totalSales": 11289.00,
  "totalRecommendedPrice": 10560.00,
  "totalDifferenceFromRecommended": 729.00,
  "totalMarginAmount": 1961.50,
  "averageMarginPercentage": 17.38,
  "costCurrencyCode": "SEK",
  "salesCurrencyCode": "SEK"
}

BillingTotalByDate

API

Details

GET /api/resellers/{resellerId}/billing/reports/BillingTotalByDate

Totals grouped by billing date. Paginated array.

Example Response
[
  {
    "billingDate": "2026-01-06",
    "totalCost": 6207.50,
    "totalSales": 7545.00,
    "totalRecommendedPrice": 7050.00,
    "totalDifferenceFromRecommended": 495.00,
    "totalMarginAmount": 1337.50,
    "averageMarginPercentage": 17.73,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  },
  {
    "billingDate": "2026-01-08",
    "totalCost": 3120.00,
    "totalSales": 3744.00,
    "totalRecommendedPrice": 3510.00,
    "totalDifferenceFromRecommended": 234.00,
    "totalMarginAmount": 624.00,
    "averageMarginPercentage": 16.67,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  }
]

BillingTotalByService

API

Details

GET /api/resellers/{resellerId}/billing/reports/BillingTotalByService

Totals grouped by service. Paginated array.

Example Response
[
  {
    "serviceId": "b1e4a8d2-9f37-4c6b-a1d8-5e2f9c0b3a76",
    "serviceName": "Microsoft 365 CSP Direct",
    "totalCost": 6207.50,
    "totalSales": 7545.00,
    "totalRecommendedPrice": 7050.00,
    "totalDifferenceFromRecommended": 495.00,
    "totalMarginAmount": 1337.50,
    "averageMarginPercentage": 17.73,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  },
  {
    "serviceId": "f6c2a9e4-7b15-4d8c-be63-1a9f4c7b2e08",
    "serviceName": "Azure Consumption",
    "totalCost": 3120.00,
    "totalSales": 3744.00,
    "totalRecommendedPrice": 3510.00,
    "totalDifferenceFromRecommended": 234.00,
    "totalMarginAmount": 624.00,
    "averageMarginPercentage": 16.67,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  }
]

BillingTotalByOrganization

API

Details

GET /api/resellers/{resellerId}/billing/reports/BillingTotalByOrganization

Totals grouped by organization. Paginated array.

Example Response
[
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "customerNumber": "SE-100482",
    "organizationGroups": ["Nordic Enterprise"],
    "totalCost": 9327.50,
    "totalSales": 11289.00,
    "totalRecommendedPrice": 10560.00,
    "totalDifferenceFromRecommended": 729.00,
    "totalMarginAmount": 1961.50,
    "averageMarginPercentage": 17.38,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  }
]

BillingTotalByOrganizationService

API

Details

GET /api/resellers/{resellerId}/billing/reports/BillingTotalByOrganizationService

Totals grouped by organization and service.

Example Response
[
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "customerNumber": "SE-100482",
    "serviceId": "b1e4a8d2-9f37-4c6b-a1d8-5e2f9c0b3a76",
    "serviceName": "Microsoft 365 CSP Direct",
    "totalCost": 6207.50,
    "totalSales": 7545.00,
    "totalRecommendedPrice": 7050.00,
    "totalDifferenceFromRecommended": 495.00,
    "totalMarginAmount": 1337.50,
    "averageMarginPercentage": 17.73,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  },
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "customerNumber": "SE-100482",
    "serviceId": "f6c2a9e4-7b15-4d8c-be63-1a9f4c7b2e08",
    "serviceName": "Azure Consumption",
    "totalCost": 3120.00,
    "totalSales": 3744.00,
    "totalRecommendedPrice": 3510.00,
    "totalDifferenceFromRecommended": 234.00,
    "totalMarginAmount": 624.00,
    "averageMarginPercentage": 16.67,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  }
]

BillingTotalBySubscription

API

Details

GET /api/resellers/{resellerId}/billing/reports/BillingTotalBySubscription

Totals grouped by subscription, with parent organization, service, and product context.

Additional Info
  • A subscription can have multiple products; these are normally separate line items.

    • CSP 365 Direct: lines with the same subscriptionId, itemCode and productId are grouped together.

    • Consumption-based (Azure Consumption, Custom Service Consumption, Custom Service with Add-Ons): grouped as a single subscription, with product related fields (productId, itemCode, productName) left empty/null.

  • Customer Service add-on totals are aggregated under the parent subscription record.

Example Response
[
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "customerNumber": "SE-100482",
    "serviceId": "b1e4a8d2-9f37-4c6b-a1d8-5e2f9c0b3a76",
    "serviceName": "Microsoft 365 CSP Direct",
    "subscriptionId": "e8a2f5c9-1d47-4b3a-8e6f-2c9b5a1d7f04",
    "subscriptionName": "Microsoft 365 Business Premium",
    "productId": "CFQ7TTC0LCHC",
    "productName": "Microsoft 365 Business Premium",
    "itemCode": "CFQ7TTC0LCHC:0001:P1Y:Annual",
    "paymentFrequency": "Annual",
    "subscriptionPeriod": "1 Year",
    "purchaseOrderNumber": "PO-2026-0042",
    "totalCost": 4687.50,
    "totalSales": 5625.00,
    "totalRecommendedPrice": 5250.00,
    "totalDifferenceFromRecommended": 375.00,
    "totalMarginAmount": 937.50,
    "averageMarginPercentage": 16.67,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  },
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "customerNumber": "SE-100482",
    "serviceId": "b1e4a8d2-9f37-4c6b-a1d8-5e2f9c0b3a76",
    "serviceName": "Microsoft 365 CSP Direct",
    "subscriptionId": "1f7b3d9a-5c28-4e6b-9a3d-7c1e4f8b2a95",
    "subscriptionName": "Exchange Online (Plan 1)",
    "productId": "CFQ7TTC0LH16",
    "productName": "Exchange Online (Plan 1)",
    "itemCode": "CFQ7TTC0LH16:0002:P1M:Monthly",
    "paymentFrequency": "Monthly",
    "subscriptionPeriod": "1 Month",
    "purchaseOrderNumber": null,
    "totalCost": 1520.00,
    "totalSales": 1920.00,
    "totalRecommendedPrice": 1800.00,
    "totalDifferenceFromRecommended": 120.00,
    "totalMarginAmount": 400.00,
    "averageMarginPercentage": 20.83,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  },
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "customerNumber": "SE-100482",
    "serviceId": "f6c2a9e4-7b15-4d8c-be63-1a9f4c7b2e08",
    "serviceName": "Azure Consumption",
    "subscriptionId": "9c4e7a2f-3b81-4d5a-ae29-6f0c1b8d4a37",
    "subscriptionName": "Azure Plan",
    "productId": null,
    "productName": null,
    "itemCode": null,
    "paymentFrequency": "Monthly",
    "subscriptionPeriod": "1 Month",
    "purchaseOrderNumber": null,
    "totalCost": 3120.00,
    "totalSales": 3744.00,
    "totalRecommendedPrice": 3510.00,
    "totalDifferenceFromRecommended": 234.00,
    "totalMarginAmount": 624.00,
    "averageMarginPercentage": 16.67,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  }
]

BillingTotalByCostCenter

API

Details

GET /api/resellers/{resellerId}/billing/reports/BillingTotalByCostCenter

Entire billing aggregated to cost center level.

Example Response
[
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "costCenter": "Sales",
    "totalCost": 2483.00,
    "totalSales": 3018.00,
    "totalRecommendedPrice": 2820.00,
    "totalDifferenceFromRecommended": 198.00,
    "totalMarginAmount": 535.00,
    "averageMarginPercentage": 17.73,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  },
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "costCenter": "Finance",
    "totalCost": 3724.50,
    "totalSales": 4527.00,
    "totalRecommendedPrice": 4230.00,
    "totalDifferenceFromRecommended": 297.00,
    "totalMarginAmount": 802.50,
    "averageMarginPercentage": 17.73,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  },
  {
    "organizationId": "3d9f7c1a-6b24-4e8d-bf52-9a1c4e7b2d80",
    "organizationName": "Brightwave Media AB",
    "costCenter": "IT Operations",
    "totalCost": 3120.00,
    "totalSales": 3744.00,
    "totalRecommendedPrice": 3510.00,
    "totalDifferenceFromRecommended": 234.00,
    "totalMarginAmount": 624.00,
    "averageMarginPercentage": 16.67,
    "costCurrencyCode": "SEK",
    "salesCurrencyCode": "SEK"
  }
]