{ "openapi": "3.0.1", "info": { "title": "API V1", "version": "v1" }, "servers": [ { "url": "localhost:3000", "variables": {} } ], "paths": { "/api/v1/activities": { "get": { "summary": "List activities", "tags": [ "Activities" ], "parameters": [ { "name": "page", "in": "query", "description": "Page number", "schema": { "type": "integer" } }, { "name": "limit", "in": "query", "description": "Number of activities per page (1-10)", "schema": { "type": "integer" } } ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Activity" } } } } }, "422": { "description": "Unprocessable Entity - invalid params provided" } } }, "post": { "summary": "Create activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "parameters": [], "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Activity" } } } }, "422": { "description": "Unprocessable Entity - missing or invalid fields" } }, "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActivityCreate" } } }, "required": true } } }, "/api/v1/activities/{id}": { "parameters": [ { "name": "id", "in": "path", "description": "Activity ID", "required": true, "schema": { "type": "integer" } } ], "get": { "summary": "Show activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Activity" } } } }, "404": { "description": "Not Found" } } }, "patch": { "summary": "Update activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "parameters": [], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Activity" } } } }, "403": { "description": "You are not authorized to execute this action" }, "422": { "description": "Unprocessable Entity - invalid fields" } }, "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActivityUpdate" } } } } }, "delete": { "summary": "Delete activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "204": { "description": "No Content" }, "403": { "description": "You are not authorized to execute this action" }, "422": { "description": "Unprocessable Entity - could not delete activity" } } } }, "/api/v1/activities/{id}/join": { "parameters": [ { "name": "id", "in": "path", "description": "Activity ID", "required": true, "schema": { "type": "integer" } } ], "post": { "summary": "Join activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "201": { "description": "User joined the activity" }, "409": { "description": "User already participates in this activity" }, "422": { "description": "Unprocessable Entity - user could not join the activity due to validation errors" } } } }, "/api/v1/activities/{id}/leave": { "parameters": [ { "name": "id", "in": "path", "description": "Activity ID", "required": true, "schema": { "type": "integer" } } ], "delete": { "summary": "Leave activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "User left the activity" }, "409": { "description": "User cannot leave their own activity" }, "422": { "description": "Unprocessable Entity - user is not a part of this activity" } } } }, "/api/v1/activities/generate_description": { "parameters": [ { "name": "title", "in": "body", "required": true, "description": "Title of the activity", "schema": { "type": "string" } }, { "name": "location", "in": "body", "required": false, "description": "Location of the activity", "schema": { "type": "string" } }, { "name": "start_time", "in": "body", "required": false, "description": "Start time of the activity", "schema": { "type": "string" } } ], "post": { "summary": "Generate description", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Request accepted", "content": { "application/json": { "schema": { "type": "object", "properties": { "request_id": { "type": "string", "description": "ID used to check status via GET /activities/description_status" } } } } } }, "400": { "description": "Bad Request - missing title" } } } }, "/api/v1/activities/description_status": { "parameters": [ { "name": "request_id", "in": "query", "required": true, "description": "ID of the description generation request from the POST /activities/generate_description endpoint", "schema": { "type": "string" } } ], "get": { "summary": "Description status", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Status retrieved", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "description": "Status of the generation process (e.g. pending, done, error)" }, "message": { "type": "string", "description": "Message related to the request" }, "description": { "type": "string", "description": "Generated description if available" } } } } } }, "400": { "description": "Bad Request - missing or invalid request_id" }, "404": { "description": "Not Found - no such request ID found" }, "422": { "description": "Unprocessable Entity - error during description generation" } } } }, "/api/v1/activities/{id}/confirm": { "parameters": [ { "name": "id", "in": "path", "description": "Activity ID", "required": true, "schema": { "type": "integer" } } ], "post": { "summary": "Confirm activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Activity confirmed" }, "422": { "description": "Unprocessable Entity - could not confirm activity due to validation errors" } } } }, "/api/v1/activities/{id}/cancel": { "parameters": [ { "name": "id", "in": "path", "description": "Activity ID", "required": true, "schema": { "type": "integer" } } ], "post": { "summary": "Cancel activity", "tags": [ "Activities" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Activity cancelled" }, "422": { "description": "Unprocessable Entity - could not cancel activity due to validation errors" } } } }, "/api/v1/current_user": { "get": { "summary": "Get currently logged in user data", "tags": [ "Session" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Unauthorized" } } }, "patch": { "summary": "Update currently logged in user data", "tags": [ "Session" ], "security": [ { "BearerAuth": [] } ], "parameters": [], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Bad Request - missing or invalid fields" }, "401": { "description": "Unauthorized" } }, "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserUpdate" } } }, "required": true } }, "delete": { "summary": "Delete currently logged in user data", "tags": [ "Session" ], "security": [ { "BearerAuth": [] } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized" } } } }, "api/v1/users/sign_in": { "post": { "summary": "Sign in with user credentials", "tags": [ "Authentication" ], "security": [ { "BearerAuth": [] } ], "parameters": [], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Logged in successfully" }, "user": { "$ref": "#/components/schemas/User" } } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "string", "example": "Invalid Email or password" } } } } }, "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "example": "user@example.com" }, "password": { "type": "string", "example": "password123" } }, "required": [ "email", "password" ] } } }, "required": true } } }, "api/v1/users/sign_out": { "delete": { "summary": "Sign out", "tags": [ "Authentication" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "type": "string", "example": "Logged out successfully" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "string", "example": "User not found" } } } } } } }, "/api/v1/users": { "post": { "summary": "Sign up (Create user)", "tags": [ "Users" ], "security": [ { "BearerAuth": [] } ], "parameters": [], "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Bad Request - missing or invalid fields" } }, "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserRequest" } } }, "required": true } } }, "/api/v1/users/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "description": "User ID", "schema": { "type": "integer" } } ], "get": { "summary": "Show user", "tags": [ "Users" ], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "404": { "description": "Not Found" } } } } }, "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT", "description": "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer \"" } }, "schemas": { "Activity": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "title": { "type": "string", "example": "Basketball Game" }, "description": { "type": "string", "example": "A 5v5 basketball game for beginners" }, "location": { "type": "string", "example": "Crypto.com arena, Los Angeles" }, "start_time": { "type": "string", "format": "date-time", "example": "2028-03-24T14:15:22Z" }, "max_participants": { "type": "integer", "example": 5 }, "minimum_age": { "type": "integer", "example": 18 }, "maximum_age": { "type": "integer", "example": 25 }, "user": { "$ref": "#/components/schemas/User" }, "participants": { "type": "array", "items": { "$ref": "#/components/schemas/User" } } } }, "ActivityCreate": { "type": "object", "properties": { "title": { "type": "string", "minLength": 8, "maxLength": 100, "pattern": "^[^<>{}\\[\\]|\\^~]+$", "example": "Soccer Game", "description": "Title must be 8-100 characters long and cannot contain special characters <>{}[]|\\^~" }, "description": { "type": "string", "minLength": 40, "maxLength": 1000, "pattern": "^[^<>{}\\[\\]|\\^~]+$", "example": "A soccer game for beginners", "description": "Description must be 40-1000 characters long and cannot contain special characters <>{}[]|\\^~" }, "location": { "type": "string", "minLength": 4, "maxLength": 100, "pattern": "^[^<>{}\\[\\]|\\^~]+$", "example": "Barcelona Stadium", "description": "Location must be 4-100 characters long and cannot contain special characters <>{}[]|\\^~" }, "start_time": { "type": "string", "format": "date-time", "example": "2028-03-24T14:15:22Z", "description": "Start time of the activity (ISO 8601 format). Should be no further than 1 month in the future" }, "max_participants": { "type": "integer", "example": 5, "minimum": 2, "maximum": 8, "description": "Number of maximum participants, must be between 2 and 8." }, "minimum_age": { "type": "integer", "example": 18, "minimum": 18, "maximum": 96, "description": "Minimum age of participants allowed" }, "maximum_age": { "type": "integer", "example": 25, "minimum": 22, "maximum": 100, "description": "Maximum age of participants allowed" }, "user_id": { "type": "integer", "example": 4, "description": "Activity creator user's ID" } }, "required": [ "title", "description", "location", "start_time", "max_participants", "user_id" ] }, "ActivityUpdate": { "type": "object", "properties": { "title": { "type": "string", "minLength": 8, "maxLength": 100, "pattern": "^[^<>{}\\[\\]|\\^~]+$", "example": "Soccer Game", "description": "Title must be 8-100 characters long and cannot contain special characters <>{}[]|\\^~" }, "description": { "type": "string", "minLength": 40, "maxLength": 1000, "pattern": "^[^<>{}\\[\\]|\\^~]+$", "example": "A soccer game for beginners", "description": "Description must be 40-1000 characters long and cannot contain special characters <>{}[]|\\^~" }, "location": { "type": "string", "minLength": 4, "maxLength": 100, "pattern": "^[^<>{}\\[\\]|\\^~]+$", "example": "Barcelona Stadium", "description": "Location must be 4-100 characters long and cannot contain special characters <>{}[]|\\^~" }, "start_time": { "type": "string", "format": "date-time", "example": "2028-03-24T14:15:22Z", "description": "Start time of the activity (ISO 8601 format). Should be no further than 1 month in the future" }, "max_participants": { "type": "integer", "example": 5, "minimum": 2, "maximum": 8, "description": "Number of maximum participants, must be between 2 and 8." }, "minimum_age": { "type": "integer", "example": 18, "minimum": 18, "maximum": 96, "description": "Minimum age of participants allowed" }, "maximum_age": { "type": "integer", "example": 25, "minimum": 22, "maximum": 100, "description": "Maximum age of participants allowed" } } }, "User": { "type": "object", "properties": { "id": { "type": "integer", "example": 14 }, "email": { "type": "string", "example": "user@example.com" }, "username": { "type": "string", "example": "john_doe" }, "personality": { "type": "integer", "example": 5 }, "birth_date": { "type": "string", "format": "date", "example": "2000-01-01" } } }, "UserRequest": { "type": "object", "properties": { "email": { "type": "string", "format": "email", "example": "user@example.com" }, "password": { "type": "string", "format": "password", "example": "password" } }, "required": [ "email", "password" ] }, "UserUpdate": { "type": "object", "properties": { "username": { "type": "string", "format": "email", "example": "new_username" }, "personality": { "type": "integer", "minimum": 1, "maximum": 7, "example": 2 }, "birth_date": { "type": "string", "format": "date", "example": "2000-01-01", "description": "Birth date can only be set once; cannot be changed. User must be between 18 and 100 years old." } } } } }, "security": [ { "BearerAuth": [] } ], "tags": [ { "name": "Authentication", "description": "Endpoints for user authentication" }, { "name": "Session", "description": "Endpoints for managing the current user session" }, { "name": "Activities", "description": "Endpoints for managing activities data" }, { "name": "Users", "description": "Endpoints for managing users data" } ] }