-
Notifications
You must be signed in to change notification settings - Fork 0
HTTP REST API
The HTTP REST API is the primary control interface for modern FlashForge printers (Adventurer 5M, 5M Pro, AD5X). It operates on port 8898 and provides a modern, JSON-based interface for printer control.
| Property | Value |
|---|---|
| Port | 8898 |
| Protocol | HTTP/1.1 |
| Content-Type | application/json (most endpoints) |
| Authentication | serialNumber + checkCode |
All HTTP API endpoints require authentication. See Authentication for complete details.
JSON Body Authentication (most endpoints):
{
"serialNumber": "YOUR_SERIAL_NUMBER",
"checkCode": "YOUR_CHECK_CODE"
}Header Authentication (uploadGcode only):
serialNumber: YOUR_SERIAL_NUMBER
checkCode: YOUR_CHECK_CODE
All responses use a standard JSON envelope:
Success:
{
"code": 0,
"message": "Success"
}Error:
{
"code": <non-zero>,
"message": "Error description"
}| Code | Message | Description |
|---|---|---|
| 0 | Success | Operation completed successfully |
| 1 | Error | Generic error occurred |
| 2 | Invalid parameter | Request payload contains invalid parameters |
| 3 | Unauthorized | Authentication failed (invalid serial or check code) |
| 4 | Not found | Requested resource or file not found |
| 5 | Busy | Printer is busy with another operation |
Retrieves comprehensive information about the printer's current status.
Method: POST
Request:
POST http://10.0.0.42:8898/detail
Content-Type: application/json
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345"
}Response:
{
"code": 0,
"message": "Success",
"detail": {
"autoShutdown": "open",
"autoShutdownTime": 30,
"cameraStreamUrl": "http://10.0.0.43:8080/stream",
"chamberFanSpeed": 100,
"chamberTargetTemp": 0,
"chamberTemp": 45,
"coolingFanSpeed": 100,
"cumulativeFilament": 120.5,
"cumulativePrintTime": 1234,
"currentPrintSpeed": 100,
"doorStatus": "close",
"errorCode": "",
"estimatedLeftLen": 0,
"estimatedLeftWeight": 0,
"estimatedRightLen": 12500,
"estimatedRightWeight": 35.5,
"estimatedTime": 3600,
"externalFanStatus": "open",
"fillAmount": 20,
"firmwareVersion": "v3.1.3",
"flashRegisterCode": "ABCDEFGH",
"internalFanStatus": "open",
"ipAddr": "10.0.0.43",
"leftFilamentType": "",
"leftTargetTemp": 0,
"leftTemp": 0,
"lightStatus": "open",
"location": "Office",
"macAddr": "00:11:22:33:44:55",
"name": "CustomPrinterName",
"nozzleCnt": 1,
"nozzleModel": "0.4mm",
"nozzleStyle": 1,
"pid": 123,
"platTargetTemp": 60,
"platTemp": 58,
"polarRegisterCode": "IJKLMNOP",
"printDuration": 1800,
"printFileName": "Benchy.gcode",
"printFileThumbUrl": "http://10.0.0.43:8898/thumb/Benchy.gcode",
"printLayer": 50,
"printProgress": 0.45,
"printSpeedAdjust": 100,
"remainingDiskSpace": 1024,
"rightFilamentType": "PLA",
"rightTargetTemp": 210,
"rightTemp": 209,
"status": "printing",
"targetPrintLayer": 100,
"tvoc": 0,
"zAxisCompensation": 0
}
}Key Fields:
| Field | Type | Description |
|---|---|---|
| status | string | Current printer state (see Machine States below) |
| printProgress | float | Print progress ratio (0.0 - 1.0) |
| printLayer | int | Current print layer |
| targetPrintLayer | int | Total layers in print |
| platTemp | float | Current bed temperature (C) |
| platTargetTemp | float | Target bed temperature (C) |
| leftTemp / rightTemp | float | Current extruder temperature(s) (C) |
| leftTargetTemp / rightTargetTemp | float | Target extruder temperature(s) (C) |
| lightStatus | string | LED status ("open" or "close") |
| firmwareVersion | string | Firmware version string |
| name | string | Printer name |
| tvoc | int | TVOC level (5M Pro only) |
Retrieves the availability status of various controllable printer features.
Method: POST
Request:
POST http://10.0.0.42:8898/product
Content-Type: application/json
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345"
}Response:
{
"code": 0,
"message": "Success",
"product": {
"chamberTempCtrlState": 0,
"externalFanCtrlState": 1,
"internalFanCtrlState": 1,
"lightCtrlState": 1,
"nozzleTempCtrlState": 1,
"platformTempCtrlState": 1
}
}| Field | Value | Description |
|---|---|---|
| 0 | Not available/controllable | Feature not present |
| 1 | Available/controllable | Feature is present |
Note: Even if lightCtrlState returns 0, the lightControl_cmd often still functions. This is common with aftermarket LED installations.
Sends various control commands to the printer. This endpoint uses a command/args structure.
Method: POST
Request Format:
POST http://10.0.0.42:8898/control
Content-Type: application/json
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "COMMAND_NAME",
"args": {
// Command-specific arguments
}
}
}Success Response:
{
"code": 0,
"message": "Success"
}Controls the printer's internal LED lighting.
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "lightControl_cmd",
"args": {
"status": "open"
}
}
}| Argument | Values | Description |
|---|---|---|
| status | "open", "close" | Turn LEDs on or off |
Manages the current print job (pause, resume, cancel).
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "jobCtl_cmd",
"args": {
"jobID": "",
"action": "pause"
}
}
}| Argument | Values | Description |
|---|---|---|
| jobID | string | Typically empty |
| action | "pause", "continue", "cancel" | Job action to perform |
Adjusts various printer settings during an active print.
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "printerCtl_cmd",
"args": {
"speed": 100,
"zAxisCompensation": 0.1,
"chamberFan": 255,
"coolingFan": 255
}
}
}| Argument | Range | Description |
|---|---|---|
| speed | 50-150 | Print speed percentage |
| zAxisCompensation | -5.0 to +5.0 | Z-axis offset (mm) |
| chamberFan | 0-255 | Chamber fan speed (0=off) |
| coolingFan | 0-255 | Cooling fan speed (0=off) |
Important - Partial Updates: Do not send default values (like 0) for fields you do not intend to change. Fields omitted from the payload are ignored (internally set to sentinel values like -200). Sending explicit values will overwrite current settings.
Controls the printer's internal and external air circulation/filtration fans.
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "circulateCtl_cmd",
"args": {
"internal": "on",
"external": "off"
}
}
}| Argument | Values | Description |
|---|---|---|
| internal | "on", "off" | Internal circulation fan |
| external | "on", "off" | External exhaust fan |
Availability: 5M Pro only (internal/external fan hardware required).
Controls the printer's integrated camera stream.
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "streamCtrl_cmd",
"args": {
"action": "open"
}
}
}| Argument | Values | Description |
|---|---|---|
| action | "open", "close" | Start or stop the camera stream |
Availability: 5M Pro only (built-in camera required).
Clears printer state dialogs that block further operations. Use this to dismiss on-screen dialogs after:
- Print completes (build plate needs clearing)
- Print is stopped/cancelled (via TCP M26 or HTTP jobCtl_cmd stop)
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "stateCtrl_cmd",
"args": {
"action": "setClearPlatform"
}
}
}| Argument | Value | Description |
|---|---|---|
| action | "setClearPlatform" | Dismiss dialog and reset to ready state |
Availability: 5M Series, AD5X
Sets target temperatures for nozzle, bed, and chamber.
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "temperatureCtl_cmd",
"args": {
"rightNozzle": 210,
"platform": 60
}
}
}| Argument | Range | Description |
|---|---|---|
| rightNozzle | 0-265, -100=off, -200=no change | Main/right nozzle temperature (C) |
| leftNozzle | 0-265, -100=off, -200=no change | Left nozzle temperature (C, dual-extruder) |
| platform | 0-100, -100=off, -200=no change | Bed temperature (C) |
| chamber | 0-60, -100=off, -200=no change | Chamber temperature (C, if supported) |
Note: Use -200 to leave a temperature unchanged (partial update). Use -100 or 0 to turn off a heater.
Changes the printer's display name.
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "reName_cmd",
"args": {
"name": "My Printer"
}
}
}Configures automatic shutdown timing.
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"payload": {
"cmd": "delayClose_cmd",
"args": {
"automaticShutdown": "open",
"shutdownAfterTime": 30
}
}
}| Argument | Values | Description |
|---|---|---|
| automaticShutdown | "open", "close" | Enable or disable auto-shutdown |
| shutdownAfterTime | int | Minutes before shutdown after print completes |
Retrieves a list of the 10 most recently used files stored on the printer.
Method: POST
Request:
POST http://10.0.0.42:8898/gcodeList
Content-Type: application/json
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345"
}Response (5M/5M Pro):
{
"code": 0,
"message": "Success",
"gcodeList": [
"Benchy.3mf",
"CalibrationCube.gcode",
"Vase.gcode"
]
}Response (AD5X):
{
"code": 0,
"message": "Success",
"gcodeListDetail": [
{
"gcodeFileName": "Model.gcode",
"printingTime": 3600,
"totalFilamentWeight": 150.5,
"useMatlStation": true,
"gcodeToolCnt": 4,
"gcodeToolDatas": [
{
"toolId": 0,
"materialName": "PLA",
"materialColor": "#FF0000",
"filamentWeight": 50.2,
"slotId": 0
}
]
}
]
}Retrieves a thumbnail image for a file stored on the printer.
Method: POST
Request:
POST http://10.0.0.42:8898/gcodeThumb
Content-Type: application/json
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"fileName": "Benchy.gcode"
}Response:
{
"code": 0,
"message": "Success",
"imageData": "BASE64_ENCODED_IMAGE_DATA"
}Note: On AD5X printers, use /gcodeList which returns extended file details including thumbnail information.
Initiates a print job for a file already on the printer's storage.
Method: POST
Request:
POST http://10.0.0.42:8898/printGcode
Content-Type: application/json
{
"serialNumber": "SNADVA5MXXXXX",
"checkCode": "12345",
"fileName": "Benchy.gcode",
"levelingBeforePrint": true
}| Parameter | Type | Description |
|---|---|---|
| serialNumber | string | Printer serial number |
| checkCode | string | Printer check code |
| fileName | string | Name of file to print |
| levelingBeforePrint | boolean | Perform auto-leveling before print |
Response:
{
"code": 0,
"message": "Success"
}Note: For AD5X multi-material prints with material station options, use the /control endpoint with newLocalJob_cmd or upload via /uploadGcode with the appropriate headers.
Uploads a file to the printer and optionally starts printing immediately.
Method: POST
Content-Type: multipart/form-data
Headers:
| Header | Description |
|---|---|
| serialNumber | Printer serial number |
| checkCode | Printer check code |
| fileSize | File size in bytes |
| printNow | "0" or "1" (string boolean) |
| levelingBeforePrint | "0" or "1" (string boolean) |
| flowCalibration | "0" or "1" (AD5X only) |
| useMatlStation | "0" or "1" (AD5X only) |
| gcodeToolCnt | Number of tools (AD5X only, integer as string) |
| materialMappings | Base64-encoded JSON array (AD5X only) |
| firstLayerInspection | "0" or "1" (AD5X only, firmware dependent) |
| timeLapseVideo | "0" or "1" (AD5X only, firmware dependent) |
Request (5M/5M Pro):
POST http://10.0.0.42:8898/uploadGcode
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary
serialNumber: SNADVA5MXXXXX
checkCode: 12345
fileSize: 1234567
printNow: 1
levelingBeforePrint: 1
flowCalibration: 0
useMatlStation: 0
gcodeToolCnt: 0
materialMappings: []
------WebKitFormBoundary
Content-Disposition: form-data; name="gcodeFile"; filename="Benchy.gcode"
Content-Type: application/octet-stream
[binary file content]
------WebKitFormBoundary--Response:
{
"code": 0,
"message": "Success"
}The status field in /detail responses indicates the printer's operational state:
| Status | Description |
|---|---|
| ready | Idle and ready to accept commands |
| busy | Performing non-printing operation (e.g., homing) |
| calibrate_doing | Performing calibration sequence |
| error | Error has occurred |
| heating | Heating nozzle or platform |
| printing | Actively printing |
| working | Alternative printing state (same as printing) |
| pausing | In process of pausing |
| paused | Job paused |
| canceling | In process of canceling |
| cancel | Job cancelled |
| completed | Job finished successfully |
AD5X printers support additional commands for the material station (IFS). See AD5X Documentation for details.
| Command | Description |
|---|---|
| msConfig_cmd | Configure slot material metadata |
| ms_cmd | Load/unload/cancel by slot |
| moveCtrl_cmd | Manual axis movement |
| extrudeCtrl_cmd | Manual extrusion control |
| homingCtrl_cmd | Manual homing control |
| errorCodeCtrl_cmd | Error code management |