Download OpenAPI specification:Download
The Formlabs Local API is designed for integrations that want to automate job preparation, getting local-network printer status, or sending jobs to Formlabs printers without launching the PreForm graphical user interface. A server application must be installed and run on a user's computer to use this API.
Example use cases:
This API uses RESTful principles. This means the API is organized around resources and collections of resources. Resources and collections are each available at their own URI. You can interact with these resources using standard HTTP Methods on the resource's URI.
Example endpoint:
GET http://localhost:44388/scene/
Responses from the API server will be in JSON and are documented throughout the reference docs. This API is described by an OpenAPI Specification. This interactive documentation is automatically generated from the specification file.
All Local API integrations involve starting the PreFormServer background application to expose its HTTP API, then making local HTTP API calls in your own code. This application is like PreForm, Formlabs' regular job preparation application, but it does not open a graphical window, and interaction is done via HTTP API requests. The PreFormServer application is supported on Windows and MacOS with separate downloads for each Operating System.
The PreFormServer application can be downloaded from the Formlabs API downloads and release notes page. After downloading, unzip the file and move the application to the desired location on your computer. Any location can be used as the path to the application should be referenced from your integration code.
In the current release, we also recommend adding the PreFormServer application the users' antivirus software exception list or explicitly whitelisting the application in the security settings of MacOS.
On MacOS, you can use the following terminal command to whitelist the PreFormServer application:
xattr -r -d com.apple.quarantine PreFormServer.app
The PreFormServer application can started manually from your Operating System's command prompt or terminal,
but most integrations will start the application programatically from integration code.
By default the HTTP Server will listen on port 44388, but this can be changed by passing in
a different port number as the command line argument --port
to the PreFormServer application.
The HTTP API server started by the PreFormServer application cannot immediately respond to requests.
When the server is ready to accept requests, it will output READY FOR INPUT
in the standard output.
For example, running the PreFormServer application on Windows from the command prompt:
PreFormServer.exe
will output something like the following:
starting HTTP server
Listening...
HTTP server listening on port 44388
READY FOR INPUT
The code to make HTTP API requests to a running PreFormServer can be written directly in your integration code or by using a generated library that does the API calls. The endpoints and format of the HTTP API are described on this page and in the openapi.yaml file. Formlabs provides an example Python library that handles the setup and request formatting.
The PreForm Server is stateful in that while it is running, it keeps a cache of the current scene and requests will use the cached scene and possibly modify it. For example, initially a scene may be empty and then if a load model request is made then the cached scene will have one model loaded. Calling the load model requests again will load another copy of the model resulting in two models in the cached scene.
Unless otherwise stated, API calls are blocking: the HTTP request will not return until the operation has completed. Some requests like running the auto support action on a scene with many complicated models could take over 1 minute (depending on computer resources). The Server has a timeout of 10 minutes for all requests.
Requests made asynchronously will use the last cached state. For example, if a “get scene” request is made during a “auto support” request that has not finished, then the “get scene” request will return data that will not include the auto support changes.
When saving and loading files, the local API inputs expect full operating system paths to local files on disk.
Correct file path:
C:\Projects\Models\part.stl
Incorrect file paths:
.\Models\part.stl
%ENV_VAR%\part.stl
part.stl
https://filestorage.com/part.stl
Conventional HTTP response codes are used to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided. Codes in the 5xx range indicate an error with Formlabs' servers.
The HTTP Server that PreForm uses to communicate is only exposed to the local network of your computer and not to the public Internet, unless you have configured your computer to expose the port running the PreForm Server to the Internet.
Some requests require an Internet connection, require Dashboard login, and make web requests to perform their action (such as printing to a remote printer).
List of previously discovered device statuses
By default, only locally discovered printer names are returned. To include your Fleet Control queues or printers registered to your Dashboard account, you must be logged in and have an Internet connection. Use the Login endpoint to authenticate with Formlabs Web Services.
{- "count": 0,
- "devices": [
- {
- "id": "string",
- "product_name": "string",
- "status": "string",
- "is_connected": true,
- "connection_type": "UNKNOWN",
- "ip_address": "string",
- "firmware_version": "string"
}
]
}
Get a previously discovered device's status
id required | string The unique identifier of the printer |
{- "id": "string",
- "product_name": "string",
- "status": "string",
- "is_connected": true,
- "connection_type": "UNKNOWN",
- "ip_address": "string",
- "firmware_version": "string"
}
Discover new devices on the network
timeout_seconds | integer Number of seconds to wait when discovering devices |
ip_address | string Local network IP address to attempt to discover a device at |
{- "timeout_seconds": 10
}
{- "count": 0,
- "devices": [
- {
- "id": "string",
- "product_name": "string",
- "status": "string",
- "is_connected": true,
- "connection_type": "UNKNOWN",
- "ip_address": "string",
- "firmware_version": "string"
}
]
}
Create a new scene
Create a scene with a given printing setup. For a full list of possible settings, call the GET /list-materials/ endpoint
machine_type required | string The machine type of the scene |
material_code required | string The material code of the scene |
print_setting | string The print setting of the scene |
required | string or number The slice thickness of the scene |
{- "machine_type": "FORM-4-0",
- "material_code": "FLGPBK05",
- "print_setting": "DEFAULT",
- "layer_thickness_mm": 0.025
}
{- "models": [
- {
- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
], - "scene_settings": {
- "machine_type": "string",
- "material_code": "string",
- "print_setting": "string",
- "layer_thickness_mm": "ADAPTIVE"
}, - "material_usage": {
- "volume_ml": 0,
- "unsupported_volume_ml": 0
}, - "layer_count": 0
}
Load a .form file and create a new scene from it
Full path to the .form file to load
file required | string |
{- "file": "C:\\Users\\user\\Desktop\\test.form"
}
{- "models": [
- {
- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
], - "scene_settings": {
- "machine_type": "string",
- "material_code": "string",
- "print_setting": "string",
- "layer_thickness_mm": "ADAPTIVE"
}, - "material_usage": {
- "volume_ml": 0,
- "unsupported_volume_ml": 0
}, - "layer_count": 0
}
Update a model's properties
id required | string The unique identifier of the model |
Model properties to update
name | string The name of the model used within job preparation. |
object (ScenePositionModel) The global position within the build volume of a printer of the model in the scene | |
EulerAnglesModel (object) or TransformMatrixModel (object) or DirectionVectorsModel (object) (OrientationModel) The orientation of the model in the scene. It can be specified using one of the following: Euler angles, a transform matrix, or direction vectors. | |
scale | number The scale factor to apply to the model |
units | string (UnitsModel) Enum: "MILLIMETERS" "INCHES" The units of the model |
{- "position": {
- "x": 10,
- "y": 1,
- "z": 2
}
}
{- "error": {
- "code": "string",
- "message": "string"
}
}
Duplicate a model
id required | string The unique identifier of the model |
count | integer Number of duplicates to create |
{- "count": 0
}
{- "models": [
- {
- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
], - "scene_settings": {
- "machine_type": "string",
- "material_code": "string",
- "print_setting": "string",
- "layer_thickness_mm": "ADAPTIVE"
}, - "material_usage": {
- "volume_ml": 0,
- "unsupported_volume_ml": 0
}, - "layer_count": 0
}
Replace a model currently in the scene with a new model, copying the existing models setup and supports
id required | string The unique identifier of the model |
file | string Full path to the file to load |
repair_behavior | string (RepairBehaviorModel) Default: "ERROR" Enum: "REPAIR" "ERROR" "IGNORE" The behavior to use when loading a broken model |
{- "file": "string",
- "repair_behavior": "REPAIR"
}
{- "warnings": [
- "string"
], - "model_properties": {
- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
}
Import a model into the current scene
file required | string Full path to the file to load |
repair_behavior | string (RepairBehaviorModel) Default: "ERROR" Enum: "REPAIR" "ERROR" "IGNORE" The behavior to use when loading a broken model |
name | string The name of the model used within job preparation. |
object (ScenePositionModel) The global position within the build volume of a printer of the model in the scene | |
EulerAnglesModel (object) or TransformMatrixModel (object) or DirectionVectorsModel (object) (OrientationModel) The orientation of the model in the scene. It can be specified using one of the following: Euler angles, a transform matrix, or direction vectors. | |
scale | number Default: 1 The scale factor to apply to the model |
units | string (ImportUnitsModel) Default: "DETECTED" Enum: "DETECTED" "MILLIMETERS" "INCHES" The units of the model |
{- "file": "C:\\Users\\user\\Desktop\\test.stl"
}
{- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
Run auto orient operation
Models to run the auto orient operation on
required | Select all models (string) or Array of Apply to a list of specific models (strings) (ModelsSelectionModel) |
{- "models": "ALL"
}
{- "error": {
- "code": "string",
- "message": "string"
}
}
Run auto support operation
Models to run the auto support operation on
required | Select all models (string) or Array of Apply to a list of specific models (strings) (ModelsSelectionModel) |
raft_type | string Enum: "FULL_RAFT" "MINI_RAFTS" "NONE" The type of raft to apply to the models |
raft_label_enabled | boolean Whether to enable raft labeling |
breakaway_structure_enabled | boolean Whether to enable breakaway structure |
density | number >= 0 The density of the supports |
touchpoint_size_mm | number >= 0 The size of the touchpoints |
internal_supports_enabled | boolean Whether to enable internal supports |
raft_thickness_mm | number >= 0 The thickness of the raft |
slope_multiplier | number >= 0 The slope multiplier |
height_above_raft_mm | number >= 0 |
z_compression_correction_mm | number >= 0 |
early_layer_merge_mm | number >= 0 |
{- "models": "ALL"
}
{- "error": {
- "code": "string",
- "message": "string"
}
}
Run auto layout operation. Only applies to SLA-type scenes like the Form 4
Models to run the auto layout operation on
required | Select all models (string) or Array of Apply to a list of specific models (strings) (ModelsSelectionModel) |
model_spacing_mm | number >= 0 Minimum (non-zero) distance between models in the scene. |
allow_overlapping_supports | boolean Whether to allow rafts to overlap. |
lock_rotation | boolean Whether to keep model rotation about Z fixed during layout. |
build_platform_2_optimized | boolean Whether to optimize the build platform for two models. |
{- "models": "ALL",
- "model_spacing_mm": 1,
- "allow_overlapping_supports": false,
- "lock_rotation": false,
- "build_platform_2_optimized": false
}
{- "models": [
- {
- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
], - "scene_settings": {
- "machine_type": "string",
- "material_code": "string",
- "print_setting": "string",
- "layer_thickness_mm": "ADAPTIVE"
}, - "material_usage": {
- "volume_ml": 0,
- "unsupported_volume_ml": 0
}, - "layer_count": 0
}
Run auto pack operation. Only applies to SLS-type scenes like the Fuse 1+
Auto pack parameters
model_spacing_mm | number >= 0 The minimum spacing between models when packing |
{- "model_spacing_mm": 0
}
{- "models": [
- {
- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
], - "scene_settings": {
- "machine_type": "string",
- "material_code": "string",
- "print_setting": "string",
- "layer_thickness_mm": "ADAPTIVE"
}, - "material_usage": {
- "volume_ml": 0,
- "unsupported_volume_ml": 0
}, - "layer_count": 0
}
{- "models": [
- {
- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
], - "scene_settings": {
- "machine_type": "string",
- "material_code": "string",
- "print_setting": "string",
- "layer_thickness_mm": "ADAPTIVE"
}, - "material_usage": {
- "volume_ml": 0,
- "unsupported_volume_ml": 0
}, - "layer_count": 0
}
Get a model's properties
id required | string The unique identifier of the model |
{- "id": "string",
- "name": "string",
- "position": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "orientation": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "scale": 0,
- "units": "MILLIMETERS",
- "bounding_box": {
- "min_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}, - "max_corner": {
- "x": 0,
- "y": 0,
- "z": 0
}
}, - "original_file": "string",
- "visible": true,
- "has_supports": true,
- "in_bounds": true,
- "raw_mesh_hash": "string",
- "canonical_model_hash": "string"
}
{- "per_model_results": {
- "property1": {
- "cups": 0,
- "unsupported_minima": 0,
- "undersupported": true,
- "has_seamline": true
}, - "property2": {
- "cups": 0,
- "unsupported_minima": 0,
- "undersupported": true,
- "has_seamline": true
}
}
}
Save the current scene to a .form file
Full path where the file should be saved
file required | string |
{- "file": "C:\\Users\\user\\Desktop\\test.form"
}
{- "error": {
- "code": "string",
- "message": "string"
}
}
Save a screenshot of the current scene.
Full path where the image should be saved
file required | string^.*\.png$ The file path to save the .png screenshot to |
view_type | string Default: "ZOOM_ON_MODELS" Enum: "ZOOM_ON_MODELS" "FULL_BUILD_VOLUME" "FULL_PLATFORM_WIDTH" The type of view to use when taking the screenshot |
Select all models (string) or Array of Apply to a list of specific models (strings) (ModelsSelectionModel) |
{- "file": "C:\\Users\\user\\Desktop\\screenshot.png"
}
{- "error": {
- "code": "string",
- "message": "string"
}
}
Upload the current scene to a printer or Fleet Control.
By default, only locally discovered printer names or local IP addresses are supported. To upload prints remotely to your Fleet Control queue or printers registered to your Dashboard account, you must be logged in and have an Internet connection. Use the Login endpoint to authenticate with Formlabs Web Services.
printer required | string Printer serial name, IP address, or Fleet Control Queue ID |
job_name required | string |
{- "printer": "10.35.15.12",
- "job_name": "Test Job"
}
{- "job_id": "string"
}
Operations related to remote access and printing that require Internet access and authentication with Formlabs Web Services."
Log in to Formlabs Web Services using an existing formlabs.com account.
User credentials
username required | string |
password required | string |
{- "username": "username",
- "password": "password"
}
{- "access_token": "string",
- "refresh_token": "string"
}
Upload the current scene to a printer or Fleet Control.
By default, only locally discovered printer names or local IP addresses are supported. To upload prints remotely to your Fleet Control queue or printers registered to your Dashboard account, you must be logged in and have an Internet connection. Use the Login endpoint to authenticate with Formlabs Web Services.
printer required | string Printer serial name, IP address, or Fleet Control Queue ID |
job_name required | string |
{- "printer": "10.35.15.12",
- "job_name": "Test Job"
}
{- "job_id": "string"
}
List of previously discovered device statuses
By default, only locally discovered printer names are returned. To include your Fleet Control queues or printers registered to your Dashboard account, you must be logged in and have an Internet connection. Use the Login endpoint to authenticate with Formlabs Web Services.
{- "count": 0,
- "devices": [
- {
- "id": "string",
- "product_name": "string",
- "status": "string",
- "is_connected": true,
- "connection_type": "UNKNOWN",
- "ip_address": "string",
- "firmware_version": "string"
}
]
}
Get a previously discovered device's status
id required | string The unique identifier of the printer |
{- "id": "string",
- "product_name": "string",
- "status": "string",
- "is_connected": true,
- "connection_type": "UNKNOWN",
- "ip_address": "string",
- "firmware_version": "string"
}
Discover new devices on the network
timeout_seconds | integer Number of seconds to wait when discovering devices |
ip_address | string Local network IP address to attempt to discover a device at |
{- "timeout_seconds": 10
}
{- "count": 0,
- "devices": [
- {
- "id": "string",
- "product_name": "string",
- "status": "string",
- "is_connected": true,
- "connection_type": "UNKNOWN",
- "ip_address": "string",
- "firmware_version": "string"
}
]
}
List all available materials and material settings by printer type.
The returned JSON has 3 layers: Printer types (e.g. "Form 4"), Materials (e.g. "Black V5"), and Material Setting (e.g. "0.025mm" or "0.100mm (Legacy)"). These "label" strings at each level are the preferred way of referring to that printer types, materials, and settings. They can presented in a UI as a 3-level dropdown menu, or a flat filtered list. This list is static (it will not change for a given version of the PreFormServer executable).
Each value has scene_settings
with all data needed to create a new scene. It can be passed directly to a /scene/ POST to create a scene for that printer, material, and materialSettings.
{- "printer_types": [
- {
- "label": "string",
- "materials": [
- {
- "label": "string",
- "material_settings": [
- {
- "label": "string",
- "scene_settings": {
- "machine_type": "string",
- "material_code": "string",
- "print_setting": "string",
- "layer_thickness_mm": "ADAPTIVE"
}
}
]
}
]
}
]
}