ReputationGrant records one deliberate movement of reputation. Where ordinary reputation is earned (posting, commenting, receiving reactions), a grant is given — by one user to another, or by your app to a user.
Grants are the primitive behind tipping, bounties, contest payouts, staff picks, “best answer” awards, and peer recognition. Sublay stays unopinionated about why a grant happens: the reason, the amounts, the eligibility rules, and the UI framing are all your app’s logic. Sublay moves the points correctly, keeps the per-space economies honest, records what happened, and notifies the recipient.
Grants belong to the reputation bundle — every project with reputation has them, with no separate opt-in. See Reputation and Bundles.
The two kinds of grant
sourceType is persisted rather than inferred from senderId, because senderId is also null on a transfer whose sender was later deleted.
Properties
Which bucket moves
A user’s reputation lives in buckets — one per space, plus a project-general bucket. A grant always concerns exactly one bucket on each side, and the sender chooses which of their buckets pays:- The reputation lands in the recipient’s bucket for the same space it came from. Senders never choose where it lands.
- The general bucket is its own lane. Reputation cannot move between the general bucket and a space bucket in either direction.
- Consequently, the total reputation held within a given space is unchanged by a transfer — it only changes hands.
spaceId is rejected with 404 reputation-grant/space-not-found (on a transfer, so is a space whose content the sender can’t read), and naming a space on a project without the spaces bundle with 403 database/tables-not-available. Without that check a grant could fund a bucket for a space that does not exist: its score would still count toward its owner’s profile total while being invisible in every space-scoped view.
A transfer is rejected unless the source bucket holds at least the amount, evaluated at the moment of the transfer. A mint has no source, so it may drive a bucket below zero (buckets have no floor — downvotes can already take one negative).
The target is an annotation
A grant may point at one entity, comment, or chat message, so your app can render it in place — “this answer earned 120 points from 4 people”.- The target must exist when the grant is issued; a grant naming a missing record is rejected.
- The target does not have to be authored by the recipient.
- The target doesn’t choose the bucket —
spaceIddoes — but the two must agree. A grant that names a target counts toward that target’s space or toward general reputation, never toward another space: itsspaceIdis the target’s space (an entity’s space; a comment’s entity’s space; a message’s space chat’s space), or omitted for the general bucket. A target in no space — an entity outside any space, a message in a group chat or DM — takes only a grant with nospaceId. Anything else is rejected with400 reputation-grant/space-mismatch, on transfers and mints alike. A grant with aspaceIdand no target has nothing to compare and is allowed. - A target kind is only usable when the project has that capability. A
messagetarget needs thechatbundle;entityandcommenttargets need their tables. Grants with no target are always available. - Deleting the target does not reverse the grant. The points stay with the recipient; the attachment simply stops rendering. The exception is deleting the space the grant was made in: then the space’s buckets, and the points the grant moved into them, are removed.
GrantSummary
Reading entities, comments, or chat messages with thegrants include attaches a per-item summary rather than a full list:
The summary covers positive grants only, and only the grants the viewer could list (see Grants follow space reading), so it always matches the list. When the token is requested on a project whose schema has no grants table, the server returns a zero-filled summary (
{ total: 0, count: 0, viewerTotal: 0 }) rather than omitting the key — so grants being undefined always means “nobody asked”, never “this project has no grants”.
The full per-item list of individual grants comes from Fetch Many Reputation Grants, not from the summary.
Grants on chat messages are private
A grant row carries itstargetType, targetId and the granter’s free-text note, and a list read can hydrate both parties. On a message target those facts describe a private conversation — who is talking to whom, and what one of them said about it — so such a grant is exactly as private as the message it points at:
- The target shape is gated on membership. Listing grants by
targetType: "message"+targetIdreturns rows only to a member of that message’s conversation. The test is the one Fetch Message itself applies — any membership row counts, so a member who has since left the conversation still sees the grants on a message chat still hands them. In a space chat, only an active member of the chat’s space who can see it passes. Everyone else — a user who was never a member, any user on a project without thechatbundle — gets a successful empty page with the zero summary, never a403, so the response cannot be used to prove the message exists. A service key passes only as the user it names inactingUserId, exactly as that user’s token; naming nobody, it gets the empty page. - The user-keyed shapes carry the same test into the query. Listing by
recipientIdorsenderIdreturns a grant on a chat message to a caller who can see the underlying message and withholds it from one who cannot. So a user’s own “reputation I received” feed does include the grants made on messages in their own conversations, and reconciles with the reputation on their profile; a caller outside the conversation loses those rows from the page and fromtotalItemstogether, leaving nothing to infer arithmetically. A service key is filtered as the user it names inactingUserId; naming nobody, it gets no grants on chat messages at all, like a signed-in user in no conversation. - A removed message takes its grants with it. Once moderation removes a message, chat shows it as a placeholder to everyone but its author, and its grants are invisible on both of these shapes too — to a member of the conversation as much as to a stranger, to the grant’s own sender and recipient, and to a service key.
403 chat/not-a-member before they read a message, and a removed message’s grants summary is zero for everyone, its author included.
A removed entity takes its grants with it
A grant’s recipient is normally the author of what was rewarded, so listing the grants on an entity a moderator removed would name the author its placeholder hides. A removed entity’s grants therefore work like a removed message’s, for everyone — its author, the grant’s own sender and recipient, and a service key included:- Listing by
targetType: "entity"+targetIdanswers an empty page with the zero summary, and therecipientIdandsenderIdshapes leave those grants out of the page andtotalItemstogether. - The
grantssummary on the removed entity is{ total: 0, count: 0, viewerTotal: 0 }. - Creating a grant on it answers
404 reputation-grant/target-not-found.
Grants follow space reading
A grant tied to a space, or given on an entity or comment in a space, says something about that space, so grants follow the space’s reading rules:- Creating a transfer into a space whose content the sender can’t read answers
404 reputation-grant/space-not-found, and one on an entity or comment the sender can’t read404 reputation-grant/target-not-found— both exactly like a missing space or target. A comment goes by its entity’s space. Mints aren’t checked for reading: your app may grant into any space and on any target, as long as the grant’s space matches its target’s (see The target is an annotation). - Listing leaves out, on every shape, a grant whose own
spaceIdis in a space the viewer can’t read, and a grant on an entity or comment that sits in a space the viewer can’t read. The rows andtotalItemsmove together. A grant whosespaceIdnames a space that no longer exists — the space was deleted, or thespacesbundle uninstalled — is left out for everyone. Grants on deleted entities and comments, and on entities and comments in no space, are still listed. The reputation a left-out grant moved went with the space’s buckets when the space was deleted; after aspacesuninstall, totals don’t change. - Summaries — the target shape’s
summaryand thegrantsinclude on entities and comments — count exactly the grants the list would show. On an entity or comment in a space the viewer can’t read, the target shape answers the empty page with the zero summary.
Negative grants are private
A mint may be negative — a moderation clawback, a decay sweep, or a correction. Negative grants are deliberately invisible:- They never notify the recipient.
- They are never broadcast over the chat socket.
- They are excluded from the public list endpoint for every caller, including service keys.
- They are excluded from every
GrantSummary.
Immutability
Grant rows are append-only. There is no undo, revoke, cancel window, or editing of the note or metadata (apart from the sender’s account being deleted, below). To reverse a grant, issue a compensating negative mint — both records stand. Grant creation is not idempotent. A retried request creates a second grant and moves the points a second time, so clients are responsible for not double-submitting.Lifecycle
- Sender deleted — the grant record survives with
senderIdset tonull, so a target’s displayed total does not silently shrink. Itsnoteandmetadataare cleared (null): they’re what the sender wrote. - Recipient deleted — their grants are removed along with their reputation buckets, consistent with how reputation already behaves on user deletion.
- Target deleted — the grant stands; only the attachment stops rendering.
- Space deleted — the grant record stays, left out of listings; the reputation it moved is removed with the space’s buckets.
reputationbundle uninstalled — grant history is destroyed along with the buckets.

