Skip to content

FiberPath API Reference

The FastAPI service in fiberpath_api/ exposes thin wrappers around the core planning, simulation, validation, and streaming engines. All endpoints accept and return JSON and are designed for headless automation (GUI/HMI integrations, CI pipelines, etc.).

Planning

POST /plan/from-file

Request body:

{
  "path": "/absolute/path/to/input.wind",
  "axis_format": "xab",
  "verbose": false
}

Fields:

  • path (required): Absolute path to .wind file
  • axis_format (optional): Axis coordinate format - "xab" (default, standard rotational) or "xyz" (legacy compatibility)
  • verbose (optional): Include detailed layer metrics in response (default: false)

See Axis Mapping Guide for format details.

Response body:

{
  "commands": 1234,
  "output": "/absolute/path/to/input.gcode",
  "timeSeconds": 42.5,
  "towMeters": 8.1,
  "axisFormat": "xab",
  "layers": [
    {
      "index": 1,
      "wind_type": "helical",
      "commands": 456,
      "time_s": 12.3,
      "tow_m": 1.9
    }
  ]
}

Simulation

POST /simulate/from-file

Request:

{
  "path": "/absolute/path/to/output.gcode"
}

Response:

{
  "commands": 789,
  "moves": 300,
  "estimated_time_s": 95.2,
  "total_distance_mm": 8234.5,
  "tow_length_mm": 8100.0,
  "average_feed_rate_mmpm": 7200.0
}

Response Fields:

  • commands: Total G-code commands processed
  • moves: Number of movement commands (G0/G1)
  • estimated_time_s: Estimated execution time in seconds
  • total_distance_mm: Combined motion distance of all axes
  • tow_length_mm: Total fiber material used in millimeters
  • average_feed_rate_mmpm: Mean speed across all moves in mm/min

Validation

POST /validate/from-file

Validates a .wind file against the schema without generating G-code.

Request:

{
  "path": "/absolute/path/to/input.wind"
}

Response (success):

{
  "status": "ok",
  "path": "/absolute/path/to/input.wind"
}

Response (validation error):

{
  "status": "error",
  "detail": "Validation error description"
}

HTTP status codes:

  • 200 OK: File is valid
  • 400 Bad Request: Validation failed (see detail field)

Streaming

POST /stream/

Request:

{
  "gcode": "; Parameters ...\nG0 X0 Y0\n",
  "port": "COM5",
  "baud_rate": 250000,
  "dry_run": true
}

Response:

{
  "commands_streamed": 100,
  "total_commands": 100,
  "dry_run": true
}

All endpoints return non-2xx responses (400/404/502) with a {"detail": "..."} payload when validation fails or the underlying engine reports an error. Use FastAPI's autogenerated docs at /docs for interactive exploration.