Skip to content

Events API

All endpoints require authentication and events tool permissions.

GET /api/events

Permission: events:view

Query parameters:

ParamTypeDescription
statusstringFilter 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.

POST /api/events

Permission: events:update

Body:

FieldTypeRequiredDescription
titlestringYesEvent title
descriptionstringNoEvent description
proposed_datestringNoProposed date (YYYY-MM-DD)
locationstringNoEvent location
image_urlstringNoURL to event image

Response: { event } (201)

PUT /api/events/:id

Permission: 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 /api/events/:id

Permission: events:manage

Response: { ok: true }

POST /api/events/:id/vote

Permission: events:view

Toggles the current user’s vote. If already voted, the vote is removed.

Response: { vote_count, user_voted }

POST /api/events/upload-image

Permission: 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).