Everyday lifeFitness
Exercise Database API: 870+ Exercises and AI Workout Plans in Python
Exercise database API tutorial: search 870+ exercises by muscle and equipment in Python, find swaps, and generate AI workout plans with sets and reps.
Every fitness app reaches the same point. The timer, the log and the charts are done, and now the app needs content: a library of exercises with the muscles they train, the equipment they need, clear instructions and a picture, then a "build my plan" button that does not suggest barbell squats to someone training at home with two dumbbells.
An exercise database API covers the first half, and a workout plan generator the second. This tutorial uses the Exercise Database & AI Workout Planner for both: search 876 exercises from Python, look one up, find substitutes when the equipment is missing, and generate a four-week program where every exercise comes from the database, with sets, reps, rest and a week-by-week progression. All the JSON below comes from real calls.
What a usable exercise database needs
A list of exercise names is not enough for an app. Each record needs fields a filter screen and a coaching screen can use:
| Field | Why the app needs it | Values in this database |
|---|---|---|
| Primary and secondary muscles | Muscle filters, body maps, weekly balance | 17 muscles, from abdominals to triceps |
| Equipment | "What can I do at home?" | 12 types: body only, dumbbell, kettlebells, bands... |
| Level | Hiding expert lifts from beginners | beginner (525), intermediate (294), expert (57) |
| Category | Strength day vs mobility day | strength, stretching, plyometrics, cardio... |
| Force and mechanic | Push/pull splits, compound lifts first | push, pull, static; compound, isolation |
| Instructions and photos | The exercise screen itself | Step-by-step text and a start and end photo |
The data comes from free-exercise-db, an open dataset published under the Unlicense, a public-domain dedication. That matters for an app: you can store what you fetch instead of calling the API every time a user opens an exercise. The API pins a specific commit of the dataset, fixes a few inconsistencies at load time (77 exercises without equipment are marked body only, pull-ups and dips are known to need a bar), and adds search, alternatives and the planner on top.
Search the exercise database API from Python
GET /v1/workout/exercises combines a text query with filters. The text search understands how people type in a gym: "pushup", "push ups" and "Pushups" all match, and abbreviations such as "DB" for dumbbell work. The examples use Python and requests; the API reference lists every parameter.
import requests
HOST = "exercise-database-ai-workout-planner-fitness.p.rapidapi.com"
API = f"https://{HOST}"
HEADERS = {"x-rapidapi-key": "YOUR_API_KEY", "x-rapidapi-host": HOST}
response = requests.get(
f"{API}/v1/workout/exercises",
headers=HEADERS,
params={"q": "DB row", "limit": 3, "include_instructions": "false"},
timeout=30,
)
response.raise_for_status()
for exercise in response.json()["results"]:
print(exercise["id"], exercise["equipment"], exercise["primary_muscles"])
The real response, with the second and third results cut:
{
"total": 6,
"count": 3,
"offset": 0,
"limit": 3,
"results": [
{
"id": "Dumbbell_Incline_Row",
"name": "Dumbbell Incline Row",
"category": "strength",
"level": "beginner",
"force": "pull",
"mechanic": "compound",
"equipment": "dumbbell",
"primary_muscles": ["middle back"],
"secondary_muscles": ["biceps", "forearms", "lats", "shoulders"],
"images": [
"https://cdn.jsdelivr.net/gh/yuhonas/free-exercise-db@f00c92c7dcf1216a928a52c3706c7ce8e2f71ed5/exercises/Dumbbell_Incline_Row/0.jpg",
"https://cdn.jsdelivr.net/gh/yuhonas/free-exercise-db@f00c92c7dcf1216a928a52c3706c7ce8e2f71ed5/exercises/Dumbbell_Incline_Row/1.jpg"
]
},
{ "id": "One-Arm_Dumbbell_Row", "...": "..." },
{ "id": "Dumbbell_One-Arm_Upright_Row", "...": "..." }
]
}
"DB row" found the dumbbell rows, standard exercises first: the One-Arm Dumbbell Row next, then the upright row. include_instructions=false keeps list screens light. Each call costs 1 credit.
Filter by muscle, equipment and level
Filters take comma-separated values. muscle also accepts groups: back, legs, arms, core, upper body and lower body expand to their muscles. A home-workout screen for beginners who want to train their glutes:
params = {
"muscle": "glutes",
"equipment": "dumbbell,body only",
"level": "beginner",
"limit": 20,
}
glutes = requests.get(
f"{API}/v1/workout/exercises", headers=HEADERS, params=params, timeout=30
).json()
print(glutes["total"], [e["name"] for e in glutes["results"]])
That real call returned "total": 9, starting with Ankle On The Knee (a stretch), Butt Lift (Bridge) and Flutter Kicks. Without q, results are alphabetical, so add category=strength if the screen should skip stretches. To build the filter menus themselves, GET /v1/workout/filters returns every value with its number of exercises, from quadriceps (148) to neck (8), and the muscle groups with what they contain.
Look up one exercise
GET /v1/workout/exercises/{exercise_id} returns the full record. The id is case-insensitive, and the exact name works too. The real response for Goblet_Squat:
{
"id": "Goblet_Squat",
"name": "Goblet Squat",
"category": "strength",
"level": "beginner",
"force": "push",
"mechanic": "compound",
"equipment": "kettlebells",
"primary_muscles": ["quadriceps"],
"secondary_muscles": ["calves", "glutes", "hamstrings", "shoulders"],
"instructions": [
"Stand holding a light kettlebell by the horns close to your chest. This will be your starting position.",
"Squat down between your legs until your hamstrings are on your calves. Keep your chest and head up and your back straight.",
"..."
],
"images": [
"https://cdn.jsdelivr.net/gh/yuhonas/free-exercise-db@f00c92c7dcf1216a928a52c3706c7ce8e2f71ed5/exercises/Goblet_Squat/0.jpg",
"https://cdn.jsdelivr.net/gh/yuhonas/free-exercise-db@f00c92c7dcf1216a928a52c3706c7ce8e2f71ed5/exercises/Goblet_Squat/1.jpg"
]
}
The two photos are the start and end positions, served from the jsDelivr CDN at the pinned commit, so the URLs do not change under your app. An unknown id returns 404 exercise_not_found, unbilled.
Exercise alternatives when the equipment is missing
The squat rack is taken, or the user trains at home. GET /v1/workout/exercises/{exercise_id}/alternatives returns exercises with the same primary muscles and movement family, filtered by the equipment the user has, each with a similarity score from 0 to 100 built from shared muscles, push or pull, mechanic, category and level.
alternatives = requests.get(
f"{API}/v1/workout/exercises/Barbell_Squat/alternatives",
headers=HEADERS,
params={"equipment": "dumbbell,body only", "limit": 3},
timeout=30,
).json()
for alt in alternatives["alternatives"]:
print(alt["similarity"], alt["name"], alt["equipment"])
The real call printed:
100 Dumbbell Squat dumbbell
98 Dumbbell Lunges dumbbell
98 Bodyweight Walking Lunge body only
Each alternative comes as a full record with instructions and photos, so a "swap" button needs no second call. other_equipment=true returns only exercises that use different equipment.
How a good workout plan is structured
Before calling the generator, it helps to know what a sound program contains, because that is what you will display and what users will judge.
- Weekly volume. The WHO physical activity guidelines recommend that adults do muscle-strengthening activities involving all major muscle groups on two or more days a week, on top of 150 to 300 minutes of moderate aerobic activity. A 3-day full-body plan covers the first part.
- Rep ranges follow the goal. Heavy sets of 1 to 6 reps for strength, roughly 6 to 15 for muscle gain, 15 and more for muscular endurance. Rest follows: longer for heavy compound lifts, shorter for fat-loss circuits.
- Progressive overload. Each week asks slightly more than the last: a set more, a rep more, or a little more weight.
- RPE. The Rating of Perceived Exertion scores a set from 1 to 10; RPE 8 means about two more reps were possible. It lets one plan fit users of different strength.
- Deload. Every few weeks, a lighter week lets fatigue drop before the next block.
- Swaps. People skip exercises they cannot do. A plan that offers a substitute keeps them on it.
Generate an AI workout plan
POST /v1/workout/plan takes the goal (muscle_gain, strength, fat_loss, general_fitness, endurance, mobility, athletic), the level, the equipment, 1 to 7 days a week, 15 to 120 minutes a session, 1 to 12 weeks, optional muscles to prioritise, areas to protect (knees, lower_back, shoulders, wrists, elbows, neck, hips, ankles) and the language of the texts. Every field is optional.
The design choice that matters: the model never writes exercise names. The service draws a numbered catalogue from the database (filtered by equipment, level, goal and the areas to protect), the model answers with numbers, and the service maps them back to database ids, drops anything it did not offer, clamps sets and rest, and writes the weeks itself. A beginner with dumbbells and a sensitive lower back:
profile = {
"goal": "fat_loss",
"level": "beginner",
"equipment": ["dumbbell"],
"days_per_week": 3,
"minutes_per_session": 30,
"weeks": 4,
"limitations": ["lower_back"],
"language": "English",
}
response = requests.post(
f"{API}/v1/workout/plan", headers=HEADERS, json=profile, timeout=60
)
response.raise_for_status()
plan = response.json()
print(plan["plan"]["title"], plan["credits"], plan["checks"])
The real response took 9.8 seconds. Here are the plan header, the first session with two exercises in full, and the rest shortened:
{
"plan": {
"title": "Beginner Fat Loss Circuit",
"summary": "A 3-day full-body circuit designed for fat loss and muscle maintenance, focusing on safe, supported movements.",
"goal": "fat_loss",
"level": "beginner",
"days_per_week": 3,
"minutes_per_session": 30,
"weeks": 4,
"split": "Full Body, 3 days per week",
"equipment": ["body only", "dumbbell"],
"focus": [],
"limitations": ["lower_back"]
},
"sessions": [
{
"day": 1,
"name": "Full Body Circuit A",
"focus": "Compound movement and core stability",
"warmup": "Perform 5 minutes of light marching in place and arm circles.",
"exercises": [
{
"exercise_id": "Bodyweight_Squat",
"name": "Bodyweight Squat",
"sets": 3,
"reps": "12-15",
"rest_seconds": 45,
"note": "Keep chest up and weight in heels.",
"primary_muscles": ["quadriceps"],
"equipment": "body only",
"image": "https://cdn.jsdelivr.net/gh/yuhonas/free-exercise-db@f00c92c7dcf1216a928a52c3706c7ce8e2f71ed5/exercises/Bodyweight_Squat/0.jpg",
"swaps": [
{ "exercise_id": "Split_Squat_with_Dumbbells", "name": "Split Squat with Dumbbells", "equipment": "dumbbell" },
{ "exercise_id": "Dumbbell_Lunges", "name": "Dumbbell Lunges", "equipment": "dumbbell" }
]
},
{ "...": "Pushups 3 x 10-12, Plank 3 x 30 s" },
{
"exercise_id": "Trail_Running_Walking",
"name": "Trail Running/Walking",
"sets": 1,
"reps": "5 min",
"rest_seconds": 0,
"note": "Maintain a steady, moderate pace.",
"...": "..."
}
],
"estimated_minutes": 30
},
{ "...": "Day 2, 29 minutes: Dumbbell Lunges, Standing Dumbbell Press, Single Leg Glute Bridge, Trail Running/Walking" },
{ "...": "Day 3, 30 minutes: Plie Dumbbell Squat, Incline Push-Up, Reverse Crunch, Trail Running/Walking" }
],
"progression": [
{ "week": 1, "theme": "Foundation", "sets_change": 0, "rep_change": 0, "intensity": "RPE 6" },
{ "week": 2, "theme": "Volume", "sets_change": 0, "rep_change": 0, "intensity": "RPE 7", "note": "... No extra sets this week: they would not fit in 30 minutes, so progress with reps, load or effort." },
{ "week": 3, "theme": "Intensity", "sets_change": 1, "rep_change": -1, "intensity": "RPE 8", "note": "Focus on controlled, harder reps. Sets: +1 on 1 of 9 exercises only; the others keep their sets so each session stays within 30 minutes." },
{ "week": 4, "theme": "Deload", "sets_change": -1, "rep_change": 1, "intensity": "RPE 5", "note": "..." }
],
"safety": {
"notes": [
"To protect the lower back, avoid spinal loading; use supported exercises and maintain core tension.",
"..."
],
"disclaimer": "General fitness guidance for healthy adults, not medical advice. ..."
},
"checks": { "exercises_validated": 12, "removed": 0 },
"credits": 20
}
Read it as a coach would. The lower back is protected by what is missing: no deadlifts, good mornings or barbell work; the squats and lunges are bodyweight or light dumbbells. Each session is a short circuit with 45-second rests and a 5-minute walk. checks says 12 exercises were validated against the database and none were removed.
estimated_minutes is computed by the API from sets, reps, rest and the 5-minute warm-up and cool-down, not taken from the model, and the sessions fit the time asked: here 30, 29 and 30 minutes for a 30-minute target. Exercises that need a bench or a backrest, by their name or their instructions, are left out when the user has not declared one: the press here is standing, and the incline push-up uses any step or table. Plans vary between calls: store the accepted one.
Show the plan as a calendar
The weeks array repeats every session with that week's sets and reps already applied, so the app does not recompute the progression:
for week in plan["weeks"]:
print(f"Week {week['week']}: {week['theme']} ({week['intensity']})")
for session in week["sessions"]:
line = ", ".join(
f"{e['name']} {e['sets']}x{e['reps']}" for e in session["exercises"]
)
print(f" Day {session['day']}: {line}")
In the real response, week 1's first session reads Bodyweight Squat 3x12-15, Pushups 3x10-12, Plank 3x30 s, Trail Running/Walking 1x5 min. Week 3 applies rep_change: -1 everywhere (11-14, 9-11) but its extra set only where the 30 minutes allow it, and the week notes say so in numbers written by the API: only the standing press on day 2 goes from 2 to 3 sets, and the timed walk never grows. Show sets from weeks and the week note.
What a plan costs in credits
A plan costs 20 credits per 25 "slots", where slots are the exercises in a week plus the number of weeks. This one has 12 exercises and 4 weeks, 16 slots, so 20 credits; the largest possible plan, 7 days of 90 minutes over 12 weeks, is 80. The credits field in the answer says what was billed. A plan the AI fails to complete returns 503 ai_error and is not billed.
Production notes
- Cache the database. Exercises change only when the API moves to a new dataset commit. Fetch the records your app shows once and store them; the open licence allows it.
- Validate input before the call. Filters with unknown values return
400 invalid_filterwith the allowed list, unbilled. A real call withequipment=treadmillanswered:"Unknown equipment 'treadmill'. Allowed: body only, barbell, dumbbell, kettlebells, cable, machine, bands, medicine ball, exercise ball, foam roll, e-z curl bar, other". - Handle empty searches.
q=burpeereturns"total": 0: the dataset has no burpee. Fall back to a category or muscle search rather than an empty screen. - Retry 503 once.
ai_errorandcapacity_exhaustedare unbilled. Plans take 3 to 15 seconds: show progress. - Translate the plan, not the exercises.
"language": "French"translates titles, notes, guidelines and safety notes; exercise names and instructions stay in English.
What it costs
Exercise lookups cost 1 credit; plans cost 20 to 80. Failed calls (4xx, 5xx) use no credits.
| Plan | Price per month | Credits | In practice |
|---|---|---|---|
| BASIC | Free | 40 per day | 40 lookups or 2 plans a day; plans up to 20 credits |
| PRO | $4.99 | 8,000 | about $0.0006 per lookup, $0.0125 per plan |
| ULTRA | $14.99 | 25,000 | about $0.0006 per lookup, $0.012 per plan |
| MEGA | $49.99 | 80,000 | about $0.0006 per lookup, $0.0125 per plan |
Beyond the quota, paid plans continue at $0.007 per credit. In our market survey of RapidAPI, popular exercise databases charged $0.001 to $0.0056 per call, and an AI workout planner $0.02 per plan.
What the exercise database API does not do
- No medical or injury assessment. Areas to protect remove the obvious risky exercises by name (jumps for knees, overhead presses for shoulders, heavy spinal loading for the lower back) and guide the model. That is not rehabilitation, and every plan says so.
- No video or animated GIFs. Each exercise has two still photos and written steps.
- Not every exercise exists. 876 records, no burpee. The planner only uses what is in the database.
- English exercise data. Names and instructions are in English; only the plan's own texts follow
language. - No tracking or adaptation. The API does not store users, logs or weights. To adjust a plan from a user's results, send a new request with the new level or goal.
- No nutrition. For calories and macros, the Nutrition Analysis API reads a meal described in plain words; the companion article is the nutrition API tutorial.
Frequently asked questions
Is there a free exercise database API?
Yes. The BASIC plan is free with 40 credits a day: 40 exercise lookups or two AI plans. The underlying data, free-exercise-db, is itself public domain, so what you fetch can be stored in your app.
Can the AI invent exercises that do not exist?
No. The model chooses from a numbered list drawn from the database and never writes names. The service maps its answers back to database ids and removes anything it did not offer; checks.removed counts those removals, and it was 0 in all 26 test plans run before launch.
Can I use the exercise photos in my app?
The photos are part of the free-exercise-db dataset, published under the Unlicense. The URLs point to the project's files on the jsDelivr CDN, pinned to one commit. You can also download them and serve them yourself.
How do I generate a workout plan for home training without equipment?
Send "equipment": ["body only"] (or omit the field: an empty request gives a 3-day, 45-minute bodyweight plan for a beginner). Pull-ups and dips are left out unless the user declares a bar, cable or machine.
How long does a plan take to generate?
3 to 15 seconds depending on its size; the plan in this article took 9.8 seconds. Exercise searches and lookups answer in about a second.
Get started
Exercise Database & AI Workout Planner API
870+ exercises with muscles, steps and photos, plus AI weekly workout plans built from them.
- Fitness
- Exercise Database
- Workout Planner
- Python
- Health Tech



