Skip to main content

Community Fund

Base path: /api/admin/community-fund

All endpoints require a valid auth session with admin.access permission and a non-empty tenantId in the request context.

Note: Order-flow integration (checkout donation prompt), Discord celebration message dispatch, and payment charge capture are deferred. These endpoints operate on the standalone data layer only. See docs/specs/2026-04-26-community-fund.md for the full integration roadmap.


GET /api/admin/community-fund/balance

Returns the current community fund balance for the authenticated tenant.

Auth: Session cookie required; admin.access permission
Tenant: Scoped via request context

Response 200

{
"totalContributedCents": 15000,
"totalDisbursedCents": 5000,
"currentBalanceCents": 10000
}

GET /api/admin/community-fund/contributions

Returns paginated contributions for the tenant, ordered by creation date descending.

Auth: Session cookie required; admin.access permission

Query Parameters

ParameterTypeDefaultDescription
limitnumber20Number of results (1–100)
offsetnumber0Pagination offset

Response 200

{
"items": [
{
"id": "...",
"tenantId": "...",
"customerId": "...",
"orderId": null,
"amountCents": 500,
"anonymous": false,
"createdAt": "2026-04-26T00:00:00.000Z"
}
],
"total": 42
}

GET /api/admin/community-fund/disbursements

Returns paginated disbursements for the tenant, ordered by creation date descending.

Auth: Session cookie required; admin.access permission

Query Parameters

ParameterTypeDefaultDescription
limitnumber20Number of results (1–100)
offsetnumber0Pagination offset

Response 200

{
"items": [
{
"id": "...",
"tenantId": "...",
"recipientCustomerId": "...",
"amountCents": 2500,
"reason": "Member needed help after a difficult month.",
"approvedBy": "admin-user-id",
"createdAt": "2026-04-26T00:00:00.000Z"
}
],
"total": 3
}

POST /api/admin/community-fund/disbursements

Records an approved fund disbursement. Validates that the current balance covers the requested amount.

Auth: Session cookie required; admin.access permission
Approver: approvedBy is automatically set from the authenticated user's ID.

Request Body

FieldTypeRequiredDescription
recipientCustomerIdstringYesCustomer ID of the beneficiary
amountCentsnumberYesDisbursement amount in cents
reasonstringYesHuman-readable reason (max 1000 chars)

Response 201

Returns the created disbursement document.

Error Responses

StatusCodeCondition
400INSUFFICIENT_BALANCECurrent balance < requested amount
400COMMUNITY_FUND_DISABLEDFund is disabled for this tenant
400(validation error)Missing required fields
403Missing auth or admin.access permission

GET /api/admin/community-fund/config

Returns the current community fund configuration for the tenant. Creates with defaults if no config exists yet.

Auth: Session cookie required; admin.access permission

Response 200

Returns the full CommunityFundConfig object. See docs/reference/data-dictionary.md#communityfundconfig for the field list.


PUT /api/admin/community-fund/config

Updates the community fund configuration for the tenant. All fields are optional (partial update).

Auth: Session cookie required; admin.access permission

Request Body (all fields optional)

FieldTypeDescription
enabledbooleanMaster toggle
allowedAmountsCentsnumber[]Preset donation tiers in cents (min 1 item)
customAmountAllowedbooleanAllow custom amount entry
customAmountMinCentsnumberMinimum custom amount
customAmountMaxCentsnumberMaximum custom amount (must be > min)
celebrationChannelIdstring|nullDiscord channel ID for celebration messages
celebrationMessageTemplatestringTemplate with {donor}, {amount}, {balance} placeholders
anonymousMessageTemplatestringTemplate with {amount}, {balance} placeholders
anonymityAllowedbooleanWhether customers can donate anonymously
disbursementApprovalRolesstring[]Role slugs that may approve disbursements (min 1 item)
disclaimerTextstringLegal/tax disclaimer surfaced in admin UI

Response 200

Returns the updated CommunityFundConfig.