---
title: "Ingest Baselines"
method: POST
path: "/api/v1/biomech/baselines"
tags: ["Biomech"]
---

# Ingest Baselines

`POST /api/v1/biomech/baselines`

Ingest per-player biomech baselines and baseline frames.

New baselines are inserted normally. Replacing an existing baseline requires
``replace_existing=true``; only then does the endpoint DELETE all existing
``biomech_baseline_frame`` rows for that ``player_id`` and bulk-insert the new
ones. ``skip_existing=true`` leaves existing baselines unchanged. Each baseline
is committed independently.

Player resolution: same caveat as ``/historical-stats`` — if ``player.alias``
triggers bootstrap, the new ``player_info`` row will have ``team_id=NULL``.
Establish ``player_info`` via ``POST /biomech/sessions`` or roster creation
first to avoid teamless pitcher records.

## Headers

- `x-api-key` string, nullable
- `League` string, nullable

## Request body

- BiomechBaselinesRequest
  - `baselines` BiomechBaseline[], required
    - `player` PlayerRef, required — Reference a player either by canonical player_id or pitchbio alias.
      - `player_id` string, nullable — Canonical player_id
      - `alias` string, nullable — Pitchbio player alias, for example pitcher_001
    - `num_pitches` integer, required
    - `num_sessions` integer, required
    - `frame_range` unknown[], required
      - unknown
    - `fp_frame_index` integer, nullable
    - `mer_frame_index` integer, nullable
    - `br_frame_index` integer, nullable
    - `frames` BiomechBaselineFrame[], required
      - `frame` integer, required
      - `metric` 'shoulder_abduction' | 'shoulder_horizontal_abduction' | 'shoulder_external_rotation' | 'elbow_flexion' | 'left_hip_flexion' | 'right_hip_flexion' | 'left_knee_flexion' | 'right_knee_flexion' | 'stride_length' | 'pelvis_rotation' | 'torso_rotation' | 'hip_shoulder_separation' | 'elbow_varus_torque' | 'trunk_anterior_tilt' | 'trunk_lateral_tilt', required
      - `mean` number, required
      - `std` number, required
      - `sample_count` integer, required
  - `skip_existing` boolean — Leave an existing player baseline unchanged.
  - `replace_existing` boolean — Explicitly allow replacement of an existing player baseline and all of its frames.

## Response `200`

Successful Response

- BiomechBaselinesResponse
  - `success` boolean, required
  - `players_upserted` integer, required
  - `players_skipped` integer
  - `frames_inserted` integer, required
  - `items` BiomechBaselineItemResponse[], required
    - `player_id` string, required
    - `frames` integer, required
    - `skipped` boolean

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/preciser/apis/preciser-data-management-api.md) · [All operations](https://skmtc.net/preciser/apis/preciser-data-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/preciser/preciser-data-management-api/versions/42cb7b14430f/schema)
