canonical: https://jentic.com/apis/endurain.com/endurain

# Endurain

Jentic publishes the only available OpenAPI specification for Endurain, keeping it validated and agent-ready. Endurain is a self-hosted activity and fitness-tracking platform. The API exposes activities, gear, exercise titles, laps, and media uploads, scoped per user and supporting bulk imports of activity files. Athletes and self-hosters use it to query their training history, attach media to activities, and sync activities programmatically with other tools.

## For AI agents

Query, upload, and edit fitness activities, gear, laps, and media in a self-hosted Endurain workspace.

## Scope

Does not handle real-time GPS streaming, payments, or social-feed publishing - use for managing activities, gear, laps, and media in a self-hosted Endurain instance only.

## Capabilities

- List a user's activities filtered by week, month, or pagination
- Upload an activity file or perform a bulk import of activities
- Edit an activity's metadata or change its visibility
- Attach and remove media files on a given activity
- Query gear-linked activities to track equipment usage

## Use cases

### Activity Upload from a Watch Sync

When a fitness watch finishes a workout, an agent uploads the file via POST `/api/v1/activities/create/upload` so the activity is parsed and stored in Endurain. Bulk catch-up after a gap is handled by POST `/api/v1/activities/create/bulkimport.` This makes Endurain a destination for athletes who want to keep their data in a self-hosted system instead of a closed cloud.

Example prompt: Upload an FIT file for today's run and confirm the activity was created with non-zero distance

### Training History Reporting

Build a weekly or monthly training summary using GET `/api/v1/activities/user/{user_id}/week/{week_number}` and GET `/api/v1/activities/user/{user_id}/thismonth/distances.` Athletes get a quick recap and coaches can pull the same view across multiple users. The endpoints are paginated for higher-volume reporting.

Example prompt: Return the total distance and activity count for user_id 5 for the current month

### Gear Tracking

Use GET `/api/v1/activities/gear/{gear_id}` and GET `/api/v1/activities/gear/{gear_id}/number` to track lifetime mileage and activity count on a specific bike or pair of shoes, so an athlete knows when to replace gear before failure.

Example prompt: Return total distance and activity count for gear_id 3 to determine whether it has crossed a 500 km wear threshold

### Agent-Driven Training Assistant

An AI training assistant searches Jentic for 'list this week's activities', loads the Endurain operation, and answers user questions like 'how much did I run this week?' without requiring a custom Endurain client. Editing activity visibility or metadata can be chained into the same agent turn.

Example prompt: When asked 'how much did I run this week?', call the week-distance endpoint for the current user and return the total in km

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/api/v1/activities/{activity_id}` | Get an activity by ID |
| POST | `/api/v1/activities/create/upload` | Create an activity from an uploaded file |
| POST | `/api/v1/activities/create/bulkimport` | Bulk import activities |
| PUT | `/api/v1/activities/edit` | Edit an activity |
| DELETE | `/api/v1/activities/{activity_id}/delete` | Delete an activity |
| GET | `/api/v1/activities/user/{user_id}/week/{week_number}` | List a user's activities for a specific week |
| POST | `/api/v1/activities_media/upload/activity_id/{activity_id}` | Upload media for an activity |

## Key resources

- **Activities** — Workouts and training sessions per user
- **Gear** — Equipment such as bikes and shoes linked to activities
- **Laps** — Sub-activity lap records
- **Media** — Photos and files attached to activities
- **Exercise Titles** — Catalogue of exercise types

## Why Jentic

- **Setup:** Wiring Endurain by hand means running its OAuth2 password flow for a bearer token alongside an X-Client-Type header, pointing at your self-hosted instance rather than a fixed host, and building your own error handling across its 171 operations. Through Jentic you install once, import Endurain from the API Directory, store the credentials once, and your agent calls it.
- **Permission scoping:** Endurain puts the activity id in the URL path (`/api/v1/activities/{activity_id}`), so a rule can pin your agent to one activity: it can read that activity and nothing else. You choose the operations it may call, so ones like editing, deleting, or bulk-importing activities are not included unless you add them.
- **Credential handling:** Your Endurain credentials are stored once, encrypted, by your own Jentic One instance and injected at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'read a training activity' or 'upload a new activity file', and Jentic returns the matching Endurain operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **EngageBay CRM REST API** — EngageBay can hold the athlete-as-customer record while Endurain stores their training data.
- **Engage.so API** — Engage.so can send athletes lifecycle messages triggered by Endurain activity events.
- **Endor Labs AppSec API** — Different domain (security vs fitness) but both are namespace/user-scoped REST surfaces - listed only as a structural comparison.

## FAQ

### Why is there no official OpenAPI spec for Endurain?

Endurain ships its OpenAPI spec with the application, but Jentic publishes the curated, validated version against the public corpus so AI agents and developers can call Endurain via structured tooling. It is kept up to date against the live API. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Endurain API use?

Endurain supports OAuth2 password-bearer tokens, API key headers, and API key cookies. Through Jentic, the chosen credential is stored encrypted in the vault and supplied to the request at execution time.

### Can I bulk-import activities into Endurain?

Yes. POST `/api/v1/activities/create/bulkimport` accepts a batch of activity files in one call. Use POST `/api/v1/activities/create/upload` for single-activity uploads.

### Why does the spec list a localhost server URL?

Endurain is self-hosted, so the spec ships with `http://localhost:8080` as the default. When calling a deployed instance, override the base URL to your own domain - for example `https://endurain.example.com`.

### What are the rate limits for the Endurain API?

Endurain is self-hosted, so rate limits depend entirely on your deployment. There are no spec-declared limits; tune your reverse proxy or app server if you need throttling.

### How do I upload an activity through Jentic?

Run `pip install jentic`, search 'upload an endurain activity file', and Jentic returns POST `/api/v1/activities/create/upload` with its input schema. Configure your deployed Endurain base URL and the agent can execute the upload.

### Can I limit what my agent is allowed to do with the Endurain API?

Yes. Because you run Jentic One yourself, your own rules decide which Endurain operations and credentials the agent may use. Since the activity id sits in the URL path (`/api/v1/activities/{activity_id}`), you can pin the agent to a single activity so it reads that activity and nothing else. You also choose the operations it can call, so editing, deleting, and bulk-importing activities stay off unless you add them.
