Bambu Lab Printer Reverse-Engineering Knowledge Base
Living Document - This knowledge base is continuously extended and updated.
Last updated: 2026-03-22
Table of Contents
- Overview
- Printer Discovery
- MQTT Communication
- HTTPS Communication
- File Uploads
- Printer Commands
- Filament Management
Overview
Bambu Lab printers communicate with third-party applications using three primary protocols:
- SSDP - For network discovery and printer detection
- MQTT - For real-time communication with connected printers
- HTTPS - For cloud communication, firmware updates, and cloud APIs
This knowledge base documents the protocol details, command structures, and data formats used by Bambu Lab devices. Note that HTTP communication uses HTTPS (secure).
Printer Discovery
SSDP (Simple Service Discovery Protocol)
Printers announce themselves on the local network using SSDP multicast messages from port 1900 to ports 1990 and 2021.
Discovery Example
NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
Server: UPnP/1.0
Location: 192.168.2.80
NT: urn:bambulab-com:device:3dprinter:1
USN: <serial_number>
Cache-Control: max-age=1800
DevModel.bambu.com: C12
DevName.bambu.com: 3DP-01P-426
DevSignal.bambu.com: -38
DevConnect.bambu.com: lan
DevBind.bambu.com: free
Devseclink.bambu.com: secure
DevVersion.bambu.com: <firmware version>
DevCap.bambu.com: 1Key Fields
| Field | Description |
Location | Printer IP address |
USN | Unique Serial Number of the printer |
DevVersion.bambu.com | Firmware version |
DevSignal.bambu.com | Wi-Fi signal strength (dBm) |
MQTT Communication
Printers communicate via secure MQTT on port 8883.
Connection Parameters
- Host: Printer IP address
- Port: 8883
- Username:
bblp - Password: Access code
- Protocol: MQTT over TLS
- QoS: 0 (most requests), 1 (critical operations)
- Keepalive: 60 seconds
Certificate Setup
To communicate securely, you need the printer's CA certificate:
echo | openssl s_client -showcerts -connect :8883 2>/dev/null | \ awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/{print $0}' > mqtt_server.crtExtract the second certificate (CA certificate)
awk 'BEGIN {c=0} /BEGIN CERTIFICATE/{c++} {if(c==2) print}' mqtt_server.crt > bbl_ca.crt ```Connect and subscribe to the report topic:
mosquitto_sub --cafile bbl_ca.crt -v -L mqtt://bblp:<ACCESS_CODE>@<PRINTER_IP>:8883/device/<serial>/report --insecureMQTT Topics
Report Topic (Receives Data)
device/{SERIAL}/report - Push updates (asynchronous)
Request Topic (Sends Commands)
device/{SERIAL}/request - Interactive requests (synchronous)
See Printer Commands for detailed command descriptions.
Message Structure
All messages are JSON formatted and must include a unique sequence_id to correlate responses.
Example Request:
{
"system": {
"sequence_id": "2003",
"command": "ledctrl",
"led_node": "chamber_light",
"led_mode": "on"
}
}System Status Codes (in report payload)
- Preparing / Initializing
- Idle
- Running
- Heating
- Printing
- Paused
- Completed
- Error
HTTPS Communication
Bambu Lab APIs communicate over HTTPS through Cloudflare.
API Hosts
All Bambu APIs are hosted through Cloudflare at api.bambulab.com:
Slicer Resource Updates
- Base URL:
https://api.bambulab.com - Paths:
/v1/iot-service/api/slicer/resource?slicer/plugins/cloud=<version>- Returns plugin resources/v1/iot-service/api/slicer/resource?slicer/printer/bbl=<version>- Returns printer resources
OrcaSlicer Custom Headers
Applications add these headers to requests:
X-BBL-Client-Name: OrcaSlicer
X-BBL-Client-Type: slicer
X-BBL-Client-Version: 01.10.01.50
X-BBL-Device-ID: <device-id>
X-BBL-Language: en-US
X-BBL-OS-Type: linux
X-BBL-OS-Version: <kernel-version>File Uploads
Files (G-code/3MF) are uploaded directly to the printer using FTPS (FTP over TLS).
Connection Details
- Protocol: FTPS (Implicit TLS)
- Port: 990
- Username:
bblp - Password: Access code
- Encryption: TLS 1.2+ (Reuse of TLS session IDs is often required)
Upload Process
- Connect to the printer on port 990 using Implicit SSL.
- Authenticate with
bblpand the access code. - Upload the
.gcode.3mffile to the root directory/. - Note: The printer may reject uploads to subdirectories like
/sdcard/.
cURL Example
curl --ftp-ssl --insecure \
--user "bblp:<ACCESS_CODE>" \
--upload-file "model.gcode.3mf" \
"ftps://<PRINTER_IP>:990/"Printer Commands
| Command | JSON (MQTT) | Description |
|---|---|---|
| pushall | | Forces the printer to broadcast current state |
| chamber_light | | Control the chamber light |
| chamber_light2 | | Control second chamber light/night light |
| Start a print | | Start a Print Job Initiates a print using a file uploaded via FTP. Key Parameters:
|
| pause | | Pause current print |
| resume | | Resume paused print |
| stop | | Stop print completely |
| get_version | | Requests version info per module. Response fields:
|
| gcode_line | | Execute a custom G-code command |
| G-code Command | Description |
|---|---|
M140 S60 | Set bed temperature to 60°C |
M104 S220 | Set nozzle temperature to 220°C |
G28 | Home all axes |
M106 S<speed> | Set main cooling fan speed |
M106 P1 S<speed> | Set P1/X1 parts fan speed |
M106 P2 S<speed> | Set auxiliary fan speed |
M106 P3 S<speed> | Set exhaust fan speed |
AMS Mapping Configuration (ams_mapping)
Overview
The ams_mapping parameter is crucial for multi-color print jobs when using the AMS (Automatic Material System). It defines which AMS slot corresponds to each color in your print file. Structure {
"print": {
"ams_mapping": [
-1,
-1,
-1,
1,
0
],
// ... rest of print command
}
}
How AMS Mapping Works
The ams_mapping array uses a reverse indexing system where:
- Array positions represent color indices in your print file (starting from 0)
- Array values represent AMS slot numbers (0-3 for typical 4-slot AMS)
- -1 indicates unused color slots
Key Rules:
- Fixed array length: Always use 5 elements (supports up to 4 colors + padding)
- Right-to-left assignment: Color assignments fill from the end of the array
- Pad with -1: Fill unused positions at the beginning with -1
| Colors | Used Array Pattern | Description |
| 1 color | [-1, -1, -1, -1, X] | Single color uses AMS slot X |
| 2 colors | [-1, -1, -1, X, Y] | Colors map to slots X and Y |
| 3 colors | [-1, -1, X, Y, Z] | Colors map to slots X, Y, and Z |
| 4 colors | [-1, W, X, Y, Z] | Colors map to slots W, X, Y, and Z |
Important Notes
- AMS slot numbers are zero-indexed (0, 1, 2, 3)
- Color indices in your print file start from 0
- The printer will just pause and won't start if the mapping is not correct
- Ensure the specified AMS slots contain the correct filament types and colors
- Always set "use_ams": true when using AMS mapping
- Verify your AMS is properly loaded before sending the print job
Essential Report Fields
When subscribing to the device/{SERIAL}/report topic, the JSON payload contains comprehensive state info:
ams: Details filament in each AMS slot (color, type, remaining %).lights_report: Current state of LEDs.vt_tray: Virtual tray status (for printers without AMS).
Filament Management
AMS Filament Reading
The printer broadcasts AMS status periodically in the /report topic:
{
"ams": {
"ams": [
{
"id": "0",
"humidity": "2",
"humidity_raw": "38",
"temp": "25.4",
"dry_time": 0,
"info": "1001",
"tray": [
{
"id": "0",
"state": 3,
"remain": -1,
"k": 0.019999999552965164,
"n": 1,
"cali_idx": -1,
"total_len": 330000,
"tag_uid": "0000000000000000",
"tray_id_name": "",
"tray_info_idx": "GFL99",
"tray_type": "PLA",
"tray_sub_brands": "",
"tray_color": "161616FF",
"tray_weight": "0",
"tray_diameter": "0.00",
"tray_temp": "0",
"tray_time": "0",
"bed_temp_type": "0",
"bed_temp": "0",
"nozzle_temp_max": "240",
"nozzle_temp_min": "190",
"xcam_info": "000000000000000000000000",
"tray_uuid": "00000000000000000000000000000000",
"ctype": 0,
"cols": [
"161616FF"
]
},
{
"id": "1",
"state": 3,
"remain": 21,
"k": 0.019999999552965164,
"n": 1,
"cali_idx": -1,
"total_len": 330000,
"tag_uid": "8A160AB500000100",
"tray_id_name": "A00-A0",
"tray_info_idx": "GFA00",
"tray_type": "PLA",
"tray_sub_brands": "PLA Basic",
"tray_color": "FF6A13FF",
"tray_weight": "250",
"tray_diameter": "1.75",
"tray_temp": "55",
"tray_time": "8",
"bed_temp_type": "0",
"bed_temp": "0",
"nozzle_temp_max": "230",
"nozzle_temp_min": "190",
"xcam_info": "8813100EE803E8039A99193F",
"tray_uuid": "73B6F9DA7BE24818940EB178AAF8550F",
"ctype": 0,
"cols": [
"FF6A13FF"
]
},
{
"id": "2",
"state": 3,
"remain": -1,
"k": 0.019999999552965164,
"n": 1,
"cali_idx": -1,
"total_len": 330000,
"tag_uid": "0000000000000000",
"tray_id_name": "",
"tray_info_idx": "GFL99",
"tray_type": "PLA",
"tray_sub_brands": "",
"tray_color": "BCBCBCFF",
"tray_weight": "0",
"tray_diameter": "0.00",
"tray_temp": "0",
"tray_time": "0",
"bed_temp_type": "0",
"bed_temp": "0",
"nozzle_temp_max": "240",
"nozzle_temp_min": "190",
"xcam_info": "000000000000000000000000",
"tray_uuid": "00000000000000000000000000000000",
"ctype": 0,
"cols": [
"BCBCBCFF"
]
},
{
"id": "3",
"state": 3,
"remain": -1,
"k": 0.019999999552965164,
"n": 1,
"cali_idx": -1,
"total_len": 330000,
"tag_uid": "0000000000000000",
"tray_id_name": "",
"tray_info_idx": "Ped69f1a",
"tray_type": "PLA",
"tray_sub_brands": "",
"tray_color": "FFFFFFFF",
"tray_weight": "0",
"tray_diameter": "0.00",
"tray_temp": "0",
"tray_time": "0",
"bed_temp_type": "0",
"bed_temp": "0",
"nozzle_temp_max": "240",
"nozzle_temp_min": "190",
"xcam_info": "000000000000000000000000",
"tray_uuid": "00000000000000000000000000000000",
"ctype": 0,
"cols": [
"FFFFFFFF"
]
}
]
}
]
}
}Setting AMS Filaments
To set filament information manually (for third-party spools):
{
"print": {
"sequence_id": "0",
"command": "ams_filament_setting",
"ams_id": 0,
"tray_id": 0,
"tray_info_idx": "GFL99",
"tray_color": "FF0000FF",
"tray_type": "PLA",
"tray_brand_id": "GFL"
}
}Common Profile IDs (tray_info_idx)
| Material | Profile ID |
| Generic PLA | GFL99 |
| Generic PETG | GFL98 |
| Generic ABS | GFL97 |
| Bambu PLA Basic | GFL00 |
| Bambu PLA Matte | GFL01 |
| Bambu Support W | GFA00 |
Important Notes
- Color Format: Always 8 characters (RRGGBBAA), alpha is usually FF
- RFID Override: Official Bambu spools will eventually overwrite manual settings with RFID data
- k-value: Ejection/extrusion coefficient for each slot
This is a living document. If you discover additional protocols or commands, please contact me.
Note: This knowledge base is derived from reverse engineering and experimentation with Bambu Lab devices and third-party applications.
