For developers

Training Lab API

One POST request returns a full week of training built around your user's goals, schedule, equipment and injuries. It runs on the same engine as the Training Lab app, with the same checks.

Response (excerpt)
{
  "id": "…",
  "name": "Push, pull, legs with easy runs",
  "summary": "…",
  "warnings": ["…"],
  "weekly_schedule": [
    {
      "day": "mon",
      "activity_type": "gym",
      "focus": "Push: chest, shoulders, triceps",
      "exercises": [{
        "set_number": 1,
        "exercises": [{
          "name": "Barbell Bench Press - Medium Grip",
          "sets": 4,
          "target": { "type": "reps", "reps": "4 - 6" },
          "load_guidance": "…",
          "exercise_reference": {
            "images": ["https://…/0.jpg", "…"],
            "equipment": "barbell",
            "primary_muscles": ["chest"],
            "secondary_muscles": ["shoulders", "triceps"]
          }
        }]
      }]
    }
  ]
}

What comes back

  • A plan with a name, summary, warnings and a day-by-day schedule: sets, reps, load guidance and coaching notes for every exercise.
  • Exercise data wherever the exercise is in our library: photos as absolute URLs, target muscles, equipment and step-by-step instructions.
  • Text in the language you ask for. Pass any language tag as locale. Exercise names stay in English so they match the library.
  • Plans stay on your account after generation: read one again, translate it into another language, or swap exercises in it with the same checks. The docs list what each costs.

Checked before it reaches you

  • Schedule: exactly as many training days per activity as you asked for, each on one of the days you allow. Leftover days stay rest days.
  • Equipment: every exercise is checked against the gear your user has. The plan gets one corrected retry, and anything still off comes back as a warning.
  • Input: every request is validated against the schema, including an 18+ age check, and rejected with field-level errors if it fails.
  • Billing: tokens are taken only after a plan passes validation. A failed generation costs nothing.

Limits and errors

  • Up to 3 plans generate at once per account, and 600 requests an hour. Limits are per account, so extra keys don't raise them.
  • Your account email has to be verified before the first generation.
  • Every error has a status and a code: 400 invalid input, 401 missing or revoked key, 402 not enough tokens, 403 email not verified, 429 a limit (wait Retry-After), 502 generation failed, 503 busy or paused. The docs list every code.

A complete request

This passes validation as written. Swap in your key and it generates a real plan, which costs 5 tokens.

bash
curl -X POST https://training-lab.app/api/v1/generate \
  -H "Authorization: Bearer tlab_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "user_profile": {
    "date_of_birth": "1992-04-18",
    "sex": "female",
    "height_cm": 168,
    "weight_kg": 63,
    "muscle_mass_level": "fit",
    "experience": "few_years"
  },
  "primary_goal": "build_muscle",
  "secondary_goal": "increase_mobility",
  "activities": ["gym", "running"],
  "schedule": {
    "days_selected": ["mon", "tue", "thu", "fri", "sat"],
    "user_adjusted_split": { "gym": 3, "running": 2 }
  },
  "injuries": [
    {
      "area": "left knee",
      "occurred": "2023, while running",
      "current_impact": "Aches after runs longer than 8 km. Squats are fine."
    }
  ],
  "preferences": {
    "training_length": { "gym": "up_to_60_minutes", "running": "up_to_40_minutes" },
    "warmups": "yes",
    "gear_type": ["free_weights", "machine"],
    "gym_split": "push_pull_legs",
    "type_of_sets": ["single_exercises", "supersets"],
    "rest_between_sets": "2_minutes",
    "rest_between_exercises": "2_minutes",
    "exercise_complexity": ["beginner", "intermediate"]
  },
  "notes": "Keep the Saturday run easy.",
  "locale": "en"
}'

How billing works

Your account has one token balance, shared with the app. Each plan costs 5 tokens. Buy packs from your dashboard. Developer accounts start at zero tokens.

5

tokens per plan

3

plans at once, per account

$0.50

per plan with the biggest pack

See all packs

Get your API key

Create a developer account, buy a pack, and send the request above.