API Reference
The Running Days API is a RESTful service built with Fastify 5. All endpoints return JSON and use standard HTTP status codes.
Base URL
text
https://api.running-days.app/api/v1For local development:
text
http://localhost:3000/api/v1Authentication
All authenticated endpoints require a valid JWT token. See Authentication for details on obtaining tokens.
http
Authorization: Bearer <access_token>Or via httpOnly cookies (automatically set by the auth flow).
API Sections
| Section | Description |
|---|---|
| Authentication | Apple Sign-In, sessions, token refresh |
| Goals | Year-long running day targets |
| Webhooks | Health Auto Export integration |
Common Response Formats
Success Response
json
{
"success": true,
"data": { ... }
}Error Response
json
{
"statusCode": 400,
"error": "Bad Request",
"message": "Validation failed"
}Rate Limiting
API requests are rate limited per user:
| Endpoint Type | Limit |
|---|---|
| Auth endpoints | 10 req/min |
| Read endpoints | 100 req/min |
| Write endpoints | 30 req/min |
Rate limit headers are included in responses:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Unix timestamp when limit resets
OpenAPI Documentation
Interactive API documentation is available at:
text
GET /api/v1/docsError Codes
| Status | Meaning |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Missing or invalid token |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource doesnβt exist |
| 423 | Locked - Account locked due to failed attempts |
| 429 | Too Many Requests - Rate limited |
| 500 | Internal Server Error |