Design layered resource controls for an expensive API export endpoint.
POST /events/export lets tenant admins export arbitrary date ranges synchronously. Request validation -> cost estimate -> tenant budget -> async execution -> dedupe and monitoring A route-level request limit is not enough when each allowed request can start minutes of database and queue work. Bound the request Allow date ranges up to 31 days, require filters, and reject unsupported formats before starting the query. Input limits prevent impossible or accidental work from entering the expensive path. Estimate cost Run a cheap count estimate and reject or split jobs above 500k rows. The system should know approximate cost before allocating long-running…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in