Event API
Events and Event Comments
Create events, manage recurring series, and collaborate through comments
This page documents the event CRUD surface, recurring-event handling, calendar-scoped event reads, and the comment thread endpoints attached to events.
JWT or user API keyRecurring updatesCalendar range queriesComment threads
Source
- Events controller:
backend-nestjs/src/events/events.controller.ts - Event comments controller:
backend-nestjs/src/events/event-comments.controller.ts - DTOs:
backend-nestjs/src/dto/event.dto.ts,backend-nestjs/src/dto/recurrence.dto.ts,backend-nestjs/src/dto/event-comment.dto.ts,backend-nestjs/src/events/dto/list-events.query.dto.ts - Event entity enums:
backend-nestjs/src/entities/event.entity.ts
Authentication and Permissions
- All routes on this page are intended to be authenticated.
- Event comments use
JwtAuthGuardat the controller level. - Event CRUD routes explicitly use
JwtAuthGuardon each method exceptGET /api/events/calendar/:calendarId. - Source note:
GET /api/events/calendar/:calendarIdstill readsreq.user.id, so treat it as an authenticated route even though the decorator is missing in the controller source. - Access to events and comments is enforced by event and calendar ownership or share permissions in the service layer.
Endpoint Reference
Events
| Method | Path | Purpose | Request or query | Auth | Source |
|---|---|---|---|---|---|
POST | /api/events | Create one event. | Body: event fields | JWT or user API key | events/events.controller.ts |
POST | /api/events/recurring | Create a recurring event series. | Body: recurring event fields | JWT or user API key | events/events.controller.ts |
GET | /api/events | List accessible events in an optional date range. | Query: startDate,endDate | JWT or user API key | events/events.controller.ts |
GET | /api/events/:id | Get one event. | Path: id | JWT or user API key | events/events.controller.ts |
PATCH | /api/events/:id | Update one event or one recurring occurrence. | Path: id, body: partial event fields plus updateMode | JWT or user API key | events/events.controller.ts |
DELETE | /api/events/:id | Delete one event. | Path: id | JWT or user API key | events/events.controller.ts |
PATCH | /api/events/:id/recurring | Update a recurring series with explicit scope. | Path: id, body: recurring update fields plus updateScope | JWT or user API key | events/events.controller.ts |
GET | /api/events/calendar/:calendarId | List events for one calendar. | Path: calendarId | Treat as authenticated | events/events.controller.ts |
Event Comments
| Method | Path | Purpose | Request or query | Auth | Source |
|---|---|---|---|---|---|
GET | /api/events/:eventId/comments | List comments for an event. | Path: eventId | JWT or user API key | events/event-comments.controller.ts |
POST | /api/events/:eventId/comments | Create a comment. | Path: eventId, body: content,templateKey,parentCommentId,isFlagged | JWT or user API key | events/event-comments.controller.ts |
POST | /api/events/:eventId/comments/track-open | Track that a user opened an event. | Path: eventId, body: note | JWT or user API key | events/event-comments.controller.ts |
PATCH | /api/events/:eventId/comments/:commentId | Update a comment. | Path: eventId,commentId, body: content | JWT or user API key | events/event-comments.controller.ts |
PATCH | /api/events/:eventId/comments/:commentId/flag | Flag or unflag a comment. | Path: eventId,commentId, body: isFlagged | JWT or user API key | events/event-comments.controller.ts |
POST | /api/events/:eventId/comments/:commentId/replies | Reply to a comment. | Path: eventId,commentId, body: comment create fields | JWT or user API key | events/event-comments.controller.ts |
Request Shapes
Create and update event
CreateEventDto and UpdateEventDto in backend-nestjs/src/dto/event.dto.ts
title: required on create, stringdescription: optional stringstartDate: required on create, ISO datestartTime: optional stringendDate: optional ISO dateendTime: optional stringisAllDay: optional booleanlocation: optional stringstatus: optional enumconfirmed|tentative|cancelledrecurrenceType: optional enumnone|daily|weekly|monthly|yearlyrecurrenceRule: optional JSON payloadcolor: optional stringicon: optional stringnotes: optional stringtags: optional string array, max 64 chars eachlabels: optional alias fortagscalendarId: optional numberupdateMode: update-only enumsingle|all|future
Entity-level limits from backend-nestjs/src/entities/event.entity.ts
titlelength: 300locationlength: 200iconlength: 10colorlength: 7
Recurring series
CreateRecurringEventDto and UpdateRecurringEventDto in backend-nestjs/src/dto/recurrence.dto.ts
calendarId: required on createrecurrence.type: required enumnone|daily|weekly|monthly|yearlyrecurrence.interval: optional number, default1recurrence.daysOfWeek: optional enum arraySU|MO|TU|WE|TH|FR|SArecurrence.dayOfMonth: optional numberrecurrence.monthOfYear: optional numberrecurrence.endType: optionalnever|count|daterecurrence.count: optional numberrecurrence.endDate: optional ISO daterecurrence.timezone: optional stringupdateScope: update-only enumthis|future|all
List query
ListEventsQueryDto.startDate: optional ISO dateListEventsQueryDto.endDate: optional ISO date
Comments
CreateEventCommentDto in backend-nestjs/src/dto/event-comment.dto.ts
content: optional stringtemplateKey: optional enumCommentTemplateKeyparentCommentId: optional numberisFlagged: optional boolean
Other comment DTOs:
UpdateEventCommentDto.content: required stringFlagCommentDto.isFlagged: required booleanTrackEventOpenDto.note: optional string
Example Calls
Create a calendar event
curl -X POST "$PRIMECAL_API/api/events" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "School pickup",
"startDate": "2026-03-30",
"startTime": "15:30",
"endDate": "2026-03-30",
"endTime": "16:00",
"calendarId": 5,
"tags": ["family", "kids"]
}'
Create a recurring event series
curl -X POST "$PRIMECAL_API/api/events/recurring" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Soccer practice",
"startDate": "2026-04-01",
"startTime": "17:00",
"endDate": "2026-04-01",
"endTime": "18:30",
"calendarId": 5,
"recurrence": {
"type": "weekly",
"interval": 1,
"daysOfWeek": ["WE"],
"endType": "date",
"endDate": "2026-06-30"
}
}'
Update a single occurrence in a recurring series
curl -X PATCH "$PRIMECAL_API/api/events/42" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"startTime": "17:30",
"endTime": "19:00",
"updateMode": "single"
}'
Add a comment
curl -X POST "$PRIMECAL_API/api/events/42/comments" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "Running 10 minutes late."
}'
Response and Behavior Notes
- Event responses include a
calendarsummary and acreatedBysummary. tagsandlabelsare parallel inputs; clients should pick one convention and stay consistent.- Recurring-series updates have two distinct models:
PATCH /api/events/:idusesupdateModewithsingle|all|futurePATCH /api/events/:id/recurringusesupdateScopewiththis|future|all
- Comment responses include nested replies, reporter metadata, visibility, and flag state.
Best Practices
- Send date and time fields separately; the backend models them as separate properties.
- Prefer
GET /api/events?startDate=...&endDate=...for calendar views and exports. - Keep recurring edits explicit. Do not assume the client default matches the user's intent.
- Normalize event labels on the client if you also expose reusable labels through the user settings flow.
- Use comments for collaboration metadata and visible discussion, not as a hidden machine-state channel.