Overview
The SkyTeam ROBLOX API uses API key authentication via thex-api-key header. Each airline has a unique API token that must be included in all requests (except /health).
Authentication Flow
Authentication is handled by theairlineAuth middleware defined in middleware/auth.ts:9. The middleware:
- Extracts the
x-api-keyheader from the request - Validates the token against the database
- Attaches the airline data to
res.localsfor use in route handlers
Authentication Middleware
Location:apps/api/src/middleware/auth.ts:9
Making Authenticated Requests
Required Header
Your airline’s unique API token. This is generated when your airline is created in the database.
Example Request
Error Responses
Missing API Key
Status:401 Unauthorized
Invalid API Key
Status:401 Unauthorized
Token Security
- API keys should be stored as environment variables
- Tokens are stored in the
airlines.tokendatabase column - The
safeAirlinehelper (defined inmiddleware/auth.ts:4) strips the token from airline objects before returning them to clients
Protected Endpoints
All endpoints require authentication except:GET /health- Public health check endpoint
Token in Response Data
When airline data is returned in API responses, the token is automatically removed using thesafeAirline helper function: