Skip to main content

Model creation API

The public Spectral Model API reference is generated from an allowlisted OpenAPI schema at docs-site/openapi/spectral-openapi.json.

This reference intentionally documents only model creation workflows:

  • Create an empty construct model.
  • Add structural nodes, frames, areas, materials, sections, supports, members, and units.
  • Upload or import an existing model payload.
  • Fetch the viewer-ready model payload after creation.

Generation workflow

npm run openapi:lint
npm run gen-api
npm run build

The schema is produced by the deterministic FastAPI export and filtered for the public model-creation operation allowlist:

import backend.main as main
schema = main._fastapi_app.openapi()

Reference shape

Generated endpoint pages expose:

  • HTTP method and path.
  • Short endpoint description.
  • Request parameters and request body.
  • Response statuses.
  • Schema and example views.
  • Authentication and permission notes.

Use Errors and Create a model for shared workflow guidance.

Do not edit files under docs/api/rest/generated by hand. Update backend route metadata or schemas, export OpenAPI again, and rerun the generator.