Events API
All endpoints require authentication and events tool permissions.
List Events
Section titled “List Events”GET /api/eventsPermission: events:view
Query parameters:
| Param | Type | Description |
|---|---|---|
status | string | Filter by event status |
Response: { events } — each event includes proposed_by_name, proposed_by_avatar, vote_count, and user_voted (whether the current user has voted).
Events are sorted by vote count descending, then by creation date descending.
Create Event
Section titled “Create Event”POST /api/eventsPermission: events:update
Body:
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Event title |
description | string | No | Event description |
proposed_date | string | No | Proposed date (YYYY-MM-DD) |
location | string | No | Event location |
image_url | string | No | URL to event image |
Response: { event } (201)
Update Event
Section titled “Update Event”PUT /api/events/:idPermission: events:update
Only the proposer or users with manager+ access level can edit an event.
Body: Any of: title, description, status, proposed_date, confirmed_date, location, image_url.
Response: { event }
Delete Event
Section titled “Delete Event”DELETE /api/events/:idPermission: events:manage
Response: { ok: true }
Vote on Event
Section titled “Vote on Event”POST /api/events/:id/votePermission: events:view
Toggles the current user’s vote. If already voted, the vote is removed.
Response: { vote_count, user_voted }
Upload Event Image
Section titled “Upload Event Image”POST /api/events/upload-imagePermission: events:update
Body: multipart/form-data with a file field.
Accepted types: JPEG, PNG, GIF, WebP. Max size: 5 MB. Images are stored in R2 under events/images/.
Response: { url } — relative URL to the uploaded image (e.g. /api/uploads/events/images/<id>.jpg).