Skip to content

API Reference

Overview

NOMA Sync exposes:

  • Public: GET /health
  • Webhooks (internal): POST /webhooks/givebutter, POST /webhooks/square, POST /webhooks/mailchimp — do not call directly; used by Givebutter, Square, and Mailchimp
  • Admin API: All /api/* routes require JWT (Authorization: Bearer <token>). Roles: viewer (read-only), admin, super_admin

Base URL example: https://nomasync.21ads.workers.dev or https://noma.21adsmedia.io/.

Public

GET /health

Returns 200 and {"status":"ok"} when the Worker is running. Does not check LGL or third-party APIs.


Webhooks (Internal)

Configure these URLs in each platform; do not call them manually.

EndpointSourceAuth
POST /webhooks/givebutterGivebutterSignature (if configured)
POST /webhooks/squareSquareHMAC in header (SQUARE_WEBHOOK_SIGNATURE_KEY)
POST /webhooks/mailchimpMailchimpSecret (if configured)

See Webhooks for payload shapes.


Admin API (Authenticated)

All require Authorization: Bearer <JWT>. Role requirements noted below.

Sync log

MethodPathRoleDescription
GET/api/syncsviewer+List syncs; query: status, source, date_from, date_to, page, limit, sort, order, q
GET/api/syncs/:idviewer+Single sync by UUID (detail modal)
PATCH/api/syncs/:id/resolveadmin+Mark sync resolved; body: { notes?, resolvedBy? }

Stats

MethodPathRoleDescription
GET/api/statsviewer+Aggregate stats (e.g. 24h: total, success, failed) for dashboard

Settings

MethodPathRoleDescription
GET/api/settings/lgl-environmentadmin+Current LGL environment (production/sandbox)
PATCH/api/settings/lgl-environmentadmin+Set LGL environment; body: { environment }
POST/api/settings/lgl-reference-refreshadmin+Refresh LGL funds/campaigns/gift-types/payment-types cache
GET/api/settings/alert-recipientsadmin+List alert recipient emails
PATCH/api/settings/alert-recipientsadmin+Set alert recipients; body: { emails: string[] }
GET/api/settings/mailchimp-sync-enabledadmin+Whether Mailchimp sync is enabled
PATCH/api/settings/mailchimp-sync-enabledadmin+Enable/disable Mailchimp sync; body: { enabled: boolean }
GET/api/settings/square-default-constituentadmin+Default constituent for Square orders with no customer
PATCH/api/settings/square-default-constituentadmin+Set default; body: { email, first_name, last_name }

Users (Teams)

MethodPathRoleDescription
GET/api/userssuper_adminList users (for Teams page)
POST/api/users/invitesuper_adminInvite user by email; body: { email, role? }
PATCH/api/users/:idsuper_adminUpdate user (role, deactivate)

Mappings

MethodPathRoleDescription
GET/api/mappings/typesadmin+Type defaults (Givebutter, Square)
GET/api/mappings/overridesadmin+Campaign overrides (Givebutter)
POST/api/mappings/overridesadmin+Create/update override; body per dashboard

LGL reference (for dropdowns)

MethodPathRoleDescription
GET/api/lgl/fundsadmin+List LGL funds
GET/api/lgl/campaignsadmin+List LGL campaigns
GET/api/lgl/gift-typesadmin+List LGL gift types
GET/api/lgl/gift-categoriesadmin+List LGL gift categories
GET/api/lgl/payment-typesadmin+List LGL payment types

Square

MethodPathRoleDescription
GET/api/square/locationsadmin+List Square locations
GET/api/square/ordersadmin+List Square orders; query: cursor, limit
POST/api/square/orders/enrichadmin+Enrich customer for given order IDs; body: { orderIds: string[] }
GET/api/square/location-overridesadmin+List location → LGL overrides
PUT/api/square/location-overridesadmin+Set location overrides; body: array of { location_id, fund_id?, campaign_id? }
POST/api/square/orders/:orderId/resyncadmin+Resync one order to LGL; query: force=true to skip idempotency

Givebutter

MethodPathRoleDescription
GET/api/givebutter/campaignsadmin+List Givebutter campaigns (cached)
POST/api/givebutter/campaigns/refreshadmin+Refresh Givebutter campaign cache

Mailchimp

MethodPathRoleDescription
GET/api/mailchimp/accountadmin+Mailchimp account info (test)
GET/api/mailchimp/listsadmin+List Mailchimp lists
GET/api/mailchimp/mappingsadmin+List Mailchimp list mappings
POST/api/mailchimp/mappingsadmin+Create/update list mapping
POST/api/mailchimp/testadmin+Test Mailchimp connection
GET/api/mailchimp/tag-rulesadmin+List tag rules
POST/api/mailchimp/tag-rulesadmin+Create/update tag rules

Testing / dev

MethodPathRoleDescription
GET/api/test-connectionsadmin+Test LGL, Givebutter, Square connectivity
POST/api/poll-nowadmin+Trigger polling job now
POST/api/dev/poll-nowadmin+Same (dev)
POST/api/poll-freshadmin+Poll with fresh lookback
POST/api/inject-webhookadmin+Inject test webhook; body: payload
POST/api/retry-alladmin+Retry all failed syncs (use with care)
POST/api/retry-all-freshadmin+Retry with fresh fetch
POST/api/reset-test-dataadmin+Reset test data (dev only)
POST/api/dev/poll-cronadmin+Bypass cron auth (dev only)

Example: Resync Square order

bash
curl -X POST "https://your-worker.workers.dev/api/square/orders/ORDER_ID/resync" \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json"

With force (bypass idempotency):

bash
curl -X POST "https://your-worker.workers.dev/api/square/orders/ORDER_ID/resync?force=true" \
  -H "Authorization: Bearer YOUR_JWT"

For webhook payload details see Webhooks. For LGL data shapes see LGL Data.