data
Strava Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Strava KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.strava.*.
Use lua_read_doc("integrations.strava") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Strava workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.strava.get_athlete({}))' --json kosmo integrations:lua --eval 'print(docs.read("strava"))' --json
kosmo integrations:lua --eval 'print(docs.read("strava.get_athlete"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local strava = app.integrations.strava
local result = strava.get_athlete({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.strava, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.strava.default.* or app.integrations.strava.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Strava, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Strava Lua API Reference
Namespace: app.integrations.strava
Use this integration for Strava athletes, activities, uploads, clubs, routes,
segments, streams, and relative API calls. Returned values are the parsed Strava
JSON response. Route exports and other non-JSON responses return { body = "..." }.
Athletes
| Function | Purpose |
|---|---|
get_athlete({}) | Get the authenticated athlete profile. |
get_current_user({}) | Alias for authenticated athlete profile. |
get_athlete_stats({ athlete_id }) | Get all-time, year-to-date, and recent activity totals. |
get_athlete_zones({}) | Get heart rate and power zones for the authenticated athlete. |
Activities And Uploads
| Function | Purpose |
|---|---|
list_activities({ page?, per_page?, before?, after? }) | List authenticated athlete activities. per_page is capped at 200. |
get_activity({ activity_id }) | Get a detailed activity. |
create_activity({ name, type, start_date_local, elapsed_time, description?, distance?, trainer?, commute? }) | Create a manual activity. |
update_activity({ activity_id, payload }) | Update editable activity fields. |
get_activity_streams({ activity_id, keys, resolution?, series_type? }) | Get stream data such as time, distance, latlng, heartrate, cadence, watts, or moving. |
list_activity_laps({ activity_id }) | List laps for an activity. |
get_activity_zones({ activity_id }) | Get zone distribution for an activity. |
upload_activity({ file_path, data_type, name?, description?, trainer?, commute?, external_id? }) | Upload a FIT, TCX, or GPX file for asynchronous processing. |
get_upload({ upload_id }) | Poll upload processing status. |
Example:
local activities = app.integrations.strava.list_activities({ per_page = 5 })
for _, activity in ipairs(activities) do
print(activity.name .. " " .. activity.type)
end
Clubs
| Function | Purpose |
|---|---|
list_clubs({ page?, per_page? }) | List clubs the authenticated athlete belongs to. |
get_club({ club_id }) | Get one club. |
list_club_activities({ club_id, page?, per_page? }) | List recent activities for club members. |
list_club_members({ club_id, page?, per_page? }) | List club members. |
Club activity and member endpoints require the authenticated athlete to belong to the club.
Routes
| Function | Purpose |
|---|---|
list_routes({ athlete_id, page?, per_page? }) | List routes created by an athlete. |
get_route({ route_id }) | Get route details. |
export_route({ route_id, format }) | Export route as gpx or tcx. |
get_route_streams({ route_id }) | Get route coordinate and elevation streams. |
Segments
| Function | Purpose |
|---|---|
list_starred_segments({ page?, per_page? }) | List starred segments for the authenticated athlete. |
get_segment({ segment_id }) | Get one segment. |
star_segment({ segment_id, starred }) | Star or unstar a segment. |
explore_segments({ bounds, activity_type?, min_cat?, max_cat? }) | Explore top segments in a bounding box. |
list_segment_efforts({ segment_id, start_date_local?, end_date_local?, page?, per_page? }) | List efforts for a segment. |
get_segment_effort({ effort_id }) | Get one segment effort. |
get_segment_streams({ segment_id, keys, resolution?, series_type? }) | Get stream data for a segment. |
bounds is [sw_lat, sw_lng, ne_lat, ne_lng]. Segment streams use the same
key style as activity streams.
Generic API Helpers
| Function | Purpose |
|---|---|
api_get({ path, params? }) | Send GET to a relative Strava API path. |
api_post({ path, payload? }) | Send POST to a relative Strava API path. |
api_put({ path, payload? }) | Send PUT to a relative Strava API path. |
api_delete({ path, payload? }) | Send DELETE to a relative Strava API path. |
Generic helpers reject absolute URLs. Use relative paths such as /athlete,
/activities/{id}, /segments/starred, or /routes/{id} so the host controls
credentials and base URL handling.
Multi-Account Usage
All functions work under account-specific namespaces:
app.integrations.strava.list_activities({})
app.integrations.strava.default.list_activities({})
app.integrations.strava.personal.list_activities({})Raw agent markdown
# Strava Lua API Reference
Namespace: `app.integrations.strava`
Use this integration for Strava athletes, activities, uploads, clubs, routes,
segments, streams, and relative API calls. Returned values are the parsed Strava
JSON response. Route exports and other non-JSON responses return `{ body = "..." }`.
## Athletes
| Function | Purpose |
|----------|---------|
| `get_athlete({})` | Get the authenticated athlete profile. |
| `get_current_user({})` | Alias for authenticated athlete profile. |
| `get_athlete_stats({ athlete_id })` | Get all-time, year-to-date, and recent activity totals. |
| `get_athlete_zones({})` | Get heart rate and power zones for the authenticated athlete. |
## Activities And Uploads
| Function | Purpose |
|----------|---------|
| `list_activities({ page?, per_page?, before?, after? })` | List authenticated athlete activities. `per_page` is capped at 200. |
| `get_activity({ activity_id })` | Get a detailed activity. |
| `create_activity({ name, type, start_date_local, elapsed_time, description?, distance?, trainer?, commute? })` | Create a manual activity. |
| `update_activity({ activity_id, payload })` | Update editable activity fields. |
| `get_activity_streams({ activity_id, keys, resolution?, series_type? })` | Get stream data such as time, distance, latlng, heartrate, cadence, watts, or moving. |
| `list_activity_laps({ activity_id })` | List laps for an activity. |
| `get_activity_zones({ activity_id })` | Get zone distribution for an activity. |
| `upload_activity({ file_path, data_type, name?, description?, trainer?, commute?, external_id? })` | Upload a FIT, TCX, or GPX file for asynchronous processing. |
| `get_upload({ upload_id })` | Poll upload processing status. |
Example:
```lua
local activities = app.integrations.strava.list_activities({ per_page = 5 })
for _, activity in ipairs(activities) do
print(activity.name .. " " .. activity.type)
end
```
## Clubs
| Function | Purpose |
|----------|---------|
| `list_clubs({ page?, per_page? })` | List clubs the authenticated athlete belongs to. |
| `get_club({ club_id })` | Get one club. |
| `list_club_activities({ club_id, page?, per_page? })` | List recent activities for club members. |
| `list_club_members({ club_id, page?, per_page? })` | List club members. |
Club activity and member endpoints require the authenticated athlete to belong
to the club.
## Routes
| Function | Purpose |
|----------|---------|
| `list_routes({ athlete_id, page?, per_page? })` | List routes created by an athlete. |
| `get_route({ route_id })` | Get route details. |
| `export_route({ route_id, format })` | Export route as `gpx` or `tcx`. |
| `get_route_streams({ route_id })` | Get route coordinate and elevation streams. |
## Segments
| Function | Purpose |
|----------|---------|
| `list_starred_segments({ page?, per_page? })` | List starred segments for the authenticated athlete. |
| `get_segment({ segment_id })` | Get one segment. |
| `star_segment({ segment_id, starred })` | Star or unstar a segment. |
| `explore_segments({ bounds, activity_type?, min_cat?, max_cat? })` | Explore top segments in a bounding box. |
| `list_segment_efforts({ segment_id, start_date_local?, end_date_local?, page?, per_page? })` | List efforts for a segment. |
| `get_segment_effort({ effort_id })` | Get one segment effort. |
| `get_segment_streams({ segment_id, keys, resolution?, series_type? })` | Get stream data for a segment. |
`bounds` is `[sw_lat, sw_lng, ne_lat, ne_lng]`. Segment streams use the same
key style as activity streams.
## Generic API Helpers
| Function | Purpose |
|----------|---------|
| `api_get({ path, params? })` | Send GET to a relative Strava API path. |
| `api_post({ path, payload? })` | Send POST to a relative Strava API path. |
| `api_put({ path, payload? })` | Send PUT to a relative Strava API path. |
| `api_delete({ path, payload? })` | Send DELETE to a relative Strava API path. |
Generic helpers reject absolute URLs. Use relative paths such as `/athlete`,
`/activities/{id}`, `/segments/starred`, or `/routes/{id}` so the host controls
credentials and base URL handling.
## Multi-Account Usage
All functions work under account-specific namespaces:
```lua
app.integrations.strava.list_activities({})
app.integrations.strava.default.list_activities({})
app.integrations.strava.personal.list_activities({})
``` local result = app.integrations.strava.get_athlete({})
print(result) Functions
get_athlete Read
Get the authenticated athlete's Strava profile: name, location, follower/following counts, and stats.
- Lua path
app.integrations.strava.get_athlete- Full name
strava.strava_get_athlete
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_current_user Read
Get the current authenticated user's Strava profile. This is an alias for strava_get_athlete and returns name, location, follower/following counts, and stats.
- Lua path
app.integrations.strava.get_current_user- Full name
strava.strava_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_athlete_stats Read
Get activity totals and recent statistics for a Strava athlete.
- Lua path
app.integrations.strava.get_athlete_stats- Full name
strava.strava_get_athlete_stats
| Parameter | Type | Required | Description |
|---|---|---|---|
athlete_id | integer | yes | Athlete ID. |
get_athlete_zones Read
Get heart rate and power zones for the authenticated Strava athlete.
- Lua path
app.integrations.strava.get_athlete_zones- Full name
strava.strava_get_athlete_zones
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_activities Read
List recent activities for the authenticated Strava athlete. Supports pagination and date filtering with before/after Unix timestamps.
- Lua path
app.integrations.strava.list_activities- Full name
strava.strava_list_activities
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1). |
per_page | integer | no | Number of activities per page (default: 30, max: 200). |
before | integer | no | Unix timestamp for activities before this time. |
after | integer | no | Unix timestamp for activities after this time. |
get_activity Read
Get detailed information about a specific Strava activity, including distance, pace, elevation, and splits.
- Lua path
app.integrations.strava.get_activity- Full name
strava.strava_get_activity
| Parameter | Type | Required | Description |
|---|---|---|---|
activity_id | integer | yes | The ID of the activity to retrieve. |
create_activity Write
Create a manual activity on Strava. Requires a name, activity type, start date, and elapsed time in seconds.
- Lua path
app.integrations.strava.create_activity- Full name
strava.strava_create_activity
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Name of the activity (e.g., "Morning Run"). |
type | string | yes | Activity type: Run, Ride, Swim, Hike, Walk, Workout, WeightTraining, Yoga, etc. |
start_date_local | string | yes | ISO 8601 local start date and time (e.g., "2025-01-15T09:30:00"). |
elapsed_time | integer | yes | Elapsed time in seconds. |
description | string | no | Description of the activity. |
distance | number | no | Distance in meters. |
trainer | integer | no | Set to 1 if this is a trainer/trainer ride activity. |
commute | integer | no | Set to 1 if this is a commute activity. |
update_activity Write
Update editable fields on a Strava activity, such as name, type, sport_type, description, commute, trainer, or privacy.
- Lua path
app.integrations.strava.update_activity- Full name
strava.strava_update_activity
| Parameter | Type | Required | Description |
|---|---|---|---|
activity_id | integer | yes | Activity ID. |
payload | object | yes | Official activity update payload. |
get_activity_streams Read
Get activity stream data such as time, distance, latlng, altitude, velocity_smooth, heartrate, cadence, watts, temp, moving, or grade_smooth.
- Lua path
app.integrations.strava.get_activity_streams- Full name
strava.strava_get_activity_streams
| Parameter | Type | Required | Description |
|---|---|---|---|
activity_id | integer | yes | Activity ID. |
keys | array | yes | Stream keys to request. |
resolution | string | no | Optional stream resolution. |
series_type | string | no | Optional series type. |
list_activity_laps Read
List laps for a Strava activity.
- Lua path
app.integrations.strava.list_activity_laps- Full name
strava.strava_list_activity_laps
| Parameter | Type | Required | Description |
|---|---|---|---|
activity_id | integer | yes | Activity ID. |
get_activity_zones Read
Get heart rate and power zone distribution for a Strava activity when available.
- Lua path
app.integrations.strava.get_activity_zones- Full name
strava.strava_get_activity_zones
| Parameter | Type | Required | Description |
|---|---|---|---|
activity_id | integer | yes | Activity ID. |
upload_activity Write
Upload a FIT, TCX, or GPX file to create a Strava activity for asynchronous processing.
- Lua path
app.integrations.strava.upload_activity- Full name
strava.strava_upload_activity
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | yes | Absolute path to the activity file. |
data_type | string | yes | Upload file type. |
name | string | no | Optional activity name. |
description | string | no | Optional activity description. |
trainer | integer | no | Set to 1 for trainer activity. |
commute | integer | no | Set to 1 for commute activity. |
external_id | string | no | Optional unique external ID. |
get_upload Read
Get processing status for a Strava activity upload.
- Lua path
app.integrations.strava.get_upload- Full name
strava.strava_get_upload
| Parameter | Type | Required | Description |
|---|---|---|---|
upload_id | integer | yes | Upload ID. |
list_clubs Read
List clubs the authenticated Strava athlete belongs to. Returns club names, member counts, and sport types.
- Lua path
app.integrations.strava.list_clubs- Full name
strava.strava_list_clubs
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1). |
per_page | integer | no | Number of clubs per page (default: 30). |
get_club Read
Get details about a specific Strava club, including name, description, member count, and sport types.
- Lua path
app.integrations.strava.get_club- Full name
strava.strava_get_club
| Parameter | Type | Required | Description |
|---|---|---|---|
club_id | integer | yes | The club ID. |
list_club_activities Read
List recent activities from members of a Strava club the authenticated athlete belongs to.
- Lua path
app.integrations.strava.list_club_activities- Full name
strava.strava_list_club_activities
| Parameter | Type | Required | Description |
|---|---|---|---|
club_id | integer | yes | Club ID. |
page | integer | no | Page number. |
per_page | integer | no | Items per page. |
list_club_members Read
List athletes who are members of a Strava club.
- Lua path
app.integrations.strava.list_club_members- Full name
strava.strava_list_club_members
| Parameter | Type | Required | Description |
|---|---|---|---|
club_id | integer | yes | Club ID. |
page | integer | no | Page number. |
per_page | integer | no | Items per page. |
list_routes Read
List routes created by a specific Strava athlete. Requires the athlete ID.
- Lua path
app.integrations.strava.list_routes- Full name
strava.strava_list_routes
| Parameter | Type | Required | Description |
|---|---|---|---|
athlete_id | integer | yes | The athlete ID whose routes to list. |
page | integer | no | Page number (default: 1). |
per_page | integer | no | Number of routes per page (default: 30). |
get_route Read
Get details for a Strava route by ID.
- Lua path
app.integrations.strava.get_route- Full name
strava.strava_get_route
| Parameter | Type | Required | Description |
|---|---|---|---|
route_id | integer | yes | Route ID. |
export_route Read
Export a Strava route as GPX or TCX.
- Lua path
app.integrations.strava.export_route- Full name
strava.strava_export_route
| Parameter | Type | Required | Description |
|---|---|---|---|
route_id | integer | yes | Route ID. |
format | string | yes | Export format. |
get_route_streams Read
Get route stream coordinates and elevation data for a Strava route.
- Lua path
app.integrations.strava.get_route_streams- Full name
strava.strava_get_route_streams
| Parameter | Type | Required | Description |
|---|---|---|---|
route_id | integer | yes | Route ID. |
list_starred_segments Read
List starred segments for the authenticated Strava athlete.
- Lua path
app.integrations.strava.list_starred_segments- Full name
strava.strava_list_starred_segments
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number. |
per_page | integer | no | Items per page. |
get_segment Read
Get details for a Strava segment by ID.
- Lua path
app.integrations.strava.get_segment- Full name
strava.strava_get_segment
| Parameter | Type | Required | Description |
|---|---|---|---|
segment_id | integer | yes | Segment ID. |
star_segment Write
Star or unstar a Strava segment for the authenticated athlete.
- Lua path
app.integrations.strava.star_segment- Full name
strava.strava_star_segment
| Parameter | Type | Required | Description |
|---|---|---|---|
segment_id | integer | yes | Segment ID. |
starred | boolean | yes | Whether the segment should be starred. |
explore_segments Read
Explore top Strava segments in a bounding box.
- Lua path
app.integrations.strava.explore_segments- Full name
strava.strava_explore_segments
| Parameter | Type | Required | Description |
|---|---|---|---|
bounds | array | yes | Bounding box as southwest lat/lng and northeast lat/lng: [sw_lat, sw_lng, ne_lat, ne_lng]. |
activity_type | string | no | Segment activity type. |
min_cat | integer | no | Minimum climb category. |
max_cat | integer | no | Maximum climb category. |
list_segment_efforts Read
List efforts for the authenticated athlete on a Strava segment.
- Lua path
app.integrations.strava.list_segment_efforts- Full name
strava.strava_list_segment_efforts
| Parameter | Type | Required | Description |
|---|---|---|---|
segment_id | integer | yes | Segment ID. |
start_date_local | string | no | Start date filter. |
end_date_local | string | no | End date filter. |
page | integer | no | Page number. |
per_page | integer | no | Items per page. |
get_segment_effort Read
Get a Strava segment effort by ID.
- Lua path
app.integrations.strava.get_segment_effort- Full name
strava.strava_get_segment_effort
| Parameter | Type | Required | Description |
|---|---|---|---|
effort_id | integer | yes | Segment effort ID. |
get_segment_streams Read
Get stream data for a Strava segment.
- Lua path
app.integrations.strava.get_segment_streams- Full name
strava.strava_get_segment_streams
| Parameter | Type | Required | Description |
|---|---|---|---|
segment_id | integer | yes | Segment ID. |
keys | array | yes | Stream keys to request. |
resolution | string | no | Optional stream resolution. |
series_type | string | no | Optional series type. |
api_get Read
Call a relative Strava API GET path, such as "/athlete". Absolute URLs are rejected.
- Lua path
app.integrations.strava.api_get- Full name
strava.strava_api_get
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Strava API path. |
params | object | no | Query parameters. |
api_post Write
Call a relative Strava API POST path. Absolute URLs are rejected.
- Lua path
app.integrations.strava.api_post- Full name
strava.strava_api_post
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Strava API path. |
payload | object | no | JSON body. |
api_put Write
Call a relative Strava API PUT path. Absolute URLs are rejected.
- Lua path
app.integrations.strava.api_put- Full name
strava.strava_api_put
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Strava API path. |
payload | object | no | JSON body. |
api_delete Write
Call a relative Strava API DELETE path. Absolute URLs are rejected.
- Lua path
app.integrations.strava.api_delete- Full name
strava.strava_api_delete
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Strava API path. |
payload | object | no | Optional JSON body. |