Skip to main content
The Training Plans API gives coaches and developers the tools to build structured, multi-week training programs and assign them to athletes. Plans are made up of workouts drawn from your organization’s workout library. Workouts contain structured content blocks that define each segment’s type, pace zone, distance, and duration.

List training plans


GET /api/v1/training/plans
Returns training plans visible to the authenticated user. This includes the user’s own plans as well as public and org-level plans from their organization.
This endpoint requires the training_plan_library feature to be enabled for the authenticated user’s account.

Query parameters

type
string
Filter by plan type. One of: run, bike, swim, strength, custom.
level
string
Filter by difficulty level. One of: basic, intermediate, advanced.
org_id
string
Organization ID to include public org-level plans. Defaults to the authenticated user’s organization.
visibility
string
Filter by visibility. One of: public, org, private.
owner_id
string
Return plans owned by this user ID. Defaults to the authenticated user.
Case-insensitive substring match against plan name or description.
limit
integer
Maximum results per page. Must be between 1 and 50. Enables cursor-based pagination when provided.
cursor
string
Opaque base64-encoded cursor for fetching the next page. Returned in paginated responses.
summary
boolean
Set to true to return lightweight list items without plan content.

Example request

curl https://app.nexrex.ai/api/v1/training/plans \
  -H "Authorization: Bearer <token>" \
  -G \
  --data-urlencode "type=run" \
  --data-urlencode "level=intermediate" \
  --data-urlencode "limit=20"

Response

Returns an array of training plan objects, or a paginated response object when limit is provided.
training_plan_id
string
Unique identifier for the training plan.
training_plan_name
string
Name of the training plan.
training_plan_description
string
Description of the training plan.
type
string
Sport type: run, bike, swim, strength, or custom.
level
string
Difficulty: basic, intermediate, or advanced.
duration_in_weeks
integer
Total number of weeks in the plan.
visibility
string
Visibility level: public, org, private, or system.
org_id
string
ID of the organization that owns the plan.
creator_name
string
Display name of the coach who created the plan.
image_url
string
URL to the plan’s cover image.
created_at
integer
Creation timestamp in epoch milliseconds.
updated_at
integer
Last-updated timestamp in epoch milliseconds.

Create a training plan


POST /api/v1/training/plans
Creates a new training plan template. The plan is owned by the authenticated user and optionally associated with their organization.

Request body

training_plan_name
string
required
Name of the training plan.
training_plan_description
string
required
Description of the training plan.
type
string
required
Sport type. One of: run, bike, swim, strength, custom.
level
string
required
Difficulty level. One of: basic, intermediate, advanced.
duration_in_weeks
integer
required
Number of weeks the plan spans.
visibility
string
required
Who can see this plan. One of: public, org, private.
user_id
string
required
ID of the user creating the plan.
org_id
string
Organization to associate this plan with. If not provided, the user’s organization is used automatically.
coach_id
string
ID of the coach associated with the plan.
image_url
string
URL for the plan’s cover image.
training_plan_prefer_day
object
Preferred workout days. An object with day-of-week keys (Monday through Sunday) and values of Rest or a workout type string.
content
array
Array of workout objects to include in the plan. Workouts sourced from the library are tracked for template sync.

Example request

curl -X POST https://app.nexrex.ai/api/v1/training/plans \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "training_plan_name": "12-Week Half Marathon",
    "training_plan_description": "A progressive build for first-time half marathoners.",
    "type": "run",
    "level": "basic",
    "duration_in_weeks": 12,
    "visibility": "public",
    "user_id": "usr_abc123"
  }'

Response

Returns 201 Created.
training_plan_id
string
Unique identifier of the created training plan.
message
string
Training plan created successfully.

Get a training plan


GET /api/v1/training/plans/{plan_id}
Returns the full detail of a single training plan, including its content.

Path parameters

plan_id
string
required
The unique identifier of the training plan.

Example request

curl https://app.nexrex.ai/api/v1/training/plans/plan_abc123 \
  -H "Authorization: Bearer <token>"

Response

Returns the full training plan object. All timestamp fields are returned as epoch milliseconds.
training_plan_id
string
Unique identifier for the plan.
training_plan_name
string
Name of the plan.
content
array
Array of workout items assigned to the plan.
weekly_info
object
Per-week summary including calculated mileage and coaching notes.

Update a training plan


PUT /api/v1/training/plans/{plan_id}
Updates an existing training plan template. All fields are optional; only the fields provided are changed.

Path parameters

plan_id
string
required
The unique identifier of the training plan to update.

Request body

training_plan_name
string
Updated plan name.
training_plan_description
string
Updated plan description.
duration_in_weeks
integer
Updated plan duration in weeks.
level
string
Updated difficulty level. One of: basic, intermediate, advanced.
type
string
Updated sport type. One of: run, bike, swim, strength, custom.
visibility
string
Updated visibility. One of: public, org, private. Permission rules apply based on coach role.
content
array
Updated array of workout items for the plan.

