Skip to main content

API Reference

This document provides comprehensive documentation for the FastGateway REST API endpoints.

Authentication

All API endpoints (except /api/v1/auth/login) require authentication using JWT Bearer tokens.

Request Header

Authorization: Bearer <your-jwt-token>

Obtaining a Token

curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "your-password"}'

Response:

{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "uuid",
"username": "admin",
"email": "admin@example.com",
"role": "admin"
}
}

Auth Endpoints

MethodEndpointDescription
POST/api/v1/auth/loginAuthenticate user and get JWT token
POST/api/v1/auth/logoutInvalidate current session
GET/api/v1/auth/meGet current user profile
PUT/api/v1/auth/passwordChange current user password

Projects Endpoints

MethodEndpointDescription
GET/api/v1/projectsList all projects
POST/api/v1/projectsCreate a new project
GET/api/v1/projects/:idGet project by ID
PUT/api/v1/projects/:idUpdate project
DELETE/api/v1/projects/:idDelete project
GET/api/v1/projects/:id/membersList project members
POST/api/v1/projects/:id/membersAdd member to project
DELETE/api/v1/projects/:id/members/:userIdRemove member from project

Domains Endpoints

MethodEndpointDescription
GET/api/v1/projects/:projectId/domainsList all domains in project
POST/api/v1/projects/:projectId/domainsCreate a new domain
GET/api/v1/projects/:projectId/domains/:idGet domain by ID
PUT/api/v1/projects/:projectId/domains/:idUpdate domain
DELETE/api/v1/projects/:projectId/domains/:idDelete domain

Routes Endpoints

MethodEndpointDescription
GET/api/v1/projects/:projectId/domains/:domainId/routesList all routes in domain
POST/api/v1/projects/:projectId/domains/:domainId/routesCreate a new route
GET/api/v1/projects/:projectId/domains/:domainId/routes/:idGet route by ID
PUT/api/v1/projects/:projectId/domains/:domainId/routes/:idUpdate route
DELETE/api/v1/projects/:projectId/domains/:domainId/routes/:idDelete route
POST/api/v1/projects/:projectId/domains/:domainId/routes/:id/deployDeploy route to Kubernetes

Clients Endpoints

MethodEndpointDescription
GET/api/v1/projects/:projectId/clientsList all clients in project
POST/api/v1/projects/:projectId/clientsCreate a new client
GET/api/v1/projects/:projectId/clients/:idGet client by ID
PUT/api/v1/projects/:projectId/clients/:idUpdate client
DELETE/api/v1/projects/:projectId/clients/:idDelete client
POST/api/v1/clients/attachCreate client attachment request
GET/api/v1/clients/:clientId/attachmentsList client attachments

Approvals Endpoints

MethodEndpointDescription
GET/api/v1/approvalsList all pending approvals
GET/api/v1/approvals/:idGet approval by ID
POST/api/v1/approvals/:id/approve-teamApprove as team member
POST/api/v1/approvals/:id/approve-approverApprove as designated approver
POST/api/v1/approvals/:id/rejectReject approval request

Users Endpoints (Admin Only)

MethodEndpointDescription
GET/api/v1/usersList all users
POST/api/v1/usersCreate a new user
GET/api/v1/users/:idGet user by ID
PUT/api/v1/users/:idUpdate user
DELETE/api/v1/users/:idDelete user

Response Formats

Success Response

{
"data": { ... },
"message": "Operation successful"
}

Error Response

{
"error": "Error message",
"code": "ERROR_CODE",
"details": { ... }
}

Common HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request - Invalid input
401Unauthorized - Invalid or missing token
403Forbidden - Insufficient permissions
404Not Found
409Conflict - Resource already exists
500Internal Server Error

Pagination

List endpoints support pagination with query parameters:

ParameterDescriptionDefault
pagePage number (1-based)1
limitItems per page20
sortSort fieldcreated_at
orderSort order (asc or desc)desc

Example:

curl -X GET "http://localhost:8080/api/v1/projects?page=1&limit=10&sort=name&order=asc" \
-H "Authorization: Bearer <token>"