API
Overview
Bridge Training REST API reference.
Base URL
/apiThe API runs as a standalone Hono server (apps/api), typically on port 3001.
Interactive docs
The API serves an interactive Swagger UI at /swagger and the raw OpenAPI spec at /doc.
Endpoint documentation below is auto-generated from the OpenAPI schema via fumadocs-openapi.
Authentication
Two authentication mechanisms are supported depending on the caller:
| Method | Header | Use case |
|---|---|---|
| API Key | X-API-Key: <key> | Server-to-server (PHP backend) |
| JWT Bearer | Authorization: Bearer <token> | Client-side (Clerk-issued tokens) |
See Authentication for details.
Error format
All errors follow a consistent JSON shape:
{
"code": "DEAL_NOT_FOUND",
"message": "Deal abc-123 not found"
}Some errors include an optional meta field with additional context. See Errors for the full reference.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/deals/:id | API Key | Fetch a deal by ID |