exerciseapi.dev

How do I cache an exercise library without hitting API rate limits?

Keep a copy of exerciseapi.dev data on each device for 24 hours. Your app can open the exercise list all day without another request.

Open the list from a saved copy

Exercise records rarely change. On first launch, fetch the exercises your app shows and save them on the device with a timestamp. If someone opens the app again within 24 hours, read the saved list without making a request.

Once the copy is 24 hours old, show it right away and fetch a fresh copy in the background. Offline, you may show a copy up to 30 days old. Remove older copies, even offline. Fetch a fresh copy before showing the data again. Use the same rule for /v1/categories, /v1/muscles and /v1/equipment. Those lists change even less often.

Count the pages one device needs

Say your app shows yoga. Divide 201 by your plan's page size and round up. That's how many requests one device needs to fetch the whole yoga list if it fits your plan. For Pilates, use 95 instead.

Free includes 100 requests a day. You can fetch the first 500 results of each query, with up to 20 results per request. Set limit=20 and start at offset=0. On Starter, set limit=50. On Pro or Business, set limit=100. If you leave out limit, it defaults to 20 on every plan.

If a page is empty or has fewer results than you asked for, you're done. Otherwise, add your limit to the offset and fetch the next page. On Free, stop before you request offset=500.

Budget for devices that need a fresh copy

We count requests per account. If a fill takes five requests, Free covers 20 fills that day, assuming no other requests. Refreshes count too, and Free allows 60 requests a minute.

Once you've used your 100 requests for the day on Free, the API returns a 429. Paid plans have no 500-result cutoff. Starter includes 1,000 requests a day, Pro includes 10,000 and Business includes 100,000. During a trial, requests stop at the daily limit. On a paid subscription, each extra request costs $0.002, and requests keep working up to 10 times your plan's included daily amount. If you want to avoid extra charges, stop at the included amount. Waiting for a 429 will let charges add up.

Store text and data on devices or on your server

A mobile app can keep its key on the device. For web apps, keep the key on your server. You can store text and data on devices or on your server for your app's own users. Refresh from an active account at least every 30 days. We recommend every 24 hours. Terms: https://exerciseapi.dev/terms

Try the first page of yoga exercises

Run this request with a free key in the X-API-Key header. No card required.

GET https://api.exerciseapi.dev/v1/exercises?category=yoga&limit=20&offset=0