Skip to content

Expire stale pending AI suggestions (GET)

GET
/cron/expire-ai-suggestions
curl --request GET \
--url https://example.com/api/cron/expire-ai-suggestions

Flips ai_suggestions rows still pending past the 7-day TTL to expired. Bounded to one page per run — re-run while truncated is true. Protected by CRON_SECRET via the x-cron-secret header only (no token query parameter).

TTL sweep result

Media type application/json
object
ok
required

False when the sweep hit a database error; error then carries the message.

boolean
expired
required

Rows actually flipped from pending to expired by this run.

integer
truncated
required

True when a full page was selected — more stale suggestions remain; re-run.

boolean
error

Database error message; present only when ok is false.

string

Missing or invalid CRON_SECRET