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. The examples read your key from aSATURDAY_API_KEY environment variable, as in Quickstart. Sandbox keys are issued with a separate base URL; using one against api.saturday.fit returns 401 invalid_api_key.
Batch calculate
Calculate prescriptions for multiple scenarios at once. Ideal for building “training week” views or “what if” comparisons.athlete_id goes on the scenario, not at the top level, and a brick or triathlon is one scenario with legs (Bricks and triathlons); its result carries the leg shares as calculate’s does. A field a scenario does not take refuses the whole batch with 400 and code unsupported_field, its param carrying the scenario’s index (scenarios[1].is_races), before any scenario runs. Successful results come back in request order, with failures omitted. Use the failed indexes in errors to match each result to its original scenario.
Response format
Counts and the request ID sit at the top level. Each entry inresults is the same body the single calculate endpoint returns, so it carries tier, safety, and attribution and does not carry an index. errors appears only when at least one scenario failed.
errors as { "index", "code", "message" }, and the successful ones are still returned: batch operations do not fail atomically.
Because failures are dropped from results rather than nulled, results is shorter than scenarios when anything fails, and a result’s position no longer matches its scenario index. When you need that mapping and failures are possible, read the failed indexes from errors first and reconstruct alignment from them.
Limits
Exceeding 50 returns
400 with the code batch_too_large, and an empty scenarios array returns 400 with empty_batch.
Sizing the wait
A batch takes as long as the sum of its scenarios. Two things let you show real progress instead of a spinner: the response carries anX-Batch-Estimated-Ms header, flushed before processing begins, and sending "estimate_only": true returns the same estimate immediately without running any calculations, consuming quota, or returning results.
Bulk athlete create
Onboard multiple athletes in one call. Useful for team imports or platform migrations.403 and code athlete_scope rather than partway through, so a scope mistake never leaves some athletes created and others not.
Limits
Each athlete is also validated on
weight_kg (20 to 250, as on single create), year_of_birth (1900 to the current year), and sex (male, female, or intersex). A violation fails that item only: weight_kg with code out_of_range, the others with invalid_value; an item naming none of name, email, or external_id fails with missing_identifier. A year_of_birth that makes the athlete younger than 14 (the current year minus the birth year) fails that item with under_minimum_age, and the item’s message names the minimum age.
The batch is also checked against your account’s total athlete quota before processing. If you are at the cap the whole request returns 403 with the code resource_limit_exceeded, rather than partially filling.
external_id is unique within your account. An item whose external_id one of your athletes holds, an earlier item of the same batch included, is not created: it fails with code athlete_exists, and athlete_id on that error names the athlete that holds it. Retrying a batch that partially succeeded is therefore safe for items that carry an external_id. Items without one are created again on a retry.Activity import
Import multiple activities for an athlete at once. Useful for backfilling historical data from other platforms.name and scheduled_at, which are accepted and ignored. Any other field is refused with 400 and code unsupported_field (Error Handling):
Imported activities are stamped with the time Saturday created them, so a backfill does not preserve the original activity dates. Keep a date mapping keyed by
external_id if you need it.meal_before_min and is_race_event on the activity, so send both on each imported activity when you ask for a calculation at import. Without them the calculation returns ranges even for a complete profile.
400 with batch_too_large. The import is also checked against the athlete’s activity quota before processing, returning 403 with resource_limit_exceeded if it would exceed the cap. Per-item validation fails an item with missing_field when type is absent and invalid_value for an unknown type or a non-positive duration_min.
Calculating prescriptions during import
Setcalculate: true at the top level to calculate a prescription for every imported activity, or on individual activities to calculate selectively:
imported[].prescription, while teaser-tier athletes get per-hour ranges with a subscription_cta. Trial athletes debit their daily call allowance per calculated activity, so a large import can exhaust the day’s allowance mid-batch, after which the remaining items return teaser ranges.
Per-item outcomes ride a prescriptions array in the response, each with 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 and message.
Imports count against rate limits per item, like batch calculate. Each prescription you ask for counts as one activity calculation besides its import: it needs the nutrition feature (403 with feature_alpha without it) and counts against your daily intelligence limit as well as your daily call limit. An import runs only when both limits have room for all of it, and returns 429 otherwise, with nothing imported.
Error handling in batch operations
Batch operations use partial success semantics. If 3 of 5 items succeed and 2 fail, the 3 successes are committed and the 2 failures are returned inerrors. The HTTP status is 200 whenever the request itself was accepted, even when every item failed; a 400 or 403 means nothing was processed.
Every batch response uses the same envelope. The success array is named for the operation (results, created, or imported), and alongside it sit total, succeeded, failed, request_id, and, when anything failed, errors. Each error is a flat object with index, code, and message:
index on an error refers to the item’s position in your request, which is the only reliable way to tell which input failed.
Unlike the resource IDs above, request_id is not a UUID: it is req_ followed by 12 hex characters. Log it. It is what support needs to trace a specific call.