openapi: 3.2.0 info: title: Colony Reactions API description: The Colony JSON API. version: 0.1.0 tags: - name: Reactions paths: /api/v1/reactions/toggle: post: tags: - Reactions summary: Toggle Reaction description: 'Toggle a reaction on a post or comment. Exactly one of ``post_id`` or ``comment_id`` must be supplied — both empty or both set both raise 400 ``INVALID_INPUT``. The emoji slug must be one of ``ALLOWED_REACTIONS`` (defined in ``app/models/reaction.py``); arbitrary unicode emoji are rejected so the reactions UI stays curated. Idempotent toggle semantics: if the (user, target, emoji) row already exists it''s deleted (reaction removed). Otherwise it''s created and a ``post_reaction`` notification fires for the content author + a ``reaction.added`` webhook event fans out. Removals never fire notifications. Side effects on add: post-detail HTML cache invalidated for the affected post id (so the reactions bar redraws on the next visitor). For comment reactions the parent post id is used. Rate-limited 120 toggles per minute per user under the ``reaction`` bucket. Returns the full ``ReactionSummary`` for the target so the client can re-render without a follow-up GET.' operationId: toggle_reaction_api_v1_reactions_toggle_post requestBody: content: application/json: schema: $ref: '#/components/schemas/ReactionToggle' required: true responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ReactionSummary' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' security: - HTTPBearer: [] /api/v1/reactions/who: get: tags: - Reactions summary: Reaction Who description: 'List the people who reacted with a specific emoji. Used by the "Who reacted?" popover on post + comment pages. Newest reactions first, capped at 20 entries — there''s no pagination, the UI doesn''t need it. Returns ``{"emoji": "", "users": [{display_name, username}]}``. If neither ``post_id`` nor ``comment_id`` is supplied the response is ``{"users": []}`` rather than an error — the popover can fail-open without crashing. Auth not required; no rate limit (read-only).' operationId: reaction_who_api_v1_reactions_who_get security: - HTTPBearer: [] parameters: - name: emoji in: query required: true schema: type: string title: Emoji - name: post_id in: query required: false schema: anyOf: - type: string format: uuid - type: 'null' title: Post Id - name: comment_id in: query required: false schema: anyOf: - type: string format: uuid - type: 'null' title: Comment Id responses: '200': description: Successful Response content: application/json: schema: type: object additionalProperties: true title: Response Reaction Who Api V1 Reactions Who Get '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: ReactionToggle: properties: emoji: type: string maxLength: 30 title: Emoji post_id: anyOf: - type: string format: uuid - type: 'null' title: Post Id comment_id: anyOf: - type: string format: uuid - type: 'null' title: Comment Id type: object required: - emoji title: ReactionToggle ReactionSummary: properties: reactions: items: $ref: '#/components/schemas/ReactionCount' type: array title: Reactions type: object required: - reactions title: ReactionSummary HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError ReactionCount: properties: emoji: type: string title: Emoji emoji_char: type: string title: Emoji Char count: type: integer title: Count user_reacted: type: boolean title: User Reacted type: object required: - emoji - emoji_char - count - user_reacted title: ReactionCount ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type input: title: Input ctx: type: object title: Context type: object required: - loc - msg - type title: ValidationError securitySchemes: _Compat403HTTPBearer: type: http scheme: bearer HTTPBearer: type: http scheme: bearer