AlmondTill/G3N API

referralReport

query · in the family Billing and the wallet

What it does

How your referrals are performing — every business you referred with its standing, how many months it has paid you, what it earned you, and whether its first-year usage share is still running; plus your lifetime totals (earned, settled against your own bill, reversed), your spendable credit, and the last twelve months of activity month by month.

The caller group's OWN referral performance report: counts of referred businesses by standing (+ gone · earning), lifetime totals by kind (earned ≥ 0 · applied/clawback ≤ 0 — signed like the ledger), the spendable credit, the newest 12 months that carry entries, and one page of referred businesses each with months paid · latest billed cycle · usage-window months left · earned · reversed. Self-group by key construction (no target arg); a group that referred nobody answers the zero report. referrals newest-first by the referred group's id — limit clamps [1,200] default 50, before pages backward by that id (the affiliateAccruals grammar); the counts and totals are page-independent. Requires authentication. Template class A16_BILLING (hand-derived v97).

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Billing and the wallet — Your platform bill, token purchases and the usage and cost reads.

Roles that may call it:

What happens

Reads only.

Arguments

NameTypeRequiredNotes
limitIntnoHow many records to answer at most; a page may hold fewer.
beforeIDno

Returns

ReferralReport ReferralReport! — Your referral program at a glance: counts by standing, lifetime totals by kind (signed like the ledger: earned ≥ 0 · applied/clawback ≤ 0), the spendable credit, the newest 12 months that carry entries, and one page of referred businesses with their figures.

Example request

graphql
query ExampleReferralReport($limit: Int) {
  referralReport(limit: $limit) {
    referredCount
    pendingCount
    approvedCount
    deniedCount
    goneCount
    earningCount
    earnedUsdCents
    appliedUsdCents
    clawbackUsdCents
    spendableUsdCents
  }
}

Variables:

json
{
  "limit": 1
}

Example response

json
{
  "data": {
    "referralReport": {
      "referredCount": 1,
      "pendingCount": 1,
      "approvedCount": 1,
      "deniedCount": 1,
      "goneCount": 1,
      "earningCount": 1,
      "earnedUsdCents": 1,
      "appliedUsdCents": 1,
      "clawbackUsdCents": 1,
      "spendableUsdCents": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer