Endpoints

HTTP routes this app exposes.

HTTP endpoints (Next.js route handlers)

Endpoint: GET /.well-known/nostr.json

  • Purpose: Proxies NIP-05 nostr.json from the api onto the site apex. CORS *.
  • Errors: Upstream 502/503.
  • Used by: Damus verification.
  • Auth: none.

Endpoint: GET /.well-known/lnurlp/[username]

  • Purpose: Proxies LUD-16 payRequest from the api onto the site apex so wallets can pay username@21.gifts. CORS *. Once the member's in-app wallet is verified the api answers with the callback GET /lnurlp/[username]/invoice, so payments to that address settle in the member's own in-app wallet. While the account has an open shop payment the api answers an OpenCryptoPay pay request instead (quote.payment, transferAmounts); the query string is forwarded.
  • Errors: Upstream 404/502.
  • Used by: Lightning wallets; fetchShopPayLink for PayLinkScreen (an open till, the check after Continue, the re-read while the opened payment waits, and the quote refetch).
  • Auth: none.

Endpoint: GET /pay/[username]

  • Purpose: Proxies the public pay-link card (name, username, minSats, maxSats, and charge, the shop's pending charge or null) from the api.
  • Errors: Upstream 404 when the person cannot be paid, 502 when the payee's wallet cannot be resolved.
  • Used by: PayLinkScreen, fetchShopChargeInvoice.
  • Auth: none.

Endpoint: GET /pay/[username]/charges/[id]

  • Purpose: Proxies the public shop-charge receipt. The body is the charge id, status, times, and the stored currency figures. It does not include the account id or a Spark invoice.
  • Errors: Upstream 404 when the charge is missing, 502 when the api cannot be reached.
  • Used by: fetchShopChargeReceipt when the paid Lightning address has a local part.
  • Auth: none.

Endpoint: GET /pay/charges/[id]

  • Purpose: Proxies the same public shop-charge receipt when the payment has no Lightning address. The body is the charge id, status, times, and the stored currency figures. It does not include the account id or a Spark invoice.
  • Errors: Upstream 404 when the charge is missing, 502 when the api cannot be reached.
  • Used by: fetchShopChargeReceipt when the username is null.
  • Auth: none.

Endpoint: POST /pay/[username]/invoice

  • Purpose: Proxies one exact-amount BOLT11 mint. Body { amountSats, comment? }. Response { pr, amountSats, sparkInvoice }. With a pending charge, sparkInvoice is a Spark invoice for that charge when amountSats is its amount. Without one, it is a Spark invoice for exactly amountSats to the member's verified wallet, carrying the message when one is sent. It is null when the api issues no Spark invoice.
  • Errors: Upstream 400 for a bad amount, 404 when the person cannot be paid, 502 when the invoice cannot be created.
  • Used by: PayLinkScreen after Continue when POST /pay/[username]/payment answers 503 stablecoin_unavailable or a readable 4xx other than 409 payment_open on the first answer (a 409 whose body cannot be read is an unknown outcome), or, after an unknown outcome, when such an answer comes back and the pay link read 20 s after the end of the most recent unknown call is the plain Lightning request; and for an open till whose pay link is the plain Lightning request; fetchShopChargeInvoice and fetchMemberSparkInvoice for the in-app wallet.
  • Auth: none.

Endpoint: POST /pay/[username]/payment

  • Purpose: Proxies the opening of one shop payment for an amount the payer entered on /pl. Body { amountSats }. Response { payment, expiresAt }: the shop payment id, which the pay link then names as quote.payment, and the end of its five-minute window. A new payer amount replaces an open payer payment.
  • Errors: Upstream { error, code } bodies: 404 when the person cannot be paid, 502 when the wallet or the mint fails, 400 for a bad amount, 409 payment_open while a till charge is pending, 503 stablecoin_unavailable when this shop has no stablecoin payment or it is switched off or rate limited. A username that is not one path segment answers 404 here without calling the api. The incoming request's abort signal is passed upstream (proxyApiRequest with forwardAbort), so a page that gives up on the call after 15 s or leaves disconnects the api request too.
  • Used by: openShopPayment from PayLinkScreen after Continue.
  • Auth: none.

Endpoint: OPTIONS /.well-known/lnurlp/[username]

  • Purpose: CORS preflight for LUD-16.
  • Errors: none.
  • Used by: Browsers and wallets.
  • Auth: none.

Endpoint: OPTIONS /.well-known/nostr.json

  • Purpose: CORS preflight for NIP-05.
  • Errors: none.
  • Used by: Browsers.
  • Auth: none.

Endpoint: GET /healthz

  • Purpose: Liveness JSON { status: 'ok' } from src/app/healthz/route.ts.
  • Errors: None if the process is up (always 200).
  • Used by: Container probes and Playwright smoke.
  • Auth: Public.

Endpoint: POST /auth/passkey/authenticate/begin

  • Purpose: Same-origin proxy of api POST /auth/passkey/authenticate/begin.
  • Errors: Upstream status, or 502 if the api is unreachable. The browser's X-App-Build is passed through unchanged. 403 { error, code: 'app_outdated' } when the api requires another build.
  • Used by: startPasskeyAuthentication.
  • Auth: Public.

Endpoint: POST /auth/passkey/authenticate/finish

  • Purpose: Same-origin proxy of api POST /auth/passkey/authenticate/finish.
  • Errors: Upstream status, or 502 if the api is unreachable. The browser's X-App-Build is passed through unchanged. 403 { error, code: 'app_outdated' } when the api requires another build; 503 { error, code: 'logins_closed' } while operators closed logins; 409 { error: 'Recovery is not finished', code: 'recovery_pending' } when the passkey belongs to a social recovery that is not finished yet (the app never reports that passkey to the authenticator as unknown).
  • Used by: finishPasskeyAuthentication.
  • Auth: Public.

Endpoint: POST /diagnostics

  • Purpose: Same-origin proxy of api POST /diagnostics. Body is an allowlisted client event. The api stores it and returns 204.
  • Errors: Upstream 400 for a bad body, 429 when the caller is over the limit, 500 when the log cannot be written, or 502 if the api is unreachable.
  • Used by: reportDiagnostic.
  • Auth: Public. No session.

Endpoint: POST /monitoring

  • Purpose: Same-origin tunnel for browser error reports and sampled performance transactions (forwardSentryEnvelope). Forwards the envelope to the project of NEXT_PUBLIC_SENTRY_DSN, and to nothing else.
  • Errors: 404 while error reporting is off (no DSN), 413 above 1 MiB, 400 when the envelope names another host or project, its header is missing or broken, it has no item, an item header is broken (also a length that is not a whole number of bytes inside the envelope, or that does not end at a newline or at the end of the envelope), or an item is anything but an error or a transaction; 502 when the Sentry server cannot be reached; otherwise the upstream status.
  • Used by: The browser SDK (sentryOptions('browser')).
  • Auth: Public. No session; the visitor's IP address, cookies, and headers are not forwarded.

Endpoint: POST /monitoring/csp

  • Purpose: Same-origin endpoint for Content-Security-Policy violation reports (forwardCspReport), named by report-uri and by the csp group of Reporting-Endpoints. Forwards each violation to the security endpoint of the NEXT_PUBLIC_SENTRY_DSN project, reduced to the directive, the blocked origin or keyword (inline, eval, data, …), the page's origin and first path segment when it is a route of src/app, the script's origin, the disposition (report or enforce), and line, column, and status numbers, then passed through the privacy scrubber.
  • Inputs: The legacy { "csp-report": {…} } body (application/csp-report) or a Reporting API array (application/reports+json) whose csp-violation entries count. At most ten violations per request.
  • Errors: 404 while error reporting is off (no DSN), 413 above 64 KiB, 400 when the body is not JSON or holds no violation with a directive and an http(s) page, 502 when the Sentry server cannot be reached; otherwise 204.
  • Used by: Browsers, for the policy the middleware sends (buildCsp).
  • Auth: Public. No session; the visitor's IP address, cookies, headers, query strings, fragments, member paths, script samples, and referrers are not forwarded.

Endpoint: POST /auth/passkey/register/begin

  • Purpose: Same-origin proxy of api POST /auth/passkey/register/begin. A new account posts JSON { name }. { viewKey } (64 hex) claims an existing public profile and sends no name. The empty body remains the old unnamed path; the new-account path of this app does not use it.
  • Errors: Upstream status (including 404 / 409 with { error }), or 502 if the api is unreachable. The browser's X-App-Build is passed through unchanged. 403 { error, code: 'app_outdated' } when the api requires another build; 503 { error, code: 'logins_closed' } while operators closed logins.
  • Used by: startPasskeyRegistration.
  • Auth: Public.

Endpoint: POST /auth/passkey/register/finish

  • Purpose: Same-origin proxy of api POST /auth/passkey/register/finish.
  • Errors: Upstream status, or 502 if the api is unreachable. The browser's X-App-Build is passed through unchanged. 403 { error, code: 'app_outdated' } when the api requires another build; 503 { error, code: 'logins_closed' } while operators closed logins.
  • Used by: finishPasskeyRegistration.
  • Auth: Public.

Endpoint: POST /auth/passkey/replace/begin

  • Purpose: Same-origin proxy of api POST /auth/passkey/replace/begin.
  • Errors: Upstream 401/400, or 502 if the api is unreachable.
  • Used by: proxyAuthPasskeyReplaceBeginPost.
  • Auth: Bearer.

Endpoint: POST /auth/passkey/replace/finish

  • Purpose: Same-origin proxy of api POST /auth/passkey/replace/finish.
  • Errors: Upstream 401/400, or 502 if the api is unreachable.
  • Used by: proxyAuthPasskeyReplaceFinishPost.
  • Auth: Bearer.

Endpoint: POST /auth/passkey/seed/begin

  • Purpose: Same-origin proxy of api POST /auth/passkey/seed/begin. Bearer session, empty body. Adds a recovery-phrase passkey without replacing the login passkey.
  • Errors: Upstream 401, 409 { error } when the account already has a seed, other non-2xx, or 502 if the api is unreachable.
  • Used by: startPasskeySeed.
  • Auth: Bearer.

Endpoint: POST /auth/passkey/seed/finish

  • Purpose: Same-origin proxy of api POST /auth/passkey/seed/finish. Bearer plus JSON { challengeId, credential }. 200 is the owner account, or that account under one account key. account only holds when it is the only top-level field; a further field is not an account. finishPasskeySeed reads either shape. Includes passkeyCredentialId of the new seed passkey. No new token. Not the login call.
  • Errors: Upstream 401, 409 { error } when the account already has a seed, 400, or 502 if the api is unreachable.
  • Used by: finishPasskeySeed.
  • Auth: Bearer.

Endpoint: POST /auth/passkey/recovery/begin

  • Purpose: Same-origin proxy of api POST /auth/passkey/recovery/begin. Starts a social recovery on a phone without the account's passkey. JSON { sparkPubkey, lookup: { signature, timestamp } }: the old wallet's identity key and its own signed address lookup (lowercase DER hex, timestamp in seconds), which the api forwards to the address server. 200 is { challengeId, options, accountId, username }, the creation options for the new passkey and the account the old wallet belongs to.
  • Errors: Upstream status, or 502 if the api is unreachable. The browser's X-App-Build is passed through unchanged. 400 for a bad body; 403 { error, code: 'app_outdated' } when the api requires another build; 404 when the old wallet holds no account; 409 code recovery_done (already recovered, sign in with the new passkey) or recovery_operator (only an operator can recover it); 429; 503 while the address service is unavailable or a forwarded recovery is still settling, or { error, code: 'logins_closed' } while operators closed logins.
  • Used by: startPasskeyRecovery.
  • Auth: Public. Signed by the old wallet.

Endpoint: POST /auth/passkey/recovery/finish

  • Purpose: Same-origin proxy of api POST /auth/passkey/recovery/finish. JSON { challengeId, credential, newSparkPubkey, signature: { pubkey, signature } }: the new passkey's attestation, the new wallet's key, and the old wallet's signature over the recovery message. 200 { status: 'pending' } stores the pending recovery; the account moves only once the address moved. A repeat of the same finish after a lost answer is 200 again and changes nothing.
  • Errors: Upstream status, or 502 if the api is unreachable. The browser's X-App-Build and Origin are passed through unchanged. 400 for a bad body, origin, passkey, or signature, and Unknown or expired challenge, Challenge expired, or Challenge already used when the account did not move; 403 { error, code: 'app_outdated' }; 409 A recovery is already pending or Wallet key is already in use; 429; 503, or { error, code: 'logins_closed' } while operators closed logins.
  • Used by: finishPasskeyRecovery.
  • Auth: Public. Signed by the old wallet.

Endpoint: GET /gifts

  • Purpose: Same-origin proxy of api GET /gifts?day=YYYY-MM-DD (individual outbound gifts that UTC day).
  • Errors: Upstream 400/503, or 502 if the api is unreachable.
  • Used by: fetchGiftDay on /stats/[day].
  • Auth: Public.

Endpoint: GET /messages/stats

  • Purpose: Same-origin proxy of api GET /messages/stats (living notes and replies counted together, by UTC day).
  • Auth: Public.
  • Inputs: None.
  • Outputs: { postCount, postsOverTime } from the api.
  • Errors: Forwards the upstream status.
  • Used by: StatsLoader on /stats.

Endpoint: GET /gifts/stats

  • Purpose: Same-origin proxy of api GET /gifts/stats (aggregated outbound gift totals; optional recipient query forwarded).
  • Errors: Upstream 503, or 502 if the api is unreachable.
  • Used by: fetchGiftStats on /stats and the people-count chart on /statistics (every visitor, including signed-out, no goal). Historical amounts there stay on each day's rate; live amounts use GET /fx/spot.
  • Auth: Public.

Endpoint: GET /wallets/stats

  • Purpose: Same-origin proxy of api GET /wallets/stats (self-reported member-wallet totals and the gap-free UTC-day balance series).
  • Inputs: None.
  • Outputs: { walletCount, fundedWalletCount, totalSats, totalBtc, asOf, balanceOverTime } from the api. walletCount counts wallets that ever reported a balance; fundedWalletCount counts those with a current balance above zero. Empty data is zeros, asOf: null, and balanceOverTime: [].
  • Errors: The proxy forwards the upstream status, including 503 { error: "Wallet stats are unavailable" }, or answers 502 if the api is unreachable.
  • Used by: fetchWalletStats on /stats and on /stats/wallet (the wallets-per-day chart). A failed fetch omits the Wallets section on /stats, and on /stats/wallet only hides that chart.
  • Auth: Public.

Endpoint: GET /wallets/usage

  • Purpose: Same-origin proxy of api GET /wallets/usage (aggregate wallet payments since the production release: totals, days, flows, amount buckets, hours, forum, and shop charges). No person, account, or payment id is in the body.
  • Inputs: None.
  • Outputs: WalletUsage: releasedAt, asOf, totals, days, flows, amountBuckets, hours (24 UTC hours), forum, and shopCharges. The client schema strips unknown extra fields and rejects a missing required field.
  • Errors: The proxy forwards the upstream status, or answers 502 if the api is unreachable. The page shows one quiet line Could not load wallet usage. Please try again. and does not offer Try again.
  • Used by: fetchWalletUsage on /stats/wallet.
  • Auth: Public.

Endpoint: GET /habits

  • Purpose: Same-origin proxy of api GET /habits (public habit list, review week, and comments). Forwards Authorization when the browser sent it, so the owner can receive internal notes.
  • Errors: The proxy forwards the upstream status, or 502 if the api is unreachable.
  • Used by: fetchMemberHabits on /habit-tracker.
  • Auth: Public. A bearer is optional and is forwarded, not added.

Endpoint: POST /habits

  • Purpose: Same-origin proxy of api POST /habits (add, edit, archive, log, comment, delete a comment, or request a Lightning invoice). Forwards Authorization and Time-Zone. Does not pay the invoice.
  • Errors: The proxy forwards the upstream status. Expected upstream errors include 401 without a bearer, 400 for a bad body, 403 { error: 'SUNDAY_REST' } when a comment, a comment deletion, or an invoice request falls on the device's local Sunday, 409 when the period is closed or no wallet can be invoiced, or 502 if the api is unreachable. A missing, blank, or invalid time zone does not refuse a comment, a comment deletion, or an invoice request. Add, edit, log, and archive do not rest on Sunday.
  • Used by: postMemberHabit on /habit-tracker.
  • Auth: Bearer. The client sends Authorization; this proxy does not add it.

Endpoint: GET /fx/spot

  • Purpose: Same-origin proxy of api GET /fx/spot: the current price of 1 BTC in USD, CHF, EUR, and PHP with asOf and source. A code the api could not price is left out of rates. Without any quote the body is { "asOf": null, "source": null, "rates": {} }; the route has no error status of its own.
  • Errors: The proxy forwards the upstream status, or 502 if this proxy cannot reach the api.
  • Used by: fetchFxSpot through useSpotRate, on every screen that enters or converts an amount live (the amount field, /pos, gift and reaction amounts, the wallet, the payment fiat suffixes, the /stats wallet totals and point tooltips, and the /stats/wallet volume and Tondo fund balance).
  • Auth: Public. No bearer.

Endpoint: GET /shops/activity

  • Purpose: Same-origin proxy of api GET /shops/activity (shop-use counts, 30 UTC days).
  • Errors: The proxy forwards the upstream status. Expected upstream errors are 503 when shop activity is unavailable, or 502 if this proxy cannot reach the api.
  • Used by: fetchShopActivity on /statistics.
  • Auth: No bearer. StatisticsScreen calls it for every visitor.

Endpoint: GET /funding/places

  • Purpose: Same-origin proxy of the public api GET /funding/places: the current grant round, its places, how many are admitted, how many are left, and the active-shop goal that opens the next round.
  • Errors: The proxy forwards the upstream status. Expected upstream error is 503 when funding is unavailable, or 502 if this proxy cannot reach the api.
  • Used by: fetchGrantPlaces in GrantPlacesPanel on /grants and /grants/goals.
  • Auth: No bearer. Every visitor can read the free places.

Endpoint: GET /shops/list

  • Purpose: Same-origin proxy of api GET /shops (public shop directory). Forwards limit and cursor.
  • Errors: The proxy forwards the upstream status (400 invalid limit or cursor, 503 shops unavailable) or 502 when the api cannot be reached.
  • Used by: fetchListedShops on /shops.
  • Auth: No bearer.

Endpoint: GET /funding/goal

  • Purpose: Same-origin proxy of api GET /funding/goal (7 UTC days of shop till-charge counts, plus how many shops had a charge on 5 of those days). Not the public 30-day shop series.
  • Errors: The proxy forwards the upstream status. Expected upstream errors are 401 without a bearer session and 503 when the goal is unavailable, or 502 if this proxy cannot reach the api.
  • Used by: fetchGrantContinuation on /grants/goals.
  • Auth: Bearer. The client sends Authorization; this proxy does not add it.

Endpoint: POST /me/name

  • Purpose: Same-origin proxy to set or replace the display name.
  • Errors: Upstream 400, or 502 if the api is unreachable.
  • Used by: setName.
  • Auth: Bearer.

Endpoint: POST /me/username

  • Purpose: Same-origin proxy to set the unique @21.gifts username (LUD-16 / NIP-05 local-part).
  • Errors: Upstream 400/409, or 502 if the api is unreachable.
  • Used by: setUsername.
  • Auth: Bearer.

Endpoint: POST /me/location

  • Purpose: Same-origin proxy to set, replace, or clear the free-text profile location ({ location }; empty string clears).
  • Errors: Upstream 400 (Location must be at most 80 characters), 401, or 502 if the api is unreachable.
  • Used by: setLocation / LocationForm.
  • Auth: Bearer.

Endpoint: PUT /me/about

  • Purpose: Same-origin proxy of api PUT /me/about (set or replace the signed-in About me note). JSON { text, photo? }: photo omitted keeps a stored image, null clears it, { contentType, data } sets a JPEG/PNG/WebP like a forum post.
  • Errors: Upstream 400/401/409, or 502 if the api is unreachable.
  • Used by: putAboutMe.
  • Auth: Bearer.

Endpoint: GET /pictures/me

  • Purpose: Same-origin Bearer proxy of api GET /pictures/me (raw bytes of the signed-in profile photo). Not the wide image and not the About me note photo.
  • Errors: Upstream 401/404, or 502 if the api is unreachable.
  • Used by: fetchProfilePhoto.
  • Auth: Bearer.

Endpoint: PUT /pictures/me

  • Purpose: Same-origin Bearer proxy of api PUT /pictures/me. Body { photo } sets the profile photo or null clears it. Does not change the wide image or the About me note.
  • Errors: Upstream 400/401, or 502 if the api is unreachable.
  • Used by: putProfilePhoto.
  • Auth: Bearer.

Endpoint: GET /banners/me

  • Purpose: Same-origin Bearer proxy of api GET /banners/me (raw bytes of the signed-in wide profile image). Not the About me photo.
  • Errors: Upstream 401/404, or 502 if the api is unreachable.
  • Used by: fetchWideBanner.
  • Auth: Bearer.

Endpoint: PUT /banners/me

  • Purpose: Same-origin Bearer proxy of api PUT /banners/me. Body { photo } sets a wide image or null clears it. Does not change the About me photo.
  • Errors: Upstream 400/401, or 502 if the api is unreachable.
  • Used by: putWideBanner.
  • Auth: Bearer.

Endpoint: GET /pictures/[accountId]

  • Purpose: Same-origin public proxy of the round profile photo for that account. Tries api GET /pictures/{accountId}.jpg, then .png, then .webp. No bearer. Not the wide image and not the About me note photo.
  • Errors: 404 when the id is not a public file id or none of the three files is an image. 502 if the api is unreachable.
  • Used by: MemberProfileScreen visitor header.
  • Auth: None.

Endpoint: GET /banners/[accountId]

  • Purpose: Same-origin public proxy of the wide profile image for that account. Tries api GET /banners/{accountId}.jpg, then .png, then .webp. No bearer. Not the profile photo and not the About me note photo.
  • Errors: 404 when the id is not a public file id or none of the three files is an image. 502 if the api is unreachable.
  • Used by: MemberProfileScreen visitor header.
  • Auth: None.

Endpoint: GET /me/about/photo

  • Purpose: Same-origin Bearer proxy of api GET /me/about/photo (raw JPEG/PNG/WebP bytes for the signed-in About me note). Always render via blob URLs — not bare <img src>.
  • Errors: Upstream 401/404, or 502 if the api is unreachable.
  • Used by: fetchAboutMePhoto.
  • Auth: Bearer.

Endpoint: GET /view-key/[viewKey]/about/photo

  • Purpose: Same-origin public proxy of api GET /view/:viewKey/about/photo (raw JPEG/PNG/WebP bytes for the view-key About me note). Always render via blob URLs — not bare <img src>.
  • Errors: Upstream 404, or 502 if the api is unreachable.
  • Used by: fetchViewAboutMePhoto.
  • Auth: none.

Endpoint: POST /me/wallet-backup-seen

  • Purpose: Same-origin proxy of api POST /me/wallet-backup-seen. Records that the recovery phrase was shown.
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: postWalletBackupSeen.
  • Auth: Bearer.

Endpoint: POST /me/wallet/report

  • Purpose: Same-origin proxy of api POST /me/wallet/report. While the member is signed in, sends the wallet's balance (balanceSats, syncedAt) and the payments the api has not acknowledged yet (payments, at most 200 per request, each with id, direction, status, amountSats, feeSats, timestamp, method, paymentHash, invoice, destination, description, lnurlComment). Never a recovery phrase, private key, PRF output, or preimage.
  • Returns: Upstream { acknowledgedIds }.
  • Errors: Upstream 400, 401, 413, 429, or 502 if the api is unreachable.
  • Used by: postWalletReport (from reportWallet).
  • Auth: Bearer.

Endpoint: POST /me/wallet/counterparties

  • Purpose: Same-origin proxy of api POST /me/wallet/counterparties (21gifts/api#605). Resolves the member on the other side of a completed payment: the sender for incoming (in) payments or the recipient for outgoing (out) payments. The api names that member only from the completed plain Spark transfer its own read of the caller's wallet observed, and only after the caller's own report carried the payment as completed. It reads wallets about once a minute, so a payment it has not read yet has no name and may get one on a later request; a Lightning swap, an on-chain payment, and a payment whose other side is not a member wallet never get one.
  • Inputs: Bearer session and a payments array of 1–32 { id, direction } rows, with in/out directions; each id is trimmed and must then be 1–256 characters; at most 16384 bytes.
  • Returns: The upstream 200 { counterparties: [{ id, accountId, username }] } (the trimmed id; a payment without a name is left out), or its error status: 401 Unauthorized, 400 Invalid counterparty lookup, 413 Request body is too large, 429 Too many requests after 60 lookups per account and minute, 503 Counterparty lookup is unavailable.
  • Used by: fetchPaymentCounterparties on the payment details screen, through usePaymentCounterparty (at most five lookups per opened screen).

Endpoint: POST /me/wallet/hearts

  • Purpose: Same-origin proxy of api POST /me/wallet/hearts. Looks up the forum posts attached to 1–32 lowercase Spark payment hashes for the signed-in member, and the credit notes of the ones that are loan repayments.
  • Returns: Upstream { hearts, repayments }. Heart rows contain paymentHash, messageId, authorName, text, and deleted. Repayment rows contain paymentHash, messageId (the credit note), dayIndex (zero-based day of the term), termDays (or null), role (borrower when the member paid it, giver when the member is being repaid), authorName (the borrower, may be empty), text (clipped, may be empty), and deleted. A hash is in at most one of the two arrays; hashes that are neither are absent. An api without repayments is read as no repayments, so those rows render as before.
  • Errors: Upstream 400, 401, 413, or 502 if the api is unreachable. The wallet UI keeps its ordinary gift title when the lookup fails or has a bad body.
  • Used by: fetchHeartPosts (from useHeartContext).
  • Auth: Bearer.

Endpoint: POST /me/events

  • Purpose: Same-origin proxy of api POST /me/events. Sends a batch of at most 50 interaction events of the signed-in member, each { name, at, path, props }.
  • Returns: The upstream status.
  • Errors: Upstream 400, 401, 413, 429, or 502 if the api is unreachable.
  • Used by: flushInteractions and logLogout (the logout event in a request of its own).
  • Auth: Bearer.

Endpoint: PUT /me/wallet

  • Purpose: Same-origin proxy of api PUT /me/wallet. Claims the in-app wallet's identity public key for the account. Write-once after the wallet is verified.
  • Errors: Upstream 400, 401, 404 (feature off), 409 (wallet already verified), or 502 if the api is unreachable.
  • Used by: putWallet.
  • Auth: Bearer.

Endpoint: PUT /me/recovery-share

  • Purpose: Same-origin proxy of api PUT /me/recovery-share. Stores 21.gifts' share of the owner's social recovery for the account's verified wallet. JSON { sparkPubkey, share }: the verified wallet key and the raw share with index 2 (20 lowercase words). 200 is the owner account with socialRecoverySetUp: true.
  • Errors: Upstream 400 for a bad body, 401, 404 (feature off), 409 Wallet is not connected or Wallet changed, 503 Social recovery is unavailable, or 502 if the api is unreachable.
  • Used by: putRecoveryShare.
  • Auth: Bearer.

Endpoint: GET /me/previous-wallets

  • Purpose: Same-origin proxy of api GET /me/previous-wallets. Lists the wallets the account used before a social recovery: { wallets: [{ sparkPubkey, sparkAddress, replacedAt, balanceSats }] }. balanceSats is the public explorer balance the api read, or null when unknown; it is information only.
  • Errors: Upstream 401, 404 (feature off), 503 Wallet data is unavailable, or 502 if the api is unreachable.
  • Used by: fetchPreviousWallets.
  • Auth: Bearer.

Endpoint: DELETE /me/previous-wallets/[sparkPubkey]

  • Purpose: Same-origin proxy of api DELETE /me/previous-wallets/:sparkPubkey. Drops one previous wallet of the account, together with the 21.gifts share stored for it. 204 with no body.
  • Errors: Upstream 401, 404 Not found (not a previous wallet of the account, also on a repeat, or feature off), 503 Wallet data is unavailable, or 502 if the api is unreachable.
  • Used by: deletePreviousWallet, which takes 404 as already removed: it asks only for a key the page found listed.
  • Auth: Bearer.

Endpoint: GET /me/held-shares

  • Purpose: Same-origin proxy of api GET /me/held-shares. Lists the caller's own share boxes, oldest first: { boxes: [{ id, ciphertext, updatedAt }] }. The ciphertext is opaque to the api; the owner's id and name exist only inside it.
  • Errors: Upstream 401, 429, or 502 if the api is unreachable.
  • Used by: fetchHeldShareBoxes.
  • Auth: Bearer.

Endpoint: PUT /me/held-shares/[id]

  • Purpose: Same-origin proxy of api PUT /me/held-shares/:id. Creates (201) or replaces (200) one box of the caller. JSON { ciphertext }: base64url without padding of 29 to 1024 bytes whose first byte is 0x01. id is 32 lower-case hex digits drawn by the app.
  • Errors: Upstream 400 for a bad id or body, 401, 409 Box id in use (the id belongs to another account) or Too many held shares (more than 50 on create), 429, or 502 if the api is unreachable.
  • Used by: putHeldShareBox.
  • Auth: Bearer.

Endpoint: DELETE /me/held-shares/[id]

  • Purpose: Same-origin proxy of api DELETE /me/held-shares/:id. Deletes one box of the caller. 204 with no body, also for an id that is gone or belongs to another account (which changes nothing).
  • Errors: Upstream 401, 429, or 502 if the api is unreachable.
  • Used by: deleteHeldShareBox.
  • Auth: Bearer.

Endpoint: POST /lnurlpay/[pubkey]

  • Purpose: Same-origin proxy of api POST /lnurlpay/:pubkey. The in-app wallet registers the account's username as its address on the app's own host; success marks the wallet verified.
  • Errors: Upstream 404 (feature off or not the account's own username and key), 409, other 4xx from the address server, 503, or 502 if the api is unreachable.
  • Used by: The in-app wallet (registerWalletAddress).
  • Auth: Signed by the wallet (X-Breez-Signature, X-Breez-Timestamp forwarded).

Endpoint: POST /lnurlpay/[pubkey]/recover

  • Purpose: Same-origin proxy of api POST /lnurlpay/:pubkey/recover. The in-app wallet looks up the address it registered.
  • Errors: Upstream 404 or 503, or 502 if the api is unreachable.
  • Used by: The in-app wallet.
  • Auth: Signed by the wallet.

Endpoint: POST /lnurlpay/[pubkey]/transfer

  • Purpose: Same-origin proxy of api POST /lnurlpay/:pubkey/transfer. During a social recovery the new in-app wallet (path key) claims the account's address that the old wallet authorized for it. The body is the wallet's own { username, description, from_pubkey, from_signature, to_signature, timestamp }, signed by both wallets.
  • Errors: Upstream 2xx and 4xx of the address server passed through, 404 (feature off, or no pending recovery admits the claim), 409 when the registration could not be confirmed, 413, 429, 503, or 502 if the api is unreachable.
  • Used by: The new in-app wallet during a social recovery; no app fetch calls it.
  • Auth: Signed by both wallets.

Endpoint: GET /lnurlpay/[pubkey]/metadata

  • Purpose: Same-origin proxy of api GET /lnurlpay/:pubkey/metadata. The in-app wallet reads the notes payers left on received payments.
  • Errors: Upstream 404 or 503, or 502 if the api is unreachable.
  • Used by: The in-app wallet.
  • Auth: Signed by the wallet.

Endpoint: GET /lnurlp/[username]/invoice

  • Purpose: Same-origin proxy of api GET /lnurlp/:username/invoice. A payer's wallet asks for a payment request to a member's verified in-app wallet. CORS *.
  • Errors: Upstream 404 or 503, or 502 if the api is unreachable.
  • Used by: Payers' wallets, after GET /.well-known/lnurlp/[username].
  • Auth: none.

Endpoint: GET /verify/[paymentHash]

  • Purpose: Same-origin proxy of api GET /verify/:paymentHash. A payer's wallet checks whether a payment to a member's in-app wallet settled. CORS *.
  • Errors: Upstream 404 or 503, or 502 if the api is unreachable.
  • Used by: Payers' wallets.
  • Auth: none.

Endpoint: POST /me/passkey-renew/report

  • Purpose: Same-origin proxy of api POST /me/passkey-renew/report. Stores a browser ceremony failure or cancel. The body is the six safe fields plus optional public authenticator facts and browser capability names.
  • Errors: Upstream 401 or 400, or 502 if the api is unreachable.
  • Used by: postPasskeyRenewReport.
  • Auth: Bearer.

Endpoint: POST /me/passkey-renew/ack

  • Purpose: Same-origin proxy of api POST /me/passkey-renew/ack. Acknowledges the failure notice so it is not shown again.
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: postPasskeyRenewAck.
  • Auth: Bearer.

Endpoint: POST /me/setup/skip

  • Purpose: Same-origin proxy to skip the name onboarding step ({ step: 'name' }). Rules and username cannot be skipped.
  • Errors: Upstream 400/401, or 502 if the api is unreachable.
  • Used by: skipSetup.
  • Auth: Bearer.

Endpoint: GET /forum/members/[accountId]

  • Purpose: Same-origin proxy of api GET /members/:accountId for signed-in member profiles.
  • Errors: Upstream 401/404/409 missing_requirements, or 502 if the api is unreachable.
  • Used by: fetchMember via MemberProfileLoader.
  • Auth: Bearer.

Endpoint: GET /forum/members/[accountId]/activity

  • Purpose: Same-origin Bearer proxy of api GET /members/:accountId/activity for a member's given and received series.
  • Errors: Upstream 401/404/409 missing_requirements, 503 { error: "Gift stats are unavailable" }, or 502 if the api is unreachable.
  • Used by: fetchMemberActivity via MemberProfileLoader.
  • Auth: Bearer.

Endpoint: GET /forum/members/[accountId]/posts

  • Purpose: Same-origin proxy of api GET /members/:accountId/posts for a signed-in member's top-level forum posts.
  • Errors: Upstream 401/404/409 missing_requirements, or 502 if the api is unreachable.
  • Used by: fetchMemberPosts via MemberProfileScreen.
  • Auth: Bearer.

Endpoint: GET /forum/members/[accountId]/shops

  • Purpose: Same-origin proxy of api GET /members/:accountId/shops for a signed-in member's top-level forum shop notes.
  • Errors: Upstream 401/404/409 missing_requirements, or 502 if the api is unreachable.
  • Used by: fetchMemberShops via MemberProfileScreen.
  • Auth: Bearer.

Endpoint: GET /forum/members/[accountId]/credits

  • Purpose: Same-origin proxy of api GET /members/:accountId/credits for a signed-in member's top-level forum credit notes.
  • Errors: Upstream 401/404/409 missing_requirements, or 502 if the api is unreachable.
  • Used by: fetchMemberCredits via MemberProfileScreen.
  • Auth: Bearer.

Endpoint: GET /forum/members/[accountId]/replies

  • Purpose: Same-origin proxy of api GET /members/:accountId/replies for a signed-in member's forum replies.
  • Errors: Upstream 401/404/409 missing_requirements, or 502 if the api is unreachable.
  • Used by: fetchMemberReplies via MemberProfileScreen.
  • Auth: Bearer.

Endpoint: POST /me/forum-laws-dismissed

  • Purpose: Same-origin proxy to permanently dismiss the welcome-forum living-room laws hint (forumLawsDismissed: true on the account).
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: dismissForumLaws.
  • Auth: Bearer.

Endpoint: POST /me/wallet-intro-seen

  • Purpose: Same-origin proxy that records that the member finished or skipped the one-time wallet tour on /welcome (walletIntroSeen: true on the account), so it is not shown again on any device. No body; idempotent.
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: markWalletIntroSeen.
  • Auth: Bearer.

Endpoint: POST /me/notification-level

  • Purpose: Same-origin Bearer proxy of api POST /me/notification-level. JSON body { level: "all"|"active"|"mentions"|"none" } returns the owner Account.
  • Errors: Upstream 401, 400 invalid level, or 502 if the api is unreachable.
  • Used by: postNotificationLevel.
  • Auth: Bearer.

Endpoint: POST /me/heart-notifications

  • Purpose: Same-origin Bearer proxy of api POST /me/heart-notifications. JSON body { enabled: boolean } returns the owner Account (notifyHearts).
  • Errors: Upstream 401, 400 invalid body, or 502 if the api is unreachable.
  • Used by: postHeartNotifications.
  • Auth: Bearer.

Endpoint: POST /me/amount-unit

  • Purpose: Same-origin Bearer proxy of api POST /me/amount-unit. JSON body { unit: "btc"|"fiat" } returns the owner Account. The same unit again is still 200.
  • Errors: Upstream 401, 400 invalid unit, or 502 if the api is unreachable.
  • Used by: setAmountUnit.
  • Auth: Bearer.

Endpoint: POST /me/heart-sats

  • Purpose: Same-origin Bearer proxy of api POST /me/heart-sats. JSON body { sats } with a whole number from 1 through 10,000,000 returns the owner Account with heartSats.
  • Errors: Upstream 401, 400 for a missing, empty, zero, fractional, negative, or too-large value, or 502 if the api is unreachable.
  • Used by: saveHeartSats through setHeartSats.
  • Auth: Bearer.

Endpoint: POST /me/locale

  • Purpose: Same-origin Bearer proxy of api POST /me/locale. JSON body { locale, onlyIfUnset } returns the owner Account. onlyIfUnset: true does not overwrite a stored locale.
  • Errors: 401 when the bearer is missing or blank, before the proxy. Upstream 401, 400 invalid body, or 502 if the api is unreachable.
  • Used by: setAccountLocale.
  • Auth: Bearer; Owner-Account.

Endpoint: POST /me/fiat

  • Purpose: Same-origin Bearer proxy of api POST /me/fiat. JSON body { fiat, onlyIfUnset } returns the owner Account. onlyIfUnset: true does not overwrite a stored fiat value.
  • Errors: 401 when the bearer is missing or blank, before the proxy. Upstream 401, 400 invalid body, or 502 if the api is unreachable.
  • Used by: setAccountFiat.
  • Auth: Bearer; Owner-Account.

Endpoint: POST /me/rules-agreement

  • Purpose: Same-origin proxy to record living-room rules agreement on the signed-in account (rulesAgreedAt).
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: agreeToRules.
  • Auth: Bearer.

Endpoint: GET /pos/charge

  • Purpose: Same-origin proxy of api GET /pos. Returns charge (the pending charge, or one paid within the last minute, else null), history (including paid rows), and received: the payments the member's own wallets received without a till charge in the last 24 hours, at most 20, newest first, each { id, amountSats, receivedAt, kind } with kind lightning or spark and no fiat figure (an api that does not send it yet is read as none). Each charge has status pending, paid, cancelled, or expired, and paidAt (ISO string or null). The till reads it on open, right before each create, on Try again after a failed load, when the session or the language changes, once when the open charge runs out, when the tab becomes visible again, after every read of this tab's wallet (a received payment, each wallet sync, and the five-minute wallet refresh; quiet once the till has an answer), after Cancel, once after a create or cancel whose answer was lost, once after a create the api refuses because a payment is already open (another tab's charge then shows), once after a payment that names a charge no read listed (quiet once the till has an answer; it shows whether another tab or device opened the charge the payment names), while a Lightning payment that names no charge could be the open charge's (its amount, made from the second the charge was created to one minute after its end) at once and then PAY_POLL_MS (2 s) after each ask settled, one ask at a time for a payment as every pay poll does (a newer such payment asks at once, also while an ask of the one before is still on its way), each ask a read of its own that cuts no other read off (answers are ordered by applyRead, a failed ask is quiet), until a read shows the charge paid, cancelled or gone before its end, and at most until one minute after that payment, and after the paid confirmation is closed. GET /pos returns no payment hash of the charge's BOLT11 invoices, so the till confirms a Lightning payment of the charge by the paid status this endpoint returns; amount and time alone never pay a charge.
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: fetchPosState (PosTill, PosAmount).
  • Auth: Bearer.

Endpoint: POST /pos/charge

  • Purpose: Same-origin proxy of api POST /pos with { amountSats }.
  • Errors: Upstream 400, 401, 409, 502.
  • Used by: createPosCharge.
  • Auth: Bearer.

Endpoint: DELETE /pos/charge

  • Purpose: Same-origin proxy of api DELETE /pos. Cancels the open charge.
  • Errors: Upstream 401, 404, or 502 if the api is unreachable.
  • Used by: cancelPosCharge.
  • Auth: Bearer.

Endpoint: GET /me

  • Purpose: Same-origin proxy of the signed-in account, including optional funding (null for basis).
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: fetchMe.
  • Auth: Bearer.

Endpoint: GET /me/activity

  • Purpose: Same-origin Bearer proxy of api GET /me/activity for given and received sat totals plus both cumulative day series (house gifts and forum zaps).
  • Errors: Upstream 401, 503 { error: "Gift stats are unavailable" }, or 502 if the api is unreachable.
  • Used by: fetchAccountActivity via useAccountTotals. The profile chart uses fetchMemberActivity.
  • Auth: Bearer.

Endpoint: GET /view-key/[viewKey]

  • Purpose: Same-origin public proxy of api GET /view/:viewKey.
  • Errors: Upstream 404 { error: "Not found" }, or 502 if the api is unreachable.
  • Used by: fetchViewProfile.
  • Auth: Public.

Endpoint: GET /view-key/[viewKey]/activity

  • Purpose: Same-origin public proxy of api GET /view/:viewKey/activity for the public profile given and received series.
  • Errors: Upstream 404, 503 { error: "Gift stats are unavailable" }, or 502 if the api is unreachable.
  • Used by: fetchViewActivity via ViewProfileLoader when the card stays public.
  • Auth: Public.

Endpoint: GET /view-key/[viewKey]/posts

  • Purpose: Same-origin public proxy of api GET /view/:viewKey/posts. The body is { messages }, the same list as the member posts route.
  • Errors: Upstream 404, 503, or 502 if the api is unreachable.
  • Used by: fetchViewForumList via ViewProfileLoader.
  • Auth: Public.

Endpoint: GET /view-key/[viewKey]/shops

  • Purpose: Same-origin public proxy of api GET /view/:viewKey/shops. The body is { messages }.
  • Errors: Upstream 404, 503, or 502 if the api is unreachable.
  • Used by: fetchViewForumList via ViewProfileLoader.
  • Auth: Public.

Endpoint: GET /view-key/[viewKey]/credits

  • Purpose: Same-origin public proxy of api GET /view/:viewKey/credits. The body is { messages }.
  • Errors: Upstream 404, 503, or 502 if the api is unreachable.
  • Used by: fetchViewForumList via ViewProfileLoader.
  • Auth: Public.

Endpoint: GET /view-key/[viewKey]/replies

  • Purpose: Same-origin public proxy of api GET /view/:viewKey/replies. The body is { messages }.
  • Errors: Upstream 404, 503, or 502 if the api is unreachable.
  • Used by: fetchViewForumList via ViewProfileLoader.
  • Auth: Public.

Endpoint: GET /forum/messages

  • Purpose: Same-origin Bearer proxy of api GET /messages (public forum list, newest-first), forwarding optional mode, limit, and cursor query parameters. App path is /forum/messages so /messages/[id] can serve HTML. The welcome client always sends limit=20; the JSON body may include opaque nextCursor (omitted at end of feed).
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: fetchMessages.
  • Auth: Bearer.

Endpoint: GET /forum/messages/places

  • Purpose: Same-origin Bearer proxy of api GET /messages/places (live top-level notes that have a pin).
  • Errors: Upstream 401, or 502 if the api is unreachable.
  • Used by: fetchPlaces.
  • Auth: Bearer.

Endpoint: GET /maps/key

  • Purpose: Returns { key } for the browser map, or { key: null } when GOOGLE_MAPS_API_KEY is unset or blank. An empty value does not fail container boot. The key is not logged.
  • Errors: None. Always 200.
  • Used by: fetchMapsKey (PlacesMapScreen, ShopScreen, PlaceField).
  • Auth: None.

Endpoint: GET /forum/messages/hidden

  • Purpose: Same-origin Bearer proxy of api GET /messages/hidden (hidden living-room notes for moderators). App path is /forum/messages/hidden so HTML /moderate/hidden can serve the page.
  • Errors: Upstream 401/403, or 502 if the api is unreachable.
  • Used by: listHiddenMessages via HiddenNotesScreen on /moderate/hidden.
  • Auth: Bearer; moderator role on the api.

Endpoint: POST /forum/messages

  • Purpose: Same-origin Bearer proxy of api POST /messages (create a public forum message or reply with optional photo, optional place pin, and optional Ask fields). JSON and multipart send goalCurrency and goalAmount; goalSats remains a field of the read note. Optional JSON or multipart goalCurrency and goalAmount (top-level notes only) are the ask; omitted on replies and when unset. A place pin is likewise top-level only.
  • Errors: Upstream 401/400/403/429, or 502 if the api is unreachable. 403 is an unpaid-reply rejection (A reply needs a Bitcoin payment, or the api error string).
  • Used by: postMessage.
  • Auth: Bearer.

Endpoint: GET /forum/messages/[id]/replies

  • Purpose: Same-origin Bearer proxy of api GET /messages/:id/replies (oldest-first replies for one note). The body also carries hearts, the note's paid hearts newest first; each heart has accountId, name, optional username and role, the exact sats, createdAt, and the frozen amountUsd, amountChf, amountEur, and amountPhp strings (two decimals or null). A missing hearts field is [].
  • Errors: Upstream 401/404, or 502 if the api is unreachable.
  • Used by: fetchReplies.
  • Auth: Bearer.

Endpoint: GET /public-messages/[id]/external-profile

  • Purpose: Same-origin public proxy of api GET /messages/:id/external-profile (name, npub, and optional nip05 and lud16, no Bearer). Optional postCount, replyCount, shopCount, and creditCount are nonnegative integers; absent still parses.
  • Errors: Upstream 404 { error: "Not found" }, upstream 503, or 502 if the api is unreachable.
  • Used by: fetchExternalAuthorProfile.
  • Auth: Public.

Endpoint: GET /public-messages/[id]/external-posts

  • Purpose: Same-origin public proxy of api GET /messages/:id/external-posts, body { messages } for that external author, no Bearer.
  • Errors: Upstream failure, or 502 if the api is unreachable.
  • Used by: fetchExternalAuthorPosts.
  • Auth: Public.

Endpoint: GET /public-messages/[id]/external-shops

  • Purpose: Same-origin public proxy of api GET /messages/:id/external-shops, body { messages } for that external author's shop notes, no Bearer.
  • Errors: Upstream failure, or 502 if the api is unreachable.
  • Used by: fetchExternalAuthorShops.
  • Auth: Public.

Endpoint: GET /public-messages/[id]/external-credits

  • Purpose: Same-origin public proxy of api GET /messages/:id/external-credits, body { messages } for that external author's credit notes, no Bearer.
  • Errors: Upstream failure, or 502 if the api is unreachable.
  • Used by: fetchExternalAuthorCredits.
  • Auth: Public.

Endpoint: GET /public-messages/[id]/external-replies

  • Purpose: Same-origin public proxy of api GET /messages/:id/external-replies, body { messages } for that external author, no Bearer.
  • Errors: Upstream failure, or 502 if the api is unreachable.
  • Used by: fetchExternalAuthorReplies.
  • Auth: Public.

Endpoint: GET /public-messages/[id]

  • Purpose: Same-origin public proxy of api GET /messages/:id (one note as JSON, no Bearer). The HTML public note is /messages/[id].
  • Errors: Upstream 404 { error: "Not found" }, or 502 if the api is unreachable.
  • Used by: fetchPublicMessage.
  • Auth: Public.

Endpoint: GET /public-messages/[id]/replies

  • Purpose: Same-origin public proxy of api GET /messages/:id/replies (oldest-first live replies, no Bearer). The body also carries the note's hearts newest first with the same fields as the Bearer proxy, including the frozen amountUsd, amountChf, amountEur, and amountPhp strings. The HTML public thread is /messages/[id].
  • Errors: Upstream 404 { error: "Not found" }, or 502 if the api is unreachable.
  • Used by: fetchPublicReplies.
  • Auth: Public.

Endpoint: GET /messages/compose-target

  • Purpose: Same-origin Bearer proxy of api GET /messages/compose-target. Returns { messageId, sats, firstPostFree }: the official platform profile note so a basis account can invoice 1 sat to 21.gifts before posting or replying, and whether this member's next top-level post is their free first post (no live or hidden top-level note of their own besides About me).
  • Errors: Upstream 401/409/400/503, or 502 if the api is unreachable.
  • Used by: fetchComposeTarget.
  • Auth: Bearer.
  • Purpose: Same-origin public proxy of api GET /links/:code. JSON body is { "kind": "message" | "member", "id": "<uuid>" }. No Bearer. The HTML redirect visitors open is /l/[code]; this path is JSON only.
  • Errors: Upstream 400 { "error": "invalid_code" }, 404 { "error": "not_found" }, 409 { "error": "ambiguous" }, or 502 if the api is unreachable.
  • Used by: fetchShortLink.
  • Auth: Public.

Endpoint: GET /l/[code]

  • Purpose: Resolve an 8-hex short code (case-insensitive) and redirect to /messages/<uuid> or /members/<uuid>. The code is the first UUID group, lowercased. Invalid codes do not call the api. There is no page under /l/ — unknown codes use the existing not-found page.
  • Errors: 404 via notFound() when the code is not 8 hex, the lookup fails or is not OK, the body is not JSON, or the body is not a message or member UUID. Success is a redirect, not JSON.
  • Used by: Shared note, reply, and member profile links copied from the forum and member card.
  • Auth: Public.

Endpoint: GET /messages/[id]/repayment

  • Purpose: Same-origin proxy of api GET /messages/:id/repayment. Public ledger of givers and each bitcoin repayment, including loan closedAt and each line's paidSats/paidAmount; a partially paid line remains due/scheduled and its dueSats is the remainder. A due line whose giver cannot receive yet carries waiting: true, and waitingShares counts those lines. The body is passed through unchanged.
  • Errors: Upstream 404/503, or 502 if the api is unreachable.
  • Used by: getRepayment.
  • Auth: Public.

Endpoint: POST /messages/[id]/repayment

  • Purpose: Same-origin Bearer proxy of api POST /messages/:id/repayment. Without a body (or with an empty body), the author pays the next giver their share of the next due day and receives { pr, amountSats, sparkInvoice? }. With JSON { amount }, it requests a freely chosen repayment amount in whole sats for BTC or at most two decimals in the loan currency and returns { amountSats, amount, bills, waiting } with the due endpoint's bill shapes. amountSats is the sum of bills only: waiting shares are allocated by the requested loan-currency amount but are not paid now, so an all-waiting answer has amountSats: 0 and an empty bills array. The first free-amount payment of a collecting loan also closes collecting in the api. The optional body is passed through unchanged.
  • Errors: The no-body form keeps its upstream 401/400/404/409/429/503 errors. The amount form can also return 400 amount_too_high, invalid_amount, too_many_shares, or Nothing is due; 403 SUNDAY_REST; 409 missing_requirements or an open share payment; 429/503; or 502 if the api is unreachable. Max errors carry maxSats and maxAmount.
  • Used by: prepayLoan through useLoanRepay.prepay, before the shared wallet send path. No screen uses the no-body single-share form because /loans/repay asks for every payable bill at once (POST /messages/[id]/repayment/due).
  • Auth: Bearer.

Endpoint: POST /messages/[id]/invoice

  • Purpose: Same-origin Bearer proxy of api POST /messages/:id/invoice (pay a forum note; optional text is the zap comment and is omitted when empty). Success { pr, amountSats, sparkInvoice? }; sparkInvoice is the request the in-app wallet pays instead of pr (it pays pr when the wallet refuses it, except for a heart, which is paid by the Spark invoice only), or null, and may be absent.
  • Errors: Upstream 401/400/404/409/429/503, or 502 if the api is unreachable. 409 missing_requirements is a setup overlay, not a pay-sheet error. A heart (heart: true) the api cannot issue as a fee-free Spark invoice is 503 { error: 'HEART_UNAVAILABLE' } with no pr; the proxy passes it through unchanged.
  • Used by: postMessageInvoice.
  • Auth: Bearer.

Endpoint: POST /lnurl/pay-request

  • Purpose: Same-origin Bearer proxy of api POST /lnurl/pay-request. Body { target } (user@domain or a bech32 LNURL on another host). 200 { target, minSendableMsat, maxSendableMsat, commentAllowed, description, domain }.
  • Errors: Upstream 400 Not a payable address (malformed, not https, not a pay request, or on this app's own host), 404 Address not found, 502 Address could not be reached, 401 without a session; 502 Upstream api unreachable when the api is unreachable.
  • Used by: postLnurlPayRequest.
  • Auth: Bearer.

Endpoint: GET /me/loans

  • Purpose: Same-origin proxy of api GET /me/loans, listing the signed-in member's loans that are still collecting or being repaid plus the Sunday-rest flag. Each loan includes closedAt, current free-repayment maxSats, and fiat maxAmount; due.waitingShares counts the shares waiting for a lender's wallet, and lenderWaiting { shares, loans, sats } counts repayments owed to the caller while the caller cannot receive. For a fiat loan without a usable rate, the api leaves exactly the currently priced unpaid sat fields totalSats, due.payableSats, due.waitingSats, and next.sats null; their stored loan-currency amounts remain available. The body is passed through unchanged.
  • Errors: Upstream 401 or service errors, or 502 if the api is unreachable.
  • Used by: getMyLoans through useMyLoans for the loans card, the lender card, Menu row, and /loans/repay.
  • Auth: Bearer.

Endpoint: POST /messages/[id]/repayment/due

  • Purpose: Same-origin proxy of api POST /messages/:id/repayment/due. It returns every currently payable recipient bill for the author's funded loan, oldest first, plus waiting shares whose recipients cannot receive; one call is capped at 60 bills.
  • Errors: Upstream 401/400/404/409/429/503, or 502 if the api is unreachable.
  • Used by: postRepaymentDue through useLoanRepay before wallet preparation.
  • Auth: Bearer.

Endpoint: POST /messages/[id]/repayment/close

  • Purpose: Same-origin proxy of api POST /messages/:id/repayment/close. With no body, it permanently stops an ask from collecting and returns { fundedAt, closedAt, collectedSats, collectedAmount }; repayment remains available.
  • Errors: Upstream 401, 404, 409 missing_requirements, 429, or 503; 502 if the api is unreachable.
  • Used by: closeLoan through useLoanRepay.closeCollecting, followed by GET /me/loans.
  • Auth: Bearer.

Endpoint: POST /lnurl/invoice

  • Purpose: Same-origin Bearer proxy of api POST /lnurl/invoice. Body { target, amountMsat, comment? }. The api resolves the target again, never takes a callback URL from the client, and checks amount, comment, invoice amount, and description hash. 200 { pr }.
  • Errors: The errors of POST /lnurl/pay-request, plus 400 Amount out of range and 400 Comment too long.
  • Used by: postLnurlInvoice.
  • Auth: Bearer.

Endpoint: POST /contact/submit

  • Purpose: Same-origin Bearer proxy of api POST /contact (create an in-app contact message to 21.gifts). Nested under /contact/submit because the UI page already owns /contact.
  • Errors: Upstream 401/400, or 502 if the api is unreachable.
  • Used by: postContact.
  • Auth: Bearer.

Endpoint: GET /messages/[id]/photo

  • Purpose: Same-origin proxy of api GET /messages/:id/photo (raw JPEG/PNG/WebP bytes for one forum message). The extensionless route stays for fetchMessagePhoto and fetchPublicMessagePhoto (inbox, deleted staff row, shop-editor fallback, profile picture). Public forum stills use <img src> /messages/{id}/photo.jpg without Authorization.
  • Errors: Upstream 401/404, or 502 if the api is unreachable.
  • Used by: fetchMessagePhoto, fetchPublicMessagePhoto.
  • Auth: Optional Bearer.

Endpoint: GET /messages/[id]/photo.jpg

  • Purpose: Same-origin proxy of the api file of that extension. Authorization is removed before the upstream call so the edge can store the public still; cache-control is copied from the api.
  • Errors: Upstream 404, or 502 when the api is unreachable.
  • Used by: forumPhotoSrc.
  • Auth: None.

Endpoint: GET /messages/[id]/photo/[file]

  • Purpose: Same-origin proxy of api extra stills at GET /messages/:id/photo/{1-9}.jpg. App Router file must match {1-9}.jpg; other names 404 without proxying.
  • Errors: Route 404 for unknown file; upstream 404/502 when the extra still is missing or unreachable.
  • Used by: fetchMessagePhoto / fetchPublicMessagePhoto with index 1–9, and forumPhotoSrc, which builds /messages/{id}/photo/{n}.jpg for index >= 1. ForumBoard and PublicMessageLoader attach public extra stills through that path.
  • Auth: Optional Bearer.

Endpoint: GET /messages/[id]/[file]

  • Purpose: App Router GET that proxies video.mp4 / video.webm / video.mov to the 21.gifts api at runtime via getApiUrl() (not next.config rewrites). Other file values return 404 without proxying. Public; missing files 404 from the api.
  • Errors: Route 404 for unknown file; upstream 404/502 for known video names when missing or unreachable.
  • Used by: Feed <video src> via forumVideoSrc.
  • Auth: None required.

Endpoint: GET /push/vapid-public

  • Purpose: Same-origin Bearer proxy of api GET /push/vapid-public (VAPID application server public key for Web Push subscribe).
  • Errors: Upstream 401, 503 { error: "Push is not configured" }, or 502 if the api is unreachable.
  • Used by: fetchVapidPublicKey via enablePush on /settings, via enablePush from the SignedInChrome Notifications click, and via resyncPushSubscription in SignedInChrome.
  • Auth: Bearer.

Endpoint: POST /me/push-subscriptions

  • Purpose: Same-origin Bearer proxy of api POST /me/push-subscriptions (register a browser push subscription: { endpoint, keys: { p256dh, auth } }).
  • Errors: Upstream 400 { error: "Invalid subscription" }, 401, 503 { error: "Push is not configured" }, or 502 if the api is unreachable.
  • Used by: postPushSubscription via enablePush on /settings, via enablePush from the SignedInChrome Notifications click, and via resyncPushSubscription in SignedInChrome.
  • Auth: Bearer.

Endpoint: GET /conversations

  • Purpose: Same-origin Bearer proxy of api GET /conversations (incoming threads, plus the member's own 21.gifts contact thread when it has a message; empty and outbound-only member/Damus threads are omitted). GET /conversations never lists the moderator_group thread, even for moderators. Each item has required kind: member_member | member_platform | member_damus | moderator_group, required lastFromMe, required lastSats, unread (default false), unreadMessageCount (default 0, inbound unread messages), optional accountId (counterpart), and the envelope includes unreadCount (default 0, unread thread count).
  • Errors: Upstream 401/503, or 502 if the api is unreachable.
  • Used by: fetchConversations on /messages, useUnreadCount, NotificationsLoader, refreshUnreadAppBadge.
  • Auth: Bearer.

Endpoint: GET /conversations/moderator-group

  • Purpose: Same-origin Bearer proxy of api GET /conversations/moderator-group (singleton closed staff room as { conversation }, same item fields as GET /conversations including unread and unreadMessageCount).
  • Errors: Upstream 401/403/404, or 502 if the api is unreachable.
  • Used by: fetchModeratorGroup via ModeratorGroupScreen on /moderate/group and via InboxLoader on /messages (unlisted ?c= guard for a moderator).
  • Auth: Bearer; moderator on the api.

Endpoint: POST /conversations

  • Purpose: Same-origin Bearer proxy of api POST /conversations with { forumMessageId } to open or return the thread with that note's author. Response is the same conversation list-row shape, including required kind, required lastFromMe, and optional accountId (counterpart).
  • Errors: Upstream 400 (self), 404 (unknown note), 401/503, or 502 if the api is unreachable.
  • Used by: openConversation from the member-profile Message button.
  • Auth: Bearer.

Endpoint: GET /conversations/[id]

  • Purpose: Same-origin Bearer proxy of api GET /conversations/:id?limit=&cursor=. The client always sends limit=20; optional cursor requests the next older page and optional sinceMessageId long-polls. Body { messages, nextCursor? } (oldest-first within the page). Each message has required fromMe (true iff this session is the actor) and sats, hasPhoto / photoCount (client defaults omitted fields to false / 0), and optional accountId (sender). For a staff viewer, incoming name and optional accountId are the actor. Members still see platform identity (21.gifts) on official replies. Optional query sinceMessageId is forwarded for gift pay-sheet polling.
  • Errors: Upstream 401/404/503, or 502 if the api is unreachable.
  • Used by: fetchConversation on /messages?c= and on /moderate/group.
  • Auth: Bearer.

Endpoint: POST /conversations/[id]

  • Purpose: Same-origin Bearer proxy of api POST /conversations/:id with { text } (1–8000 characters) and optional { photo, photos } (JPEG/PNG/WebP, at most 10). Empty text is allowed when at least one photo is present (Moderators group and /messages Direct/Contact/Damus). Staff replies on official threads still send as the platform account on the api, but JSON fromMe, name, and accountId follow the actor. The created message has required fromMe, hasPhoto, photoCount, and optional accountId (sender).
  • Errors: Upstream 400/401/404/503, or 502 if the api is unreachable.
  • Used by: postConversationMessage in the inbox composer and in ModeratorGroupScreen.
  • Auth: Bearer.

Endpoint: GET /conversations/[id]/messages/[messageId]/photo

  • Purpose: Same-origin Bearer proxy of api GET /conversations/:id/messages/:messageId/photo (still 0). Conversation stills (inbox Direct/Contact/Damus and the staff room) are private; 401 without a session.
  • Errors: Upstream 401/404/503, or 502 if the api is unreachable.
  • Used by: fetchConversationMessagePhoto from InboxLoader and ModeratorGroupScreen.
  • Auth: Bearer.

Endpoint: GET /conversations/[id]/messages/[messageId]/photo/[file]

  • Purpose: Same-origin Bearer proxy of api GET /conversations/:id/messages/:messageId/photo/:file. Filename must match {1-9}.{jpg|jpeg|png|webp}; otherwise 404 without calling the api. The proxy always requests {n}.jpg from the api.
  • Errors: 404 for an unsupported filename; upstream 401/404/503, or 502 if the api is unreachable.
  • Used by: fetchConversationMessagePhoto for indices 1–9 from InboxLoader and ModeratorGroupScreen.
  • Auth: Bearer.

Endpoint: POST /conversations/[id]/invoice

  • Purpose: Same-origin Bearer proxy of api POST /conversations/:id/invoice with { sats, text? }. Success { pr, amountSats, messageId, sparkInvoice? } for the inbox pay sheet; sparkInvoice is the request the in-app wallet pays instead of pr (it pays pr when the wallet refuses it), or null, and may be absent.
  • Errors: Upstream 400/401/404/429/503, or 502 if the api is unreachable.
  • Used by: postConversationInvoice in the inbox composer.
  • Auth: Bearer.

Endpoint: POST /conversations/[id]/read

  • Purpose: Same-origin Bearer proxy of api POST /conversations/:id/read (mark one conversation read).
  • Errors: Upstream 401/404/503, or 502 if the api is unreachable.
  • Used by: markConversationRead from InboxLoader after a successful thread fetch.
  • Auth: Bearer.

Endpoint: GET /forum/mentions

  • Purpose: Same-origin Bearer proxy of api GET /mentions. Optional q is the username prefix. An empty query is the first page of handles. The forum composer uses it while @ is being typed. The Person field on /grants/payments/amounts uses the same search and opens that first page when the field is exactly @.
  • Errors: Upstream 401/400/409, or 502 if the api is unreachable.
  • Used by: searchMentionAccounts from MentionTextarea on the post, reply, ask-for-money, shop, inbox, and moderator-room composers, from ShopAccountControl, and from DailyPaymentAmountsScreen for the Person field on /grants/payments/amounts.
  • Auth: Bearer.

Endpoint: GET /forum/accounts/by-username/[username]

  • Purpose: Same-origin Bearer proxy of api GET /accounts/by-username/:username. Exact account lookup by username. The stored spelling is returned; the client does not compare the name again.
  • Errors: Upstream 401/400/404/409, or 502 if the api is unreachable.
  • Used by: lookupAccountByUsername from ShopAddWizard, ShopAccountControl, and ForumLoader.
  • Auth: Bearer.

Endpoint: GET /forum/notifications

  • Purpose: Same-origin Bearer proxy of api GET /notifications (posts, replies, payments, moderator appointment, and moderator proposal for the session). App path is /forum/notifications so HTML /notifications can serve the page.
  • Errors: Upstream 401/503, or 502 if the api is unreachable.
  • Used by: fetchNotifications via NotificationsLoader on /notifications, via useUnreadCount in SignedInChrome, via ForumLoader on /welcome, and via refreshUnreadAppBadge (from InboxLoader after mark-read).
  • Auth: Bearer.

Endpoint: POST /forum/notifications/read-all

  • Purpose: Same-origin Bearer proxy of api POST /notifications/read-all (mark every notification read). Optional JSON { endpoint } when this browser has a push subscription; endpoint only when the current push endpoint is a non-empty string.
  • Errors: Upstream 401/503, or 502 if the api is unreachable.
  • Used by: markAllNotificationsRead from NotificationsLoader.
  • Auth: Bearer.

Endpoint: POST /forum/notifications/read-by-message

  • Purpose: Same-origin Bearer proxy of api POST /notifications/read-by-message (mark notifications for one forum message read). JSON { messageId, endpoint? }; endpoint only when the current push endpoint is a non-empty string.
  • Errors: Upstream 401/503, or 502 if the api is unreachable.
  • Used by: markNotificationsReadForMessage from ForumLoader (note becomes expanded), NoteTranslate (Translate requested with a session), PublicMessageLoader (signed-in message page ready), MemberProfileScreen (profile note becomes expanded), and PublicMessageThread (thread note becomes expanded).
  • Auth: Bearer.

Endpoint: POST /forum/notifications/read-visible

  • Purpose: Same-origin Bearer proxy of api POST /notifications/read-visible, which stamps only forum_post, forum_reply, and forum_mention whose reply id is that message. JSON { messageId, endpoint? }; endpoint only when the current push endpoint is a non-empty string.
  • Errors: Upstream 401/503, or 502 if the api is unreachable.
  • Used by: markVisibleForumNoteRead from ForumLoader when the note card is fully inside the scrollport.
  • Auth: Bearer.

Endpoint: POST /forum/notifications/[id]/read

  • Purpose: Same-origin Bearer proxy of api POST /notifications/:id/read (mark one notification read). Optional JSON { endpoint } when this browser has a push subscription; endpoint only when the current push endpoint is a non-empty string.
  • Errors: Upstream 401/404/503, or 502 if the api is unreachable.
  • Used by: markNotificationRead from NotificationsLoader on row click and from ForumLoader on the welcome appointment pill.
  • Auth: Bearer.

Endpoint: DELETE /me/push-subscriptions

  • Purpose: Same-origin Bearer proxy of api DELETE /me/push-subscriptions (remove a browser push subscription by { endpoint }).
  • Errors: Upstream 400, 401, 404, 503 { error: "Push is not configured" }, or 502 if the api is unreachable.
  • Used by: deletePushSubscription via disablePush on /settings and on /profile, from LogoutButton (Menu and the Settings Account section), and via resyncPushSubscription in SignedInChrome for the old endpoint after a VAPID key change.
  • Auth: Bearer.

Endpoint: GET /trust/graph

  • Purpose: Same-origin Bearer proxy of api GET /trust-chain (nodes and stored edges). Lives at /trust/graph so it does not collide with the signed-in HTML page /trust-chain.
  • Errors: Upstream 401, 403, 503, or 502 if the api is unreachable.
  • Used by: fetchTrustChain on signed-in /trust-chain (forwards ?around=).
  • Auth: Bearer.

Endpoint: GET /trust/proposals

  • Purpose: Same-origin Bearer proxy of api GET /trust/proposals (open moderator proposals for moderators). Lives under /trust/proposals because Next.js forbids a route.ts beside the HTML page at /moderate/proposals.
  • Errors: Upstream 401 without a Bearer session, 403 when the account is not a moderator, 503 when the api is unavailable, or 502 JSON if this proxy cannot reach the api origin.
  • Used by: fetchTrustProposals via ProposalsScreen on /moderate/proposals and via useUnreadCount (signed-in Menu and ModerateScreen Open-proposals count). Confirm uses existing POST /trust/confirm-moderator (postTrustConfirm), not appoint.
  • Auth: Bearer session; the api requires a moderator. The app does not fetch this list for other signed-in roles (forbidden copy, no request).

Endpoint: POST /trust/verify

  • Purpose: Same-origin Bearer proxy of api POST /trust/verify with { accountId, confirmedName }. The proxy forwards the JSON body unchanged.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable.
  • Used by: postTrustVerify in MemberVerifyScreen.
  • Auth: Bearer (moderator).

Endpoint: POST /trust/propose-moderator

  • Purpose: Same-origin Bearer proxy of api POST /trust/propose-moderator with { accountId }.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable.
  • Used by: postTrustPropose in MemberTrustActions.
  • Auth: Bearer (moderator).

Endpoint: POST /trust/confirm-moderator

  • Purpose: Same-origin Bearer proxy of api POST /trust/confirm-moderator with { accountId }.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable.
  • Used by: postTrustConfirm in MemberTrustActions and ProposalsScreen.
  • Auth: Bearer (moderator, not the proposer).

Endpoint: POST /trust/reject-moderator

  • Purpose: Same-origin Bearer proxy of api POST /trust/reject-moderator with { accountId }.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable.
  • Used by: postTrustReject in ProposalsScreen.
  • Auth: Bearer (moderator; the original proposer may reject).

Endpoint: POST /trust/appoint-moderator

  • Purpose: Same-origin Bearer proxy of api POST /trust/appoint-moderator with { accountId }.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable.
  • Used by: postTrustAppoint in MemberTrustActions.
  • Auth: Bearer (founder).

Endpoint: POST /funding/apply

  • Purpose: Same-origin Bearer proxy of api POST /funding/apply. Applications are open to every verified member. Role basis is 403 Forbidden and does not write a grant.
  • Errors: Upstream 400/401/403/409/503, matching postFundingApply, or 502 if the api is unreachable.
  • Used by: postFundingApply. FundingApplyScreen calls it after Yes on the truth question for a verified account with status none or rejected. A basis account does not call it.
  • Auth: Bearer session; the api requires a role other than basis.

Endpoint: POST /funding/withdraw

  • Purpose: Same-origin Bearer proxy of api POST /funding/withdraw. The caller withdraws their own grant: an open application, a one-day trial, or an admitted place. No body. 200 { funding } with status none.
  • Errors: Upstream 401/403/409/503 unchanged (409: nothing to withdraw, or a staff decision at the same moment), 404 while the api does not have the endpoint yet, or 502 if the api is unreachable.
  • Used by: postFundingWithdraw. FundingWithdrawControl calls it after the member confirms Withdraw my application or Leave the grant on /grants.
  • Auth: Bearer session; the api refuses basis with 403.

Endpoint: GET /funding/payout-days

  • Purpose: Same-origin Bearer proxy of api GET /funding/payout-days (seven-day grant payout matrix for moderators). Lives under /funding/payout-days because Next.js forbids a route.ts beside the HTML page at /moderate/payouts.
  • Errors: Upstream 401 without a Bearer session, 403 when the account is below moderator, 503 when the api is unavailable, or 502 JSON if this proxy cannot reach the api origin.
  • Used by: fetchFundingPayoutDays via FundingPayoutsScreen on /moderate/payouts.
  • Auth: Bearer session; the api requires at least moderator. The app does not fetch this list for other signed-in roles (forbidden copy, no request).

Endpoint: GET /shops/activity/shops

  • Purpose: Same-origin Bearer proxy of api GET /shops/activity/shops (per-shop POS activity for staff: windowDays, today, and one row per shop with noteId, name, npub, accountId, username, activeDays, lastChargeDay, never used first, then oldest last charge first). The HTML table lives at /moderate/shops.
  • Errors: Upstream 401 without a Bearer session, 403 when the account is not staff, 503 when the api is unavailable, or 502 JSON if this proxy cannot reach the api origin.
  • Used by: fetchShopActivityShops via ShopActivityShopsScreen on /moderate/shops.
  • Auth: Bearer session; the api requires staff. The app does not fetch this list for signed-in roles below moderator (forbidden copy, no request).

Endpoint: GET /funding/applications

  • Purpose: Same-origin Bearer proxy of api GET /funding/applications (open grant applications for moderators). Lives under /funding/applications because Next.js forbids a route.ts beside the HTML page at /grants/applications (/moderate/applications redirects there).
  • Errors: Upstream 401 without a Bearer session, 403 when the account is below moderator, 503 when the api is unavailable, or 502 JSON if this proxy cannot reach the api origin.
  • Used by: fetchFundingApplications via FundingApplicationsScreen on /grants/applications. ModerateScreen on /moderate does not call this GET.
  • Auth: Bearer session; the api requires at least moderator. The app does not fetch this list for other signed-in roles (forbidden copy, no request).

Endpoint: GET /funding/daily-roster

  • Purpose: Same-origin Bearer proxy of api GET /funding/daily-roster (daily payout comment, payments switch, defaultAmountUsd, recipient rows, moderator payments switch, and moderator rows). Lives under /funding/daily-roster because Next.js forbids a route.ts beside the HTML pages at /grants/payments/comment, /grants/payments/amounts, and /grants/payments/moderators.
  • Errors: Upstream 401 without a Bearer session, 403 when the account is below initiator, 503 when the api is unavailable, or 502 JSON if this proxy cannot reach the api origin.
  • Used by: fetchDailyRoster via DailyPaymentCommentScreen on /grants/payments/comment, DailyPaymentAmountsScreen on /grants/payments/amounts, and DailyPaymentModeratorsScreen on /grants/payments/moderators.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum. The app does not fetch this roster for other signed-in roles (forbidden copy, no request).

Endpoint: POST /funding/daily-roster/comment

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/comment with { comment }.
  • Errors: Upstream 400 Invalid comment, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: saveDailyRosterComment in DailyPaymentCommentScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/payments

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/payments with { enabled } (boolean). Sets the daily payments switch only.
  • Errors: Upstream 400 Invalid payments switch, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: saveDailyRosterPayments in DailyPaymentAmountsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/recipients

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/recipients with { accountId, amountUsd }. Appends one daily recipient for that person.
  • Errors: Upstream 400 Invalid person or amount, Unknown person, Person has no Lightning address, or Address already listed, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: addDailyRosterRecipient in DailyPaymentAmountsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/recipients/update

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/recipients/update with { address, amountUsd }. Changes one daily amount.
  • Errors: Upstream 400 Unknown address or Invalid address or amount, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: updateDailyRosterRecipient in DailyPaymentAmountsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/recipients/delete

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/recipients/delete with { address }. Removes one daily recipient.
  • Errors: Upstream 400 Unknown address, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: deleteDailyRosterRecipient in DailyPaymentAmountsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/moderators

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/moderators with { accountId, amountUsd }. Appends one moderator stipend for that person.
  • Errors: Upstream 400 Invalid person or amount, Unknown person, Person has no Lightning address, or Address already listed, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: addDailyRosterModerator in DailyPaymentModeratorsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/moderators/update

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/moderators/update with { address, amountUsd }. Changes one moderator stipend.
  • Errors: Upstream 400 Unknown address or Invalid address or amount, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: updateDailyRosterModerator in DailyPaymentModeratorsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/moderators/delete

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/moderators/delete with { address }. Removes one moderator.
  • Errors: Upstream 400 Unknown address, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: deleteDailyRosterModerator in DailyPaymentModeratorsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: POST /funding/daily-roster/moderators/payments

  • Purpose: Same-origin Bearer proxy of api POST /funding/daily-roster/moderators/payments with { enabled } (boolean). Sets the moderator payments switch only.
  • Errors: Upstream 400 Invalid payments switch, 401, 403, 503, or 502 if the api is unreachable.
  • Used by: saveDailyRosterModeratorPayments in DailyPaymentModeratorsScreen.
  • Auth: Bearer session. The api allows at least initiator (initiator and founder) only; fond and software_developer are below that minimum.

Endpoint: GET /funding/applications/[accountId]

  • Purpose: Same-origin Bearer proxy of api GET /funding/applications/:accountId (staff review payload: account, grant, living-room posts).
  • Errors: Upstream 401/403/404/503, or 502 if the api is unreachable.
  • Used by: fetchFundingApplication via FundingApplicationDetailScreen on /grants/applications/[accountId].
  • Auth: Bearer session; the api requires at least moderator.

Endpoint: POST /funding/trial

  • Purpose: Same-origin Bearer proxy of api POST /funding/trial with { accountId }. Target must be effective pending.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable.
  • Used by: proxyFundingTrialPost (API still exposes trial; the staff UI no longer calls it).
  • Auth: Bearer (at least moderator).

Endpoint: POST /funding/admit

  • Purpose: Same-origin Bearer proxy of api POST /funding/admit with { accountId }. Target pending or trial.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable. A 409 { error: 'All grant places are taken' } means the round has no free place; postFundingAdmit throws FUNDING_PLACES_FULL_ERROR for it.
  • Used by: postFundingAdmit in FundingApplicationDetailScreen.
  • Auth: Bearer (at least moderator).

Endpoint: POST /funding/reject

  • Purpose: Same-origin Bearer proxy of api POST /funding/reject with { accountId }. The subject may re-apply.
  • Errors: Upstream 400/401/403/404/409/503, or 502 if the api is unreachable.
  • Used by: postFundingReject in FundingApplicationDetailScreen.
  • Auth: Bearer (at least moderator).

Endpoint: GET /forum/messages/[id]

  • Purpose: Same-origin Bearer proxy of api GET /messages/:id. App path is /forum/messages/[id] so HTML /messages/[id] can stay the page. Staff (at least moderator) receive a soft-hidden row with deletedAt / deletedBy; unsigned/non-staff hidden ids stay 404.
  • Errors: Upstream 401/403/404, or 502 if the api is unreachable.
  • Used by: fetchForumMessage via PublicMessageLoader on /messages/[id].
  • Auth: Bearer; staff hide-stamps only when the api role is at least moderator.

Endpoint: DELETE /forum/messages/[id]

  • Purpose: Same-origin moderation proxy to DELETE /messages/:id.
  • Auth: Forwards Bearer authorization; the API requires live moderator role.
  • Returns: Upstream 204, 401, 403, 404 or 503; proxy failures return 502.
  • Side effects: Deletes the post, direct replies and stored media on 21.gifts. Does not refund gifts or erase external Nostr relay copies.

Endpoint: PATCH /forum/messages/[id]/place

  • Purpose: Same-origin moderation proxy to PATCH /messages/:id/place with JSON { place } (a pin, or null to clear).
  • Auth: Forwards Bearer authorization; the API requires live moderator role.
  • Returns: Upstream 200 public message JSON, with place omitted when cleared.
  • Errors: 401/403/404/400/503 with { "error": string }; unreachable api is 502.

Endpoint: PATCH /forum/messages/[id]/photos

  • Purpose: Same-origin moderation proxy to PATCH /messages/:id/photos with JSON { photos }. An empty list clears stills. A video on the note stays, and this write does not add an edit-history row.
  • Auth: Forwards Bearer authorization; the API requires live moderator role.
  • Returns: Upstream 200 public message JSON.
  • Errors: 401/403/404/400/503 with { "error": string }; unreachable api is 502. Sunday in the device zone is refused by the API.

Endpoint: PATCH /forum/messages/[id]/text

  • Purpose: Same-origin moderation proxy to PATCH /messages/:id/text with JSON { text }. The API keeps #21GiftsShop on the stored body and records the change.
  • Auth: Forwards Bearer authorization; the API requires live moderator role.
  • Returns: Upstream 200 public message JSON.
  • Errors: 401/403/404/400/503 with { "error": string }; unreachable api is 502. Sunday in the device zone is refused by the API.

Endpoint: GET /forum/messages/[id]/edits

  • Purpose: Same-origin moderation proxy to GET /messages/:id/edits. Returns who changed the shop note text, place, or account, and when.
  • Auth: Forwards Bearer authorization; the API requires live moderator role.
  • Returns: Upstream 200 { edits } newest first. An empty list is { edits: [] }.
  • Errors: 401/403/404/503 with { "error": string }; unreachable api is 502. This read is not a Sunday write.

Endpoint: PATCH /forum/messages/[id]/shop-account

  • Purpose: Same-origin moderation proxy to PATCH /messages/:id/shop-account with JSON { username } (a handle, or null to clear).
  • Auth: Forwards Bearer authorization; the API requires live moderator role.
  • Returns: Upstream 200 public message JSON, with shopAccount omitted when cleared; otherwise { id, username, name }.
  • Errors: 404 { "error": "No account with that username" } when the handle is unknown; other failures match the place patch (401/403/400/503, or 502 when unreachable).

Endpoint: GET /translate

  • Purpose: Same-origin proxy of api GET /translate. { available: boolean } is true when the api has TRANSLATE_URL and TRANSLATE_API_KEY. Always 200 from the api.
  • Errors: 502 when the api is unreachable.
  • Used by: fetchTranslateAvailable in NoteTranslate.
  • Auth: Public.

Endpoint: POST /translate

  • Purpose: Same-origin proxy of api POST /messages/:id/translate. Body { messageId, target }. The api looks up message_translation before DeepL and returns { translatedText, cached }.
  • Errors: 400 invalid body, 404 unknown/hidden note, 503 not configured, 502 upstream.
  • Used by: translateNote from NoteTranslate.
  • Auth: Public for a live note (Bearer forwarded for a hidden staff permalink).

Endpoint: POST /conversations/[id]/messages/[messageId]/translate

  • Purpose: Same-origin proxy of api POST /conversations/:id/messages/:messageId/translate. Body { target }. The api translates the stored conversation message and returns { translatedText, cached }.
  • Errors: 400 invalid body, 401 without a session, 404 when the thread or message is missing, 503 not configured, 502 upstream.
  • Used by: translateConversationMessage from NoteTranslate on inbox and moderator-room prose.
  • Auth: Forwards Bearer authorization. The api requires a participant session.

Endpoint: GET /fond/payouts

  • Purpose: Same-origin Bearer proxy of api GET /fond/payouts. Lists today's open Fond payout rows (id, kind, status, utcDay, paymentHash) in the api's order; it carries no amounts. paymentHash is a string or null and may be absent from an older api.
  • Auth: Bearer session of the account named FOND_USERNAME. The api answers 403 Fond only for another session and 404 when its Fond surface is off.
  • Returns: Upstream 200 { payouts: [{ id, kind, status, utcDay, paymentHash }] }, where paymentHash is a string or null and may be absent from an older api.
  • Errors: Upstream 401 without a Bearer session, 403 for another account, 404 when the surface is off, 503 when the queue is unavailable, or 502 when this proxy cannot reach the api.
  • Used by: fetchFondPayouts through runFondPayoutTick; the route is also covered by the e2e proxy spec.

Endpoint: POST /fond/payouts/[id]/invoice

  • Purpose: Same-origin Bearer proxy of api POST /fond/payouts/:id/invoice. The api converts the row's stored USD amount at the current spot and returns { id, bolt11, paymentHash, sparkInvoice }; the app pays sparkInvoice, or bolt11 without one or after the wallet refused it at prepare, once and sends no proof.
  • Auth: Bearer session of the Fond account. The api answers 403 Fond only for another session.
  • Returns: Upstream 200 { id, bolt11, paymentHash, sparkInvoice }, with sparkInvoice a string or null. After the payment, the api detects the send by payment hash, BOLT11, or Spark invoice string and settles the row itself.
  • Errors: Upstream 404 for an unknown or malformed id, 409 in progress / not payable / amount below one sat, 401, 403, 503, or 502 when unreachable.

Endpoint: PUT /fond/deposit-address

  • Purpose: Same-origin Bearer proxy of api PUT /fond/deposit-address. Body { address }: the Fond wallet's static Bitcoin deposit address, read from the wallet SDK in the Fond member's signed-in app. The api stores it idempotently and returns it as onchainAddress in GET /fond/summary.
  • Auth: Bearer session of the Fond account. The api answers 403 for another session and 404 when its Fond surface is off.
  • Returns: Upstream 200 { address }.
  • Errors: Upstream 400 for an invalid address, 401 without a Bearer session, 403 for another account, 404 when the surface is off, 503 when the api cannot store it now, or 502 when this proxy cannot reach the api.
  • Used by: putFondDepositAddress through registerFondDepositAddress in FondDepositSync.

Endpoint: GET /fonds/[username]/summary

  • Purpose: Same-origin public proxy of api GET /fond/summary for the Fond page. The 200 body is { username, receivedSats, paidOutSats, feesSats, balanceSats, balanceSyncedAt, payoutsPaid, payoutsPaidUsd, onchainAddress }; balanceSats and balanceSyncedAt may be null, and payoutsPaidUsd is the stored two-decimal figure. onchainAddress is the Fond wallet's registered deposit address or null; an api that does not send it yet reads as null. The route answers 404 when the body's username is not the path handle, and answers a malformed 200 body with 502.
  • Auth: Public, no session.
  • Returns: Upstream 200 with Cache-Control: no-store, or the route's own 404 { error: "Not found" }.
  • Errors: Upstream 404 when the api runs without the Fond, 503 { error } on failure, 502 when the api is unreachable or its 200 body is invalid, or the route's 404 for another handle.
  • Used by: fetchFondSummary through FondSummaryLoader on /fonds/[username].
Endpoints — Handbook — 21.gifts