Skip to content

Create a fencing bout

POST
/api/bouts/
curl --request POST \
--url http://localhost:8000/api/bouts/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "Pool vs Smith", "weapon": "foil", "handedness": "right", "ours_side": "left" }'

Starts a bout: the fencer, the weapon, our fencer’s weapon hand and the side of the strip they start on. Costs nothing — quota is spent once, on the first Analyse.

object
client

The fencer being analysed. Optional, as for a session.

string format: uuid
nullable
name
string
"" <= 120 characters
weapon
One of:
  • foil - Foil
  • epee - Épée
  • sabre - Sabre
string
Allowed values: foil epee sabre
handedness
One of:
  • right - Right-handed
  • left - Left-handed
string
Allowed values: right left
opponent_handedness
One of:
  • right - Right-handed
  • left - Left-handed
string
Allowed values: right left
ours_side
One of:
  • left - Left side of the strip
  • right - Right side of the strip
string
Allowed values: left right

Examples

ExampleStartABout

Start a bout

{
"name": "Pool vs Smith",
"weapon": "foil",
"handedness": "right",
"ours_side": "left"
}
Media typeapplication/json
object
id
required
string format: uuid
client
required
string format: uuid
nullable
name
required
string
weapon
required
string
handedness
required
string
opponent_handedness
required
string
ours_side
required
string
periods
required
Array<object>
object
id
required
string format: uuid
index
required
integer
video_url
required
string format: uri
duration_s
required
number format: double
nullable
calibration
required
detect_status
required
string
Allowed values: pending running done failed skipped
detect_error
required
string
touches
required
Array<object>
object
id
string
period
required
integer
onset_s
number format: double
lamps
required
Array<string>
window_s
required
Array<number>
>= 2 items <= 2 items
double
boolean
source
required
string
include
boolean
default: true
ours_declared
One of:
  • left - Left side of the strip
  • right - Right side of the strip
string
Allowed values: left right
ours
required
One of:
  • left - Left side of the strip
  • right - Right side of the strip
string
Allowed values: left right
check_sides
required
boolean
session_id
required
string format: uuid
nullable
touches_version
required

Send it back with a touch edit; a list that has moved since answers 409.

string
touch_sessions
required
Array<object>
object
id
required
string format: uuid
status
required
string
Allowed values: pending processing completed failed
name
required
string
analyzed_url
required
string format: uri
thumbnail_url
required
string format: uri
pair_metrics
required

The touch’s pair metrics and our fencer’s footwork and hand, number or category text by key (bout_distance_at_attack_m, bout_first_to_close, bout_strip_position_m, bout_first_to_extend, bout_extension_lead_ms, step_count, advance_count, retreat_count, step_rate, weapon_hand_peak_speed).

object
key
additional properties
aggregates
required
object
touches
required
integer
analysed
required

Touches whose analysis came back with metrics.

integer
doubles
required
integer
opponent_handedness
required
string
nullable
lamps
required
object
red
required
integer
green
required
integer
white
required
integer
distance_at_attack_mean_m
required
number format: double
nullable
first_to_close
required

Null until a touch reads it.

object
ours
required
integer
opponent
required
integer
unclear
required
integer
first_to_extend
required

Null until a touch reads it.

object
ours
required
integer
opponent
required
integer
unclear
required
integer
extension_lead_mean_ms
required
integer
nullable
steps_per_touch_mean
required
number format: double
nullable
advances
required

Advances over the analysed touches, before each attack; null with none read.

integer
nullable
retreats
required

Retreats over the analysed touches; null with none read.

integer
nullable
step_rate_mean
required

Steps per minute, mean over touches.

number format: double
nullable
weapon_hand_peak_speed_mean_m_s
required
number format: double
nullable
weapon_hand_peak_speed_max_m_s
required
number format: double
nullable
strip_positions
required
Array<object>
object
touch_id
required
string
position_m
required
number format: double
double
required
boolean
lamps
required
Array<string>
weapon_suggestion
required

Foil when a white lamp was read on any touch (only foil has an off-target lamp); null when the lamps cannot tell. Never overrides the declared weapon.

string
nullable
weapon_mismatch
required
boolean
quota_units
required

Sessions of quota the bout’s one Analyse debits.

integer
max_period_s
required

The longest period video the lamp read takes, seconds; the uploader checks it before uploading.

number format: double
analysed_at
required
string format: date-time
nullable
created_at
required
string format: date-time

