Build a billing report across organizations (internal)

Add MCP server to your AI tool

Allow AI tools and LLMs to interact with the API documentation portal through MCP.

MCP server URL

https://docs.usehearsay.com/mcp

Standard setup for AI tools providing an mcp.json file

mcp.json
{
  "integrations MCP server": {
    "url": "https://docs.usehearsay.com/mcp"
  }
}

Close
POST /admin/billing/report

Builds a billing report for the organizations in orgIds (default: every organization on case billing), narrowed by caseIds and the date range. In JSON format the report comes back in this response, with each organization's charges and the grand total charged; in PDF format it is queued and this returns its id and status to poll. Returns 400 for invalid filters and 404 while billing reports are turned off. Super admin only.

application/json

Body Required

  • caseIds array[string]

    Defaults to all cases

  • startDate string(date-time)

    Defaults to the start of the organization's current billing cadence period

  • endDate string(date-time)

    Defaults to now

  • format string

    Values are json or pdf. Default value is json.

  • orgIds array[string]

    Defaults to every organization that has a BillingProfile (i.e. is on case billing)

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • data object Required
      One of:
    • statusCode number Required
    • timestamp string(date-time) Required
POST /admin/billing/report
curl \
 --request POST 'http://api.example.com/admin/billing/report' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "caseIds": [
    "string"
  ],
  "startDate": "2026-05-04T09:42:00Z",
  "endDate": "2026-05-04T09:42:00Z",
  "format": "json",
  "orgIds": [
    "string"
  ]
}'
Request examples
{
  "caseIds": [
    "string"
  ],
  "startDate": "2026-05-04T09:42:00Z",
  "endDate": "2026-05-04T09:42:00Z",
  "format": "json",
  "orgIds": [
    "string"
  ]
}
Response examples (200)
{
  "data": {
    "organizations": [
      {
        "organizationId": "65a1b2c3d4e5f6a7b8c9d0e3",
        "organizationName": "Acme Legal",
        "tier": "firm",
        "billingMode": "payg",
        "onCaseBilling": true,
        "window": {
          "startDate": "2026-01-01T00:00:00.000Z",
          "endDate": "2026-01-15T10:15:00.000Z"
        },
        "cases": [
          {
            "caseId": "65a1b2c3d4e5f6a7b8c9d0e2",
            "caseName": "Smith v. Jones",
            "rows": [
              {
                "date": "2026-01-15T10:15:00.000Z",
                "skuKey": "collection.phone",
                "description": "Phone collection",
                "quantity": 1,
                "unitAmountCents": 17900,
                "amountCents": 17900,
                "status": "INVOICED",
                "invoiceId": "in_1PExample"
              }
            ],
            "subtotalChargedCents": 17900,
            "subtotalInformationalCents": 0
          }
        ],
        "totalChargedCents": 42300,
        "totalInformationalCents": 5000,
        "totalNonChargeableCents": 0,
        "totalFailedCents": 0,
        "totalRefundedCents": 0
      }
    ],
    "grandTotalChargedCents": 42300
  },
  "statusCode": 200,
  "timestamp": "2026-01-15T10:15:00.000Z"
}