The HNU-TimeLetter project exposes a set of Next.js route handler APIs underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HNU-himematsu/HNU-TimeLetter/llms.txt
Use this file to discover all available pages before exploring further.
/api. All endpoints return JSON and are served from the same origin as the Next.js application. APIs are divided into three tiers: public endpoints that require no authentication, admin endpoints that require a valid admin_auth session cookie, and a webhook endpoint that uses Bearer token authentication for Feishu automation triggers.
Base URL
| Environment | Base URL |
|---|---|
| Local development | http://localhost:3000/api |
| Production | https://himematsu.cn/api |
/api. API version: v1.2.
All API responses use
Content-Type: application/json. There is no versioning prefix in the URL — the current version is reflected in the documentation and changelog only.Authentication Tiers
The API has three authentication tiers:| Tier | Mechanism | Who uses it |
|---|---|---|
| Public | No authentication required | Frontend pages, any client |
| Admin | admin_auth HttpOnly session cookie | Admin dashboard, management scripts |
| Webhook | Authorization: Bearer <token> header or ?secret= query param | Feishu Automation |
Endpoint Index
Public APIs — No Authentication Required
These endpoints are read-only and serve data from thesrc/data/*.json artifact files that are produced by sync jobs. No build or server restart is needed after a sync completes — the data is available immediately at runtime.
| Method | Path | Description |
|---|---|---|
GET | /api/content | Map locations and stories (homepage narrative data) |
GET | /api/contributors | Credits / contributors list |
GET | /api/creation-board | Creation board ideas and card headers |
GET | /api/announcement-config | Announcement popup configuration (public read) |
GET | /api/feishu-jsapi-signature | Generate a Feishu JSAPI signature for the current page URL |
Admin APIs — Cookie Authentication Required
All admin endpoints (exceptPOST /api/admin/login) require a valid admin_auth cookie. Requests without a valid cookie receive 401 Unauthorized.
| Method | Path | Description |
|---|---|---|
POST | /api/admin/login | Log in — sets admin_auth cookie (no cookie required) |
DELETE | /api/admin/login | Log out — clears admin_auth cookie |
GET | /api/admin/sync/config | Read scheduler configuration and runtime status |
PATCH | /api/admin/sync/config | Update scheduler configuration (hot-reloads immediately) |
GET | /api/admin/sync/jobs | List sync jobs (newest first) |
POST | /api/admin/sync/jobs | Create and enqueue a new sync job (async, returns 202) |
GET | /api/admin/sync/jobs/:jobId | Get full details of a specific sync job |
GET | /api/admin/sync/jobs/:jobId/logs | Get execution logs for a sync job (last 200 lines) |
GET | /api/admin/sync | Legacy compat: read sync status summary |
POST | /api/admin/sync | Legacy compat: trigger sync (action: "trigger") or update config (action: "update") |
GET | /api/admin/announcement | Read announcement configuration (admin) |
PATCH | /api/admin/announcement | Update announcement configuration |
Webhook
| Method | Path | Description |
|---|---|---|
POST | /api/admin/sync/webhook | Feishu Automation trigger — enqueues a sync job via Bearer token |
API Pages
Authentication
Session cookie login/logout, rate limiting, and webhook Bearer token setup.
Public: Content
GET /api/content — map locations and embedded story records.
Public: Contributors
GET /api/contributors — credits and contributor list.
Public: Creation Board
GET /api/creation-board — community creation ideas and card headers.
Admin: Sync Jobs
Create, list, inspect, and monitor Feishu data sync jobs.
Admin: Sync Config
Read and update the scheduler cron configuration.
Admin: Announcement
Read and update the admin-side announcement popup config.
Webhook
POST /api/admin/sync/webhook — Feishu Automation Bearer token trigger.
HTTP Status Codes
| Code | Status | Meaning |
|---|---|---|
200 | OK | Request succeeded. Used for queries, updates, and logout. |
202 | Accepted | Request accepted; processing is asynchronous. Returned when a sync job is successfully enqueued. |
400 | Bad Request | Invalid request parameters — e.g. unknown table key, malformed cron expression, empty required field. |
401 | Unauthorized | Missing or invalid admin_auth cookie, incorrect password, or invalid webhook Bearer token. |
404 | Not Found | The requested resource does not exist — e.g. job ID not found. |
409 | Conflict | A sync job is already running. The response body includes currentJobId. |
429 | Too Many Requests | Login rate limit exceeded (5 consecutive failures → 30-minute cooldown). The response body includes retryAfterSeconds: 1800. |
500 | Internal Server Error | Unexpected server-side failure — e.g. file read/write error or missing environment variable. |
Error Response Shape
All error responses return a JSON object with amessage field:
Data Freshness
Public APIs (/api/content, /api/contributors, /api/creation-board) read directly from the src/data/*.json artifact files at runtime using no-store caching. When an admin sync job completes, it writes updated JSON files to disk — the next request to the public API immediately returns the new data. No application rebuild or server restart is required.