Example request

curl -X PUT https://app.nexrex.ai/api/v1/training/plans/plan_abc123 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "training_plan_name": "12-Week Half Marathon — Updated",
    "level": "intermediate"
  }'

Response

training_plan_id
string
ID of the updated training plan.
status
string
ok on success.

Delete a training plan


DELETE /api/v1/training/plans/{plan_id}
Permanently deletes a training plan template.

Path parameters

plan_id
string
required
The unique identifier of the training plan to delete.

Example request

curl -X DELETE https://app.nexrex.ai/api/v1/training/plans/plan_abc123 \
  -H "Authorization: Bearer <token>"

Response

training_plan_id
string
ID of the deleted training plan.
status
string
ok on success.

List workouts


GET /api/v1/training/workouts
Returns the authenticated user’s workout library plus shared workouts from their organization.

Query parameters

workout_type
string
Filter by workout type. One of: run, bike, swim, hike, walk, strength.
workout_sub_type
string
Filter by workout sub-type. Examples: easy-run, tempo-run, interval-run, long-run.
org_id
string
Organization ID to include shared org workouts. Defaults to the user’s organization.
visibility
string
Filter by visibility. One of: public, org, private.

Example request

curl https://app.nexrex.ai/api/v1/training/workouts \
  -H "Authorization: Bearer <token>" \
  -G \
  --data-urlencode "workout_type=run" \
  --data-urlencode "workout_sub_type=tempo-run"

Response

Returns an array of workout objects. All timestamps are in epoch milliseconds.
workout_id
string
Unique identifier for the workout.
workout_name
string
Name of the workout.
workout_type
string
Sport type: run, bike, swim, hike, walk, or strength.
workout_sub_type
string
Sub-type such as easy-run, tempo-run, interval-run, or long-run.
target_distance_in_meters
integer
Target distance for the workout in meters.
target_duration_in_seconds
integer
Target duration for the workout in seconds.
content_blocks
array
Structured blocks defining warm-up, main set, and cool-down segments.
visibility
string
Visibility level: public, org, private, or system.
creator_name
string
Display name of the coach who created the workout.

Create a workout


POST /api/v1/training/workouts
Creates a new workout in the library. The workout is associated with the creator’s organization and can be added to training plans.

Request body

workout_name
string
required
Name of the workout.
workout_type
string
required
Sport type. One of: run, bike, swim, hike, walk, strength.
workout_sub_type
string
required
Sub-type. One of: easy-run, tempo-run, interval-run, long-run.
user_id
string
required
ID of the user creating the workout.
content_blocks
array
required
Array of content block objects defining the workout structure. See content block fields below.
target_duration_in_seconds
integer
Target total duration in seconds. Defaults to 0.
target_distance_in_meters
integer
Target total distance in meters. Defaults to 0.
visibility
string
Who can access this workout. One of: public, org, private.
description
string
Freeform description of the workout.

Content block fields

Each object in content_blocks defines one segment of the workout.
content_blocks[].type
string
required
Block type. One of: warm-up, run, interval, recovery-run, cool-down.
content_blocks[].block_name
string
Optional label for this block.
content_blocks[].block_distance_in_meters
integer
Target distance for the block in meters.
content_blocks[].block_duration_in_seconds
integer
Target duration for the block in seconds.
content_blocks[].block_pace
string
Pace zone for this block. One of: z1, z2, z3, z4, z5.
content_blocks[].block_length_target
string
Whether to measure block length by distance or duration.
content_blocks[].block_intensity_target
string
How intensity is measured. One of: pace, heartrate, power.
content_blocks[].block_repeat
integer
Number of times to repeat this block (for intervals).
content_blocks[].blocks
array
Nested content blocks for complex interval structures.

Example request

curl -X POST https://app.nexrex.ai/api/v1/training/workouts \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "workout_name": "Tuesday Tempo",
    "workout_type": "run",
    "workout_sub_type": "tempo-run",
    "user_id": "usr_abc123",
    "target_distance_in_meters": 10000,
    "visibility": "org",
    "content_blocks": [
      {
        "type": "warm-up",
        "block_distance_in_meters": 1600,
        "block_pace": "z1",
        "block_length_target": "distance",
        "block_intensity_target": "pace"
      },
      {
        "type": "run",
        "block_distance_in_meters": 6400,
        "block_pace": "z3",
        "block_length_target": "distance",
        "block_intensity_target": "pace"
      },
      {
        "type": "cool-down",
        "block_distance_in_meters": 2000,
        "block_pace": "z1",
        "block_length_target": "distance",
        "block_intensity_target": "pace"
      }
    ]
  }'

Response

workout_id
string
Unique identifier of the created workout.
status
string
ok on success.