Documentation Index
Fetch the complete documentation index at: https://mintlify.com/santiagonieto09/portafolio/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/public/sync is a protected server-side endpoint that invalidates the snapshot cache and immediately re-fetches all portfolio data from the GitHub API. It is designed to be called by a weekly cron job.
Authentication
The endpoint accepts two equivalent authentication methods — either is sufficient:| Method | Header |
|---|---|
| Preferred (cron jobs) | x-cron-secret: <secret> |
| Alternative | Authorization: Bearer <secret> |
CRON_SECRET environment variable. The comparison is performed with a timing-safe byte-by-byte XOR check (safeEqual) to prevent timing attacks — the loop always runs to completion regardless of where a mismatch occurs.
Rate Limiting
A built-in cooldown prevents the endpoint from being called more than once every 10 minutes. The in-processlastForcedSyncAt timestamp is checked on every request. If the minimum interval has not elapsed, the endpoint returns 429 Too Many Requests with {"ok": false, "error": "too_soon"} without touching the cache.
Request
Response Codes
200 OK
Sync completed successfully. The cache was invalidated and a fresh snapshot was fetched from GitHub.Always
true on a successful sync.ISO 8601 timestamp of when the new snapshot was written to cache. Sourced from
snapshot.stats.lastSyncedAt.Total number of non-forked repositories included in the synced snapshot.
Number of repositories that have at least one published GitHub release.
401 Unauthorized
Thex-cron-secret or Authorization: Bearer value does not match CRON_SECRET, or no credential was provided.
429 Too Many Requests
The endpoint was called before the 10-minute cooldown elapsed since the last successful sync.503 Service Unavailable
TheCRON_SECRET environment variable is not configured.
GitHub Actions Cron Example
The recommended way to trigger a weekly sync is a GitHub Actions workflow scheduled withcron. This lets you use repository secrets for both the portfolio URL and the
shared secret.
.github/workflows/sync.yml