Examples

ExampleABout

A bout

{
"id": "6d0f3c2a-1b4e-4c8a-9f21-7e5d3a9b0c11",
"client": null,
"name": "Pool vs Smith",
"weapon": "foil",
"handedness": "right",
"opponent_handedness": "",
"ours_side": "left",
"periods": [
{
"id": "a3e1c9f0-52b7-4d16-8c0e-91f4b2d7e6a5",
"index": 0,
"video_url": "https://media.example.com/teams/9b1c7e2a/sessions/2026/10/0c5b1d7e-6a2f-4e3b-8d19-5f0a7c2e4b61.mp4",
"duration_s": 312.4,
"calibration": {
"lamps": [
[
0.44,
0.49,
0.47,
0.52
],
[
0.51,
0.49,
0.54,
0.52
]
]
},
"detect_status": "done",
"detect_error": ""
}
],
"touches": [
{
"id": "3f2a9c1d0b7e",
"period": 0,
"onset_s": 13.8,
"lamps": [
"green",
"red"
],
"window_s": [
7.8,
14.8
],
"double": true,
"source": "lamps",
"include": true,
"ours_declared": null,
"ours": "left",
"check_sides": false,
"session_id": null
}
],
"touches_version": "5be1c0a92f3d7e64",
"touch_sessions": [],
"quota_units": 3,
"max_period_s": 480,
"aggregates": {
"touches": 1,
"analysed": 0,
"doubles": 1,
"opponent_handedness": null,
"lamps": {
"red": 1,
"green": 1,
"white": 0
},
"distance_at_attack_mean_m": null,
"first_to_close": null,
"first_to_extend": null,
"extension_lead_mean_ms": null,
"steps_per_touch_mean": null,
"advances": null,
"retreats": null,
"step_rate_mean": null,
"weapon_hand_peak_speed_mean_m_s": null,
"weapon_hand_peak_speed_max_m_s": null,
"strip_positions": [],
"weapon_suggestion": null,
"weapon_mismatch": false
},
"analysed_at": null,
"created_at": "2026-10-26T10:00:00Z"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string

Example generated

{
"detail": "example"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string

Example generated

{
"detail": "example"
}
Media typeapplication/json
object
detail
required

One of eight canonical strings. The front-end paywall switches copy + CTA on this value (exact string equality — do not localise). quota_exhausted / seat_limit_reached / client_limit_reached / feature_not_in_plan lead to an upgrade CTA; subscription_suspended leads to a Billing Portal CTA so the buyer can update their payment method; exercise_not_in_plan leads to a contact-us CTA — the movement list is sales-managed, no tier adds to it (#2030). trial_expired / access_ended mean the team is read-only (#2901): everything opens, nothing new is created; they lead to a subscribe CTA and always carry reset_at: null.

  • quota_exhausted - Session quota for the period reached 0
  • subscription_suspended - Stripe dunning in flight (past_due / unpaid)
  • seat_limit_reached - Adding another team member would exceed plan.max_seats
  • client_limit_reached - Adding another Client would exceed plan.max_client_profiles
  • feature_not_in_plan - The tier does not include this whole feature surface
  • exercise_not_in_plan - The (activity, exercise) is not in the team’s exercise grants
  • trial_expired - The team is read-only: its self-serve trial ended
  • access_ended - The team is read-only: its paid plan or granted access ended
string
Allowed values: quota_exhausted subscription_suspended seat_limit_reached client_limit_reached feature_not_in_plan exercise_not_in_plan trial_expired access_ended
reset_at
required

ISO-8601 UTC timestamp the team’s current period ends. Null when the team has no live subscription (legacy un-migrated row). On Free + paid this is the renewal moment; quota refreshes to exactly plan.session_quota (NOT additive — leftover sessions don’t roll over).

string format: date-time
nullable
current_plan
required

The active plan’s role string (free, starter, professional, organization, strategic). Same value as current_role — kept as two separate fields for forward-compatibility with a future named-plan split where current_plan could carry an SKU and current_role the tier label.

string
current_role
required

The active plan’s role string. See current_plan.

string
feature

Which feature surface is locked. Present ONLY on feature_not_in_plan, so one modal can name what’s gated without a detail string per feature (#773). The only value today is agents (aikynetix/agents/services.py::AGENTS_FEATURE).

string

Example

{
"detail": "quota_exhausted"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string

Example generated

{
"detail": "example"
}