Skip to main content

Batch Operations

Batch endpoints let you perform multiple operations in a single API call. Use these when you need to process a training week, onboard a team, or import historical activities.

Batch calculate

Calculate prescriptions for multiple scenarios at once. Ideal for building “training week” views or “what if” comparisons.

Response format

If individual scenarios fail, they appear in errors with the index and error detail. Successful scenarios are still returned — batch operations don’t fail atomically.

Limits

Bulk athlete create

Onboard multiple athletes in one call. Useful for team imports or platform migrations.

Limits

Activity import

Import multiple activities for an athlete at once. Useful for backfilling historical data from other platforms.

Calculating prescriptions during import

Set calculate: true at the top level to calculate a prescription for every imported activity, or on individual activities to calculate selectively:
Each calculation runs the same tier-aware path as the single calculate endpoint: full-tier and in-trial athletes get exact prescriptions (stored on the activity and mirrored on imported[].prescription); teaser-tier athletes get per-hour ranges with a subscription_cta. Trial athletes debit their daily call allowance per calculated activity — a large import can use up the day’s allowance mid-batch, after which remaining items return teaser ranges. Per-item outcomes ride a prescriptions array in the response (index, activity_id, and the tier-aware result). A failed calculation never fails the import — the activity is still created, and the failure appears on that item’s code/message. Imports also count against rate limits per item, like batch calculate.

Error handling in batch operations

Batch operations use partial success semantics. If 3 out of 5 items succeed and 2 fail:
  • The 3 successful items are committed
  • The 2 failed items are returned in the errors array with index, error type, and message
  • The HTTP status is 200 (not 400) because some items succeeded
Check both created (or results) and errors arrays to handle the response correctly.