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:8081/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "your-password"}'

Response:

{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": "2026-01-01T00:00:00Z",
"user": {
"id": "uuid",
"username": "admin",
"email": "admin@example.com",
"role": "owner"
}
}

System roles are owner and user. Use the accessToken as the Bearer token; the refreshToken can be exchanged for a new access token via POST /api/v1/auth/refresh.

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/:projectIdGet project by ID
PATCH/api/v1/projects/:projectIdUpdate project
DELETE/api/v1/projects/:projectIdDelete project
GET/api/v1/projects/:projectId/membersList project members (unique users across the project's assigned teams)
GET/api/v1/projects/:projectId/teamsList teams assigned to the project
POST/api/v1/projects/:projectId/teamsAssign a team to the project
DELETE/api/v1/projects/:projectId/teams/:teamIdRemove a team from the project
GET/api/v1/projects/:projectId/adminsList project admins
POST/api/v1/projects/:projectId/adminsAdd a project admin
DELETE/api/v1/projects/:projectId/admins/:userIdRemove a project admin

Project access is not granted by adding individual members. Instead, assign a team to the project (members of that team inherit access) or add a user as a project admin.

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/:domainIdGet domain by ID
PATCH/api/v1/projects/:projectId/domains/:domainIdUpdate domain
DELETE/api/v1/projects/:projectId/domains/:domainIdDelete 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/:routeIdGet route by ID
PUT/api/v1/projects/:projectId/domains/:domainId/routes/:routeIdUpdate route
DELETE/api/v1/projects/:projectId/domains/:domainId/routes/:routeIdDelete route
POST/api/v1/projects/:projectId/domains/:domainId/routes/:routeId/deployDeploy route to Kubernetes

Clients Endpoints​

Clients are global resources (not scoped to a project).

MethodEndpointDescription
GET/api/v1/clientsList all clients
POST/api/v1/clientsCreate a new client
GET/api/v1/clients/:clientIdGet client by ID
PATCH/api/v1/clients/:clientIdUpdate client
DELETE/api/v1/clients/:clientIdDelete client
GET/api/v1/clients/:clientId/routesList routes attached to the client
POST/api/v1/clients/:clientId/routes/attachAttach the client to a route

Approvals Endpoints​

Approvals are project-scoped and multi-stage. Each approval progresses through one or more stages, and callers approve or reject a specific stage.

MethodEndpointDescription
GET/api/v1/projects/:projectId/approvalsList approvals in the project
GET/api/v1/projects/:projectId/approvals/:approvalIdGet approval by ID
POST/api/v1/projects/:projectId/approvals/:approvalId/stages/:stageId/approveApprove a specific stage
POST/api/v1/projects/:projectId/approvals/:approvalId/stages/:stageId/rejectReject a specific stage

Users Endpoints (Owner Only)​

MethodEndpointDescription
GET/api/v1/usersList all users
POST/api/v1/usersCreate a new user
GET/api/v1/users/:userIdGet user by ID
PATCH/api/v1/users/:userIdUpdate user
DELETE/api/v1/users/:userIdDelete user

Response Formats​

Success Response​

Handlers return the requested object directly (or an array for list endpoints) — there is no wrapper envelope. For example, fetching a single project returns the project object itself:

{
"id": "uuid",
"name": "my-project",
"connectionType": "api_token"
}

Error Response​

Errors returned by the API handlers use a simple shape:

{
"error": "Error message"
}

The OpenAPI specification documents the error body as an Error schema with code and message fields:

{
"code": "ERROR_CODE",
"message": "Error message"
}

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 page (minimum 1, maximum 100)20

Example:

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