exerciseapi.dev

How do I get random exercises from an API for a surprise me workout?

Get up to five random exercises from exerciseapi.dev, then make your “Surprise me” button work with one saved list or a fresh request on each tap.

Ask for five exercises that fit the workout

Add random=true to GET /v1/exercises with the filters for your workout. Our catalog has 2,200 exercises across 12 disciplines. If someone wants a beginner strength workout, this request narrows the list first, then shuffles the matches and returns five.

GET https://api.exerciseapi.dev/v1/exercises?category=strength&level=beginner&random=true&limit=5

We ran that request twice on the live API on December 2, 2026. The first five included Barbell_Squat and Plank. The next five included Cable_Reverse_Crunch and Hip_Flexion_with_Band. No exercise appeared in both lists. Both replies showed a total of 453 because that many exercises matched the filters.

Why the same five can show up twice

In our Swift program on a Mac, we made the same call again one second later and got the same five exercises in the same order. The reply carries Cache-Control: public, max-age=3600. That lets a browser, a phone’s network library or a hosting service reuse the answer for that URL for an hour.

There’s another reason the names might look familiar. When we added equipment=kettlebell and muscle=chest to the request above, only two exercises matched. We got both on each call. Their order happened to change, but with that pool the button has just two exercises to offer.

Check how many exercises are in data and ask the person to loosen a filter if it’s empty. If there’s just one, show it because another call brings the same one back.

Shuffle one page for several taps

To save requests, fetch one page for the filters the person chose. Save it with the time you fetched it. Shuffle the page in your app and work through it one exercise per tap. That way the person sees every pick on the page before they see one twice. Fetch a new page once the saved one is 24 hours old. Delete saved pages when they reach 30 days, even for filters nobody picks again.

Ask for as many picks as you need in that first call, up to 20 on the free plan. A single page has no repeats. When we asked for 20 at offset=0 and another 20 at offset=20, three exercises appeared on both pages. Each call shuffles again, so page two can repeat exercises or skip them.

Get a fresh shuffle on each tap

If you want each tap to draw from all the matches, make one call per tap and turn off caching for that request. A fresh shuffle can repeat an earlier pick. In fetch, use cache: "no-store". In Swift, we got a new list with .reloadIgnoringLocalCacheData. For a web app, have your own button endpoint answer with Cache-Control: no-store. Otherwise a browser can reuse that endpoint’s answer. Each tap that reaches the API uses one of the day’s requests.

Leave If-None-Match off this call. The ETag stays the same between shuffles. When we sent it back, we got a 304 response with no new list for the button.

Show the exercise someone picked

Each pick comes with a name and instructions your app can show.

If the button promises a demo, add hasVideo=true to the request.

333 of our 2,200 exercises have a video. On December 2, the reply’s total was 130 with the beginner strength filters and hasVideo=true.

Try it with a free key

Get a free key from exerciseapi.dev and run the request above with your key in the X-API-Key header. For a web app, send it from your server so the key stays there. The free tier includes 100 requests a day and up to 20 results per request. No card required.