Skip to main content
GET
/
api
/
reporting
/
campaign
/
:id
Campaign Analytics
curl --request GET \
  --url https://api.example.com/api/reporting/campaign/:id
{
  "campaign": {
    "id": "<string>",
    "title": "<string>",
    "goalAmountCents": {},
    "raisedAmountCents": 123,
    "donationCount": 123,
    "status": "<string>",
    "startDate": {},
    "endDate": {}
  },
  "summary": {
    "totalRaisedCents": 123,
    "donationCount": 123,
    "avgGiftCents": 123,
    "uniqueDonors": 123,
    "recurringCount": 123,
    "oneTimeCount": 123
  },
  "trend": [
    {
      "date": "<string>",
      "amountCents": 123,
      "count": 123
    }
  ],
  "topDonors": [
    {
      "donorId": "<string>",
      "firstName": "<string>",
      "lastName": "<string>",
      "totalCents": 123,
      "count": 123
    }
  ],
  "paymentMethods": [
    {
      "method": "<string>",
      "count": 123,
      "amountCents": 123
    }
  ],
  "frequencyBreakdown": [
    {
      "frequency": "<string>",
      "count": 123,
      "amountCents": 123
    }
  ],
  "topSources": [
    {
      "source": "<string>",
      "count": 123,
      "amountCents": 123
    }
  ],
  "peakHour": {}
}

Campaign Analytics

Returns detailed analytics for a single campaign. Includes a daily donation trend, top donor list, payment method breakdown, frequency breakdown, UTM source breakdown, and peak donation hour.

Path Parameters

id
string
required
The campaign ID to retrieve analytics for.

Query Parameters

orgId
string
required
The organization ID. Used to verify the authenticated user’s access to this campaign.
startDate
string
ISO 8601 start date for the daily trend window (e.g., "2026-02-01"). Defaults to 30 days ago.
endDate
string
ISO 8601 end date for the daily trend window (e.g., "2026-03-04"). Defaults to today.

Authentication

Requires a valid Clerk session JWT in the Authorization: Bearer header. The authenticated user must be a member of the organization that owns this campaign.

Response

campaign
object
Core campaign metadata.
summary
object
Aggregated totals across all succeeded donations for this campaign (all-time, not filtered by date range).
trend
array
Daily donation data for the requested date range. One entry per calendar day, pre-filled with zeros for days with no donations.
topDonors
array
Up to 10 top donors by total amount given to this campaign. Last names are truncated to an initial for privacy.
paymentMethods
array
Breakdown of succeeded donations by payment method.
frequencyBreakdown
array
Breakdown of succeeded donations by giving frequency.
topSources
array
Up to 5 top UTM sources by total amount raised, for donations that have a utmSource value.
peakHour
integer | null
The UTC hour of day (0–23) that received the most donations across all time. null if the campaign has no donations.

Example

curl "https://givelink-api-production.up.railway.app/api/reporting/campaign/clx9876543210?orgId=clxabc123456&startDate=2026-02-01&endDate=2026-03-04" \
  -H "Authorization: Bearer <clerk-session-jwt>"
{
  "campaign": {
    "id": "clx9876543210",
    "title": "Spring 2026 Annual Fund",
    "goalAmountCents": 5000000,
    "raisedAmountCents": 1245000,
    "donationCount": 87,
    "status": "ACTIVE",
    "startDate": "2026-03-01T00:00:00.000Z",
    "endDate": "2026-06-30T23:59:59.000Z"
  },
  "summary": {
    "totalRaisedCents": 1245000,
    "donationCount": 87,
    "avgGiftCents": 14310,
    "uniqueDonors": 74,
    "recurringCount": 23,
    "oneTimeCount": 64
  },
  "trend": [
    { "date": "2026-02-01", "amountCents": 0, "count": 0 },
    { "date": "2026-02-02", "amountCents": 25000, "count": 2 },
    { "date": "2026-02-03", "amountCents": 100000, "count": 7 }
  ],
  "topDonors": [
    { "donorId": "clxdonor001", "firstName": "Margaret", "lastName": "T.", "totalCents": 250000, "count": 1 },
    { "donorId": "clxdonor002", "firstName": "Robert", "lastName": "K.", "totalCents": 100000, "count": 2 }
  ],
  "paymentMethods": [
    { "method": "CARD", "count": 70, "amountCents": 900000 },
    { "method": "ACH", "count": 17, "amountCents": 345000 }
  ],
  "frequencyBreakdown": [
    { "frequency": "ONE_TIME", "count": 64, "amountCents": 800000 },
    { "frequency": "MONTHLY", "count": 23, "amountCents": 445000 }
  ],
  "topSources": [
    { "source": "email", "count": 45, "amountCents": 650000 },
    { "source": "facebook", "count": 12, "amountCents": 180000 }
  ],
  "peakHour": 19
}

Error Responses

StatusErrorDescription
400Validation failedorgId is missing or invalid.
401UnauthorizedMissing or invalid Authorization header.
403ForbiddenAuthenticated user is not a member of the specified org.
404Campaign not foundNo campaign with this ID exists for the given org.