Before working with the API, ensure your environment is properly configured:
\u2705 Environment Setup Guide – Complete configuration instructions including:
- Backend API URL configuration (
REACT_APP_API_URL) - Running the backend locally
- Troubleshooting connection issues
- Mock API vs real API modes
Eventra provides a RESTful backend API built using Spring Boot and secured using JWT Authentication.
The APIs support:
- User authentication
- Event management
- Public and protected endpoint access
- Structured error handling
- Swagger/OpenAPI integration
For detailed information on authentication flows, role-based access control, and how permissions work, see the Architecture & Roles Guide.
https://eventra-backend-springboot-eybhdvaubxcua7ha.centralindia-01.azurewebsites.net/swagger-ui/index.htmlAfter starting the Spring Boot backend locally:
http://localhost:8080/swagger-ui/index.htmlIf the backend runs on another port (example: 8081), replace the port accordingly.
Eventra uses JWT-based authentication.
POST /api/auth/signup{
"firstName": "john",
"lastName": "Doe",
"email": "john@example.com",
"password": "password123",
"confirmPassword": "password123"
}POST /api/auth/login{
"usernameOrEmail": "john@example.com",
"password": "password123"
}POST /api/auth/google{
"credential": "GOOGLE_ID_TOKEN_FROM_GOOGLE_OAUTH"
}Successful login returns:
{
"token": "JWT_TOKEN",
"tokenType": "Bearer",
"id": 1,
"firstName": "john",
"lastName": "doe",
"email": "john@example.com",
"username": "john",
"role": "CLIENT"
}Click the Authorize button in Swagger UI and enter:
Bearer YOUR_JWT_TOKENExample:
Bearer eyJhbGciOiJIUzI1NiJ9...| Method | Endpoint |
|---|---|
| POST | /api/auth/signup |
Creates a new user account and returns a JWT token.
| Method | Endpoint |
|---|---|
| POST | /api/auth/login |
Authenticates the user and returns a JWT token.
{
"usernameOrEmail": "john@example.com",
"password": "password123"
}{
"message": "Login successful",
"token": "JWT_TOKEN",
"tokenType": "Bearer",
"id": 1,
"firstName": "john",
"lastName": "doe",
"email": "john@example.com",
"username": "john",
"role": "ATTENDEE",
"roles": ["USER"],
"permissions": ["events:view", "events:register", ...]
}| Status | Reason |
|---|---|
400 Bad Request |
Missing username/email or password |
401 Unauthorized |
Invalid credentials |
| Method | Endpoint |
|---|---|
| POST | /api/auth/google |
Authenticates the user via Google OAuth and returns a JWT token. Creates a new user if they don't exist.
{
"credential": "GOOGLE_ID_TOKEN"
}{
"message": "Login successful via Google",
"token": "JWT_TOKEN",
"tokenType": "Bearer",
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"username": "john@example.com",
"role": "ATTENDEE",
"roles": ["USER"],
"permissions": ["events:view", "events:register", ...],
"avatarUrl": "https://lh3.googleusercontent.com/...",
"emailVerified": true,
"provider": "google"
}| Status | Reason |
|---|---|
400 Bad Request |
Missing Google credential |
401 Unauthorized |
Invalid or expired Google token |
| Method | Endpoint |
|---|---|
| POST | /api/auth/logout |
Logs out the authenticated user and invalidates the current JWT session. This endpoint invalidates the JWT by adding it to a server-side blacklist; once logged out, the same token can no longer be used to access protected APIs.
Requires a valid Bearer JWT in the Authorization header.
Authorization: Bearer YOUR_JWT_TOKENNone required.
Logged out successfully
| Status | Reason |
|---|---|
401 Unauthorized |
Missing, malformed, invalid, or blacklisted token |
| Method | Endpoint |
|---|---|
| GET | /api/users/profile |
Returns the currently authenticated user's basic profile details from the JWT security context.
Authorization: Bearer YOUR_JWT_TOKEN{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"username": "john3163",
"email": "john3163@example.com",
"role": "CLIENT"
}| Status | Reason |
|---|---|
401 Unauthorized |
JWT token is missing, invalid, or expired |
404 Not Found |
Authenticated user could not be found |
- This endpoint is used to restore logged-in user/session state after refresh.
- The backend implementation is handled in the Eventra-Backend repository.
| Method | Endpoint |
|---|---|
| PUT | /api/users/profile |
Allows the currently authenticated user to update their profile information.
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json{
"firstName": "Johnny",
"lastName": "Updated",
"username": "johnny3164"
}{
"id": 1,
"firstName": "Johnny",
"lastName": "Updated",
"username": "johnny3164",
"email": "john3164@example.com",
"role": "CLIENT"
}| Status | Reason |
|---|---|
400 Bad Request |
Validation failure |
401 Unauthorized |
Missing or invalid JWT token |
404 Not Found |
Authenticated user no longer exists |
409 Conflict |
Username already exists |
- Only
firstName,lastName, andusernamecan be updated through this endpoint. id,email,password, androleare not editable here.- The backend uses the authenticated email from the JWT to identify the user.
| Method | Endpoint |
|---|---|
| POST | /api/events |
Creates a new event. Requires JWT authentication.
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json{
"title": "Tech Conference 2026",
"description": "Annual developer meetup featuring talks and workshops",
"location": "Mumbai",
"eventDate": "2026-08-15T10:00:00",
"public": true
}{
"id": 1,
"title": "Tech Conference 2026",
"description": "Annual developer meetup featuring talks and workshops",
"location": "Mumbai",
"eventDate": "2026-08-15T10:00:00",
"public": true
}{
"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource",
"path": "/api/events",
"timestamp": "2026-05-19T12:20:31"
}{
"status": 409,
"error": "Conflict",
"message": "This event has reached capacity.",
"path": "/api/events/1/register",
"timestamp": "2026-05-23T09:30:00"
}{
"status": 409,
"error": "Conflict",
"message": "Too many simultaneous registrations. Please try again.",
"path": "/api/events/1/register",
"timestamp": "2026-05-23T09:30:00"
}| Method | Endpoint |
|---|---|
| GET | /api/events |
Returns a list of all available events. No authentication required.
GET /api/events[
{
"id": 1,
"title": "Tech Conference 2026",
"description": "Annual developer meetup featuring talks and workshops",
"location": "Mumbai",
"eventDate": "2026-08-15T10:00:00",
"public": true
},
{
"id": 2,
"title": "Open Source Hackathon",
"description": "48-hour hackathon for open source projects",
"location": "Bangalore",
"eventDate": "2026-09-20T09:00:00",
"public": true
}
]| Method | Endpoint |
|---|---|
| GET | /api/events/{id} |
Returns complete details for an event by its ID. Requires JWT authentication.
This endpoint retrieves the event directly by ID and does not apply public-only filtering. If the event exists, both public and private/non-public events can be returned to an authenticated requester.
Authorization: Bearer YOUR_JWT_TOKEN
GET /api/events/1
{
"id": 1,
"title": "Tech Conference",
"description": "Annual developer meetup",
"location": "Mumbai",
"eventDate": "2026-05-19T18:30:00",
"public": false
} {
"status": 404,
"error": "Not Found",
"message": "Event not found with id: 888",
"path": "/api/events/888",
"timestamp": "2026-05-19T12:20:31"
}Event create, update, and detail APIs return a sanitized event response object instead of the raw backend entity. The response includes public event fields such as id, title, description, location, eventDate, capacity, registeredCount, and public.
Internal backend fields such as registered user entities, attendee details, and JPA metadata are not exposed in event API responses.
| Method | Endpoint |
|---|---|
| POST | /api/events/{id}/register |
Registers the authenticated user for a specific event. Requires JWT authentication.
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/jsonPOST /api/events/1/register{
"message": "Successfully registered for event",
"eventId": 1,
"userId": 1
}{
"status": 404,
"error": "Not Found",
"message": "Event not found with id: 999",
"path": "/api/events/999/register",
"timestamp": "2026-05-19T12:20:31"
}{
"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource",
"path": "/api/events/1/register",
"timestamp": "2026-05-19T12:20:31"
}| Method | Endpoint |
|---|---|
| GET | /api/users/my-events |
Returns the events registered by the currently authenticated user. Requires JWT authentication.
Authorization: Bearer YOUR_JWT_TOKENGET /api/users/my-events[
{
"registrationId": 101,
"eventId": 1,
"title": "Tech Conference 2026",
"description": "Annual developer meetup featuring talks and workshops",
"location": "Mumbai",
"eventDate": "2026-08-15T10:00:00",
"date": "2026-08-15",
"time": "10:00:00",
"registeredAt": "2026-05-20T14:30:00",
"status": "CONFIRMED"
}
][]{
"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource",
"path": "/api/users/my-events",
"timestamp": "2026-05-27T12:20:31"
}| Method | Endpoint |
|---|---|
| POST | /api/events/create |
Creates a new event. This endpoint is restricted to authenticated users with ORGANIZER or ADMIN authority.
Requires a valid JWT token.
Authorization: Bearer <token>{
"title": "Manual Create Event Test",
"description": "Testing event creation manually",
"location": "Online",
"eventDate": "2026-07-15T10:00:00",
"capacity": 50,
"isPublic": true
}title,description,location, andeventDateare required.eventDatemust be a future date/time.capacityis optional, but must be positive when provided.isPublicis optional and defaults totrue.registeredCountis managed by the backend and defaults to0.
201 Created{
"id": 1,
"title": "Manual Create Event Test",
"description": "Testing event creation manually",
"location": "Online",
"eventDate": "2026-07-15T10:00:00",
"capacity": 50,
"registeredCount": 0,
"public": true
}| Status | Reason |
|---|---|
400 Bad Request |
Invalid event payload |
401 Unauthorized |
Missing or invalid JWT |
403 Forbidden |
Authenticated user is not an ORGANIZER or ADMIN |
| Method | Endpoint |
|---|---|
| PUT | /api/events/{id} |
Updates an existing event by ID. This endpoint is restricted to authenticated users with ORGANIZER or ADMIN authority.
This is a companion documentation update for backend issue #2099 and backend update-event API work.
Requires a valid JWT token.
Authorization: Bearer <token>{
"title": "Updated Event",
"description": "Updated event description",
"location": "Updated Location",
"eventDate": "2026-12-30T10:00:00",
"capacity": 150,
"isPublic": true
}registeredCountis preserved during update and cannot be directly edited.capacitymust not be lower than currentregisteredCount.- Owner-only authorization is not enforced because the Event model currently does not track event ownership.
200 OK| Status | Reason |
|---|---|
400 Bad Request |
Invalid payload |
403 Forbidden |
Unauthorized roles such as CLIENT |
404 Not Found |
Event ID does not exist |
409 Conflict |
Capacity is lower than current registeredCount |
| Method | Endpoint |
|---|---|
| DELETE | /api/events/{id} |
Deletes an existing event by ID. This endpoint is restricted to authenticated users with ADMIN or SUPER_ADMIN authority.
Requires a valid JWT token.
Authorization: Bearer <token>204 No Content| Status | Reason |
|---|---|
401 Unauthorized |
Missing or invalid JWT |
403 Forbidden |
Authenticated user does not have ADMIN or SUPER_ADMIN authority |
404 Not Found |
Event ID does not exist |
- Related event registrations are automatically cleaned up by the backend before the event is deleted.
| Method | Endpoint |
|---|---|
| GET | /api/events/stream |
Opens a Server-Sent Events stream connection for event updates.
Public. No authentication required.
- This endpoint currently establishes a basic SSE connection.
- It sends an initial connected event to confirm the stream is active.
- It prepares the backend for future real-time event broadcasts.
- Note: Full real-time event create/update/register broadcasting is not yet implemented.
text/event-stream
curl -N http://localhost:8080/api/events/streamevent:connected
data:Stream connected successfully
SandeepVashishtha/Eventra-Backend#BACKEND_PR_NUMBER
| Method | Endpoint |
|---|---|
| POST | /api/projects |
Submits a new project. Requires authentication with one of the following roles: ORGANIZER, ADMIN, SUPER_ADMIN.
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json{
"title": "Manual Test Project",
"description": "Project created during manual backend verification.",
"category": "Web Development",
"thumbnailUrl": "https://example.com/project-thumbnail.png",
"githubUrl": "https://github.com/example/manual-test-project"
}title: requireddescription: requiredcategory: requiredthumbnailUrl: optionalgithubUrl: optional
{
"id": 1,
"title": "Manual Test Project",
"description": "Project created during manual backend verification.",
"category": "Web Development",
"thumbnailUrl": "https://example.com/project-thumbnail.png",
"githubUrl": "https://github.com/example/manual-test-project",
"upvotes": 0
}- 400 Bad Request: Validation failure for required fields.
- 401 Unauthorized: No token provided or token is invalid.
- 403 Forbidden: Authenticated user does not have the required role (
ORGANIZER,ADMIN, orSUPER_ADMIN).
| Method | Endpoint |
|---|---|
| GET | /api/projects |
Returns the list of projects for the Projects gallery/module.
This documentation update corresponds to the backend implementation PR for GET /api/projects.
Not required. Public endpoint.
GET /api/projectsStatus: 200 OK
Returns a JSON array of project objects. Returns [] if no projects exist.
[
{
"id": 1,
"title": "Eventra Mobile App",
"description": "A cross-platform mobile application for event management",
"category": "Mobile Development",
"thumbnailUrl": "https://example.com/thumbnail1.png",
"githubUrl": "https://github.com/example/eventra-mobile",
"upvotes": 42
},
{
"id": 2,
"title": "Eventra CLI Tool",
"description": "Command-line tool for managing Eventra events",
"category": "Developer Tools",
"thumbnailUrl": "https://example.com/thumbnail2.png",
"githubUrl": "https://github.com/example/eventra-cli",
"upvotes": 15
}
]| Method | Endpoint |
|---|---|
| GET | /api/projects/{id} |
Returns the details of a specific project by its ID.
Not required. Public endpoint.
{
"id": 1,
"title": "Manual Test Project",
"description": "Project detail API manual verification",
"category": "Web Development",
"thumbnailUrl": "https://example.com/project.png",
"githubUrl": "https://github.com/example/project",
"upvotes": 0
}{
"status": 404,
"error": "Not Found",
"message": "Project not found with id: 999999",
"path": "/api/projects/999999",
"timestamp": "2026-05-30T02:01:54.6254625"
}| Method | Endpoint |
|---|---|
| POST | /api/projects/{id}/upvote |
Increments the upvote count for a project by 1 and returns the updated project details.
Requires a valid Bearer JWT in the Authorization header. Any authenticated user can upvote.
Status: 200 OK
{
"id": 1,
"title": "Manual Test Project",
"description": "Project detail API manual verification",
"category": "Web Development",
"thumbnailUrl": "https://example.com/project.png",
"githubUrl": "https://github.com/example/project",
"upvotes": 1
}| Status | Reason |
|---|---|
401 Unauthorized |
JWT token is missing, invalid, or expired |
404 Not Found |
Project not found with the given ID |
| Method | Endpoint |
|---|---|
| GET | /api/projects/categories |
Returns the static list of supported project categories used by the Projects gallery/module.
Not required. Public endpoint.
No request body.
Status: 200 OK
[
"Mobile Development",
"Web Development",
"Developer Tools",
"Machine Learning",
"DevOps",
"Design",
"IoT",
"Blockchain"
]- This endpoint is public and does not require JWT authentication.
- This PR only documents the project categories endpoint.
- Other Projects APIs will be documented separately when implemented.
The backend returns standardized JSON error responses for better frontend integration and debugging.
{
"status": 404,
"error": "Not Found",
"message": "Event not found with id: 888",
"path": "/api/events/888",
"timestamp": "2026-05-19T12:20:31"
}| Status Code | Meaning |
|---|---|
| 200 | Successful request |
| 201 | Resource created successfully |
| 400 | Validation error / Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Resource not found |
| 409 | Conflict |
| 500 | Internal server error |
Frontend applications should:
- Store JWT tokens securely
- Send tokens using the
Authorizationheader - Handle structured API error responses
- Use Swagger UI for endpoint testing during development
Example authorization header:
Authorization: Bearer YOUR_JWT_TOKEN- Interactive API testing
- Faster frontend-backend integration
- Better onboarding for contributors
- Centralized API reference
- Easier debugging and maintenance
- Improved development workflow