# Strava Activities Scraper (`victoria.usan/strava-activities-scraper`) Actor

Fetches all your Strava activities via the Strava API using OAuth credentials and computes per-sport statistics.

- **URL**: https://apify.com/victoria.usan/strava-activities-scraper.md
- **Developed by:** [Victoria Usan](https://apify.com/victoria.usan) (community)
- **Categories:** Automation, Social media
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Strava Activities Scraper

**Fetches all your Strava activities** via the official Strava API using OAuth credentials, pushes them to a structured dataset, and computes aggregated per-sport statistics. Run it on the Apify platform for scheduled exports, API access, and integrations with 100+ tools.

### What does Strava Activities Scraper do?

This Actor connects to the [Strava API](https://developers.strava.com/) using your OAuth2 credentials, downloads your complete activity history (runs, rides, swims, hikes, etc.), and outputs clean, structured data. It also computes per-sport statistics including total distance, time, elevation, and averages.

Unlike browser-based scrapers, this Actor uses the official Strava REST API — making it fast, reliable, and respectful of Strava's infrastructure.

### Why use Strava Activities Scraper?

- **Full activity export** — fetch your entire Strava history in one run
- **Structured data** — clean JSON output ready for analysis, dashboards, or integrations
- **Per-sport statistics** — automatic aggregation by activity type
- **Scheduled runs** — set up daily/weekly exports on Apify to track progress over time
- **API access** — query your latest results via the Apify API from any app
- **Multiple formats** — download as JSON, CSV, Excel, or HTML

### How to use Strava Activities Scraper

1. **Create a Strava API application** at [strava.com/settings/api](https://www.strava.com/settings/api). Note your Client ID and Client Secret.
2. **Obtain a refresh token** — run the included helper script locally:
   ```bash
   npx tsx src/get-token.ts
````

This opens your browser for OAuth authorization and prints the credentials you need.
3\. **Configure the Actor** in the Input tab with your Client ID, Client Secret, and Refresh Token.
4\. **Run the Actor** — it will fetch all activities and push them to the dataset.
5\. **Download results** from the Output tab in JSON, CSV, or Excel format.

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `clientId` | string | Yes | Your Strava API application client ID |
| `clientSecret` | string | Yes | Your Strava API application client secret |
| `refreshToken` | string | Yes | OAuth2 refresh token with `activity:read_all` scope |
| `maxActivities` | integer | No | Max activities to fetch (0 = all, default: 0) |

### Output

Each activity is stored as a dataset item:

```json
{
    "id": 12345678901,
    "name": "Morning Run",
    "type": "Run",
    "date": "2026-06-12T07:30:00Z",
    "distanceKm": 8.42,
    "movingTimeMin": 42.5,
    "elevationGainM": 125,
    "avgSpeedKph": 11.9,
    "avgHeartrate": 152
}
```

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

Additionally, aggregated statistics are saved to the key-value store under the `statistics` key:

```json
{
    "totalActivities": 342,
    "byType": {
        "Run": {
            "count": 180,
            "totalDistanceKm": 1520.4,
            "totalMovingTimeHours": 142.3,
            "totalElevationGainM": 18500,
            "avgDistanceKm": 8.45,
            "avgMovingTimeMin": 47.4,
            "avgElevationGainM": 103
        }
    }
}
```

### Data fields

| Field | Format | Description |
|-------|--------|-------------|
| `id` | number | Strava activity ID |
| `name` | text | Activity title |
| `type` | text | Sport type (Run, Ride, Swim, Hike, etc.) |
| `date` | date | Activity start time (local timezone) |
| `distanceKm` | number | Distance in kilometers |
| `movingTimeMin` | number | Moving time in minutes |
| `elevationGainM` | number | Total elevation gain in meters |
| `avgSpeedKph` | number | Average speed in km/h |
| `avgHeartrate` | number | Average heart rate (if sensor used) |

### Cost estimation

This Actor uses only HTTP API calls (no browser), so it's very lightweight:

- **~1 compute unit** per run fetching up to 1,000 activities
- **~0.005 USD** for a typical run of a few hundred activities
- Runs complete in seconds, not minutes

The Apify Free plan includes enough compute units for regular scheduled runs.

### Tips

- Set `maxActivities` to a small number (e.g., 10) for your first test run
- Schedule weekly runs to keep an up-to-date export of your training data
- Use the Apify API to integrate your activity data into custom dashboards or spreadsheets
- The refresh token doesn't expire as long as it's used periodically — scheduled runs keep it alive

### FAQ and support

**Is this legal?**
Yes — this Actor uses Strava's official public API with your own OAuth credentials. It only accesses data you've explicitly authorized.

**What scopes are needed?**
The refresh token needs the `activity:read_all` scope to access all your activities including private ones. Use `read` scope if you only want public activities.

**My token stopped working**
If you haven't used the refresh token in 6+ months, it may have been revoked. Run the `get-token.ts` helper again to generate a new one.

**Found a bug?**
Open an issue in the Issues tab or contact the author for custom solutions.

# Actor input Schema

## `clientId` (type: `string`):

Your Strava API application client ID. Get it at https://www.strava.com/settings/api

## `clientSecret` (type: `string`):

Your Strava API application client secret.

## `refreshToken` (type: `string`):

OAuth2 refresh token with activity:read\_all scope. Run 'npx tsx src/get-token.ts' locally to obtain one.

## `maxActivities` (type: `integer`):

Maximum number of activities to fetch. Set to 0 (default) to fetch all.

## Actor input object example

```json
{
  "maxActivities": 0
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `statistics` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("victoria.usan/strava-activities-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("victoria.usan/strava-activities-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call victoria.usan/strava-activities-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=victoria.usan/strava-activities-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Strava Activities Scraper",
        "description": "Fetches all your Strava activities via the Strava API using OAuth credentials and computes per-sport statistics.",
        "version": "0.0",
        "x-build-id": "mgJrNFcQZ2HgGtia7"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/victoria.usan~strava-activities-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-victoria.usan-strava-activities-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/victoria.usan~strava-activities-scraper/runs": {
            "post": {
                "operationId": "runs-sync-victoria.usan-strava-activities-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/victoria.usan~strava-activities-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-victoria.usan-strava-activities-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "clientId",
                    "clientSecret",
                    "refreshToken"
                ],
                "properties": {
                    "clientId": {
                        "title": "Strava client ID",
                        "type": "string",
                        "description": "Your Strava API application client ID. Get it at https://www.strava.com/settings/api"
                    },
                    "clientSecret": {
                        "title": "Strava client secret",
                        "type": "string",
                        "description": "Your Strava API application client secret."
                    },
                    "refreshToken": {
                        "title": "Refresh token",
                        "type": "string",
                        "description": "OAuth2 refresh token with activity:read_all scope. Run 'npx tsx src/get-token.ts' locally to obtain one."
                    },
                    "maxActivities": {
                        "title": "Max activities",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of activities to fetch. Set to 0 (default) to fetch all.",
                        "default": 0
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
