API Overview¶
Base URL¶
Use {BASE_URL} in local and shared examples. When you need a concrete example, use https://api.example.com.
{BASE_URL}/health
{BASE_URL}/api/v1/ping
Note
This backend does not define a canonical production domain in the docs. Keep examples generic.
Core Routes¶
GET /health¶
| Field | Value |
|---|---|
| Auth | No |
| Success | 200 { "status": "ok" } |
| Notes | Liveness check only |
GET /ready¶
| Field | Value |
|---|---|
| Auth | No |
| Success | 200 { "status": "ok", "postgres": "ok", "redis": "ok" } |
| Errors | 503 with the same shape and failed dependencies marked error |
| Notes | Uses a short dependency timeout |
GET /api/v1/ping¶
| Field | Value |
|---|---|
| Auth | No |
| Success | 200 { "message": "pong" } |
| Notes | Simple API probe |
GET /api/v1/panic¶
| Field | Value |
|---|---|
| Auth | No |
| Success | None |
| Errors | 500 via recovery middleware |
| Notes | Intentional panic route for recovery testing |
GET /api/v1/error¶
| Field | Value |
|---|---|
| Auth | No |
| Success | 400 error envelope |
| Errors | BAD_REQUEST with details.path |
| Notes | Sample structured error response |
CORS And OPTIONS¶
The router adds CORS headers only when the request Origin is allowed.
Access-Control-Allow-Originechoes the request originAccess-Control-Allow-HeadersallowsAuthorization, Content-TypeAccess-Control-Allow-MethodsallowsGET, POST, PUT, PATCH, DELETE, OPTIONS- Any
OPTIONSrequest returns204 No Content
If the origin is not allowed, the response still completes, but it does not add CORS headers.
Error Envelope¶
All JSON errors use the same envelope.
{
"error": {
"code": "BAD_REQUEST",
"message": "Bad request",
"details": {
"path": "/api/v1/error"
}
}
}
Health And Probe Responses¶
{
"status": "ok"
}
{
"message": "pong"
}
Readiness Response¶
{
"status": "ok",
"postgres": "ok",
"redis": "ok"
}
When a dependency check fails, the handler returns 503 and marks the failing service as error.
Global Notes¶
GET /returns404in the backend only deployment.GET /files/pdfs/*serves generated PDF bytes from public object storage.- The API uses bearer tokens for protected routes.
- API requests and key user-flow actions are recorded in
activity_eventsfor audit/debug and usage analytics.