The HNU-TimeLetter admin API uses two distinct authentication mechanisms: an HttpOnly session cookie (Documentation 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.
admin_auth) for all admin management endpoints, and a Bearer token for the Feishu Automation webhook. Public frontend data endpoints (/api/content, /api/contributors, /api/creation-board, /api/announcement-config, /api/feishu-jsapi-signature) require no authentication at all.
Session Cookie Authentication
Admin endpoints are protected by anadmin_auth cookie that is set on successful login and must be present on every subsequent request. The cookie is HttpOnly so it cannot be read by JavaScript — the browser (or curl’s cookie jar) handles it automatically.
The login endpoint itself —
POST /api/admin/login — does not require a cookie. It is the only admin-prefixed endpoint that is publicly accessible.Logging In
Send aPOST request to /api/admin/login with the admin password in the JSON body. The password is validated against the ADMIN_PASSWORD environment variable.
200 OK:
Set-Cookie header in the response that sets the admin_auth cookie. The -c cookies.txt flag tells curl to save the cookie to a file for use in subsequent requests.
Password incorrect — 401 Unauthorized:
Cookie Properties
| Property | Value |
|---|---|
| Name | admin_auth |
| HttpOnly | Yes — not accessible via document.cookie |
| Secure | Yes (production only) |
| SameSite | Lax |
| Max-Age | 7 days (604800 seconds) |
Making Authenticated Requests
Once you have theadmin_auth cookie, include it in every admin API call. Browsers do this automatically for same-origin requests. With curl, use the -b flag to read the saved cookie file:
admin_auth cookie receives a 401 Unauthorized response:
Logging Out
Send aDELETE request to /api/admin/login. The server clears the admin_auth cookie by setting Max-Age=0 in the response Set-Cookie header.
200 OK:
Login Rate Limiting
The login endpoint enforces a brute-force lockout to protect against password guessing.- After 5 consecutive failed login attempts, the endpoint enters a 30-minute cooldown for the offending client.
- During the cooldown window, all login attempts return
429 Too Many Requests:
- The lockout resets automatically once the 30-minute cooldown window expires. The
Retry-After: 1800HTTP header is also set on the response.
Successful logins do not count toward the failure counter. Only consecutive failed password attempts trigger the lockout.
Webhook Bearer Token Authentication
The Feishu Automation webhook endpoint —POST /api/admin/sync/webhook — does not use the session cookie. Instead, it uses a Bearer token to accommodate Feishu’s HTTP request automation action, which may not support custom cookie headers.
Token Source
The webhook secret is read from theSYNC_WEBHOOK_SECRET environment variable. If SYNC_WEBHOOK_SECRET is not set, the server falls back to ADMIN_PASSWORD.
Authentication Methods
The webhook accepts the token via either method — use whichever your automation platform supports:| Method | Example |
|---|---|
Authorization header | Authorization: Bearer <SYNC_WEBHOOK_SECRET> |
secret query parameter | ?secret=<SYNC_WEBHOOK_SECRET> |
Authorization header is recommended because the token does not appear in URL logs.
Webhook Call with Bearer Header (Recommended)
tables query parameter (comma-separated table keys):
tables is omitted, the webhook defaults to syncing creation_board.
Success response — 202 Accepted:
Webhook Call with Query Parameter
Use this form when your Feishu Automation action does not support custom request headers:401 Unauthorized:
Authentication Flow Summary
Log in to obtain a session cookie
POST /api/admin/login with { "password": "..." } in the request body. On success, the admin_auth cookie is set in the response.Include the cookie on every admin request
Browsers attach the cookie automatically. CLI tools like curl require the
-b cookies.txt flag. The cookie is valid for 7 days.Handle 401 responses
If a request returns
401 Unauthorized, the session has expired or was never established. Log in again to obtain a fresh cookie.