KDM-1 developer API
Read scale weight, stream over TCP, send tare and zero commands, and integrate label printing.
Read your first weight
Connect the device to the LAN. Find its IPv4 address in the router client list or the device network screen. Replace the example address with yours. Reading weight requires no username or password.
curl --max-time 5 -i http://192.168.1.50/weightTypical single-scale response:
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
X-Weight-Stable: true
12.345Weight API
GET /weight (also POST /weight): no authentication. Returns an uncached snapshot. Single-scale mode returns 200 text/plain and the number in the configured source units; it does not convert units.
- For an internal sensor, unstable weight returns
UNSTABLEandX-Weight-Stable: false. A stable reading also includesX-Weight-Last-Stable. - For external sources,
X-Weight-Stable: trueis this interface’s default; it alone does not establish stability or freshness. - A serial query error can appear in
X-Weight-Erroreven with HTTP 200. An unparseable value is not zero. - Memory allocation failure or an oversized Modbus response returns 500. Resource pressure can return 503; back off before retrying.
Multiple scales over RS-485
When Modbus is configured with a scale list, /weight returns 200 application/json without authentication. Each address has its own entry; null means no valid reading, not zero.
{"values":[{"id":1,"weight":12.340},{"id":2,"weight":null}]}Addresses, registers and decimal places are configured during installation. Single-scale stability headers are not part of this Modbus response.
Read the last captured event
GET /weightA (also POST /weightA): no authentication; 200 application/json. Returns the last event captured for this interface and clears it on read. It is neither a continuous weight reading nor an event queue.
{"weight":12.345}
// Modbus example:
{"1":12.340,"2":null}
// No available event:
{}An internal failure to take the event can also return {}. This response is not proof that no event occurred. Use one consumer; do not treat retries as side-effect-free reads.
Stream weight to SCADA
When streaming is enabled, connect to the configured TCP port; the default is 1001. No authentication. Payload formatting and line endings are configurable; agree them with the installer.
nc 192.168.1.50 1001Default commands: W / READ / WEIGHT to read, T / TARE to tare and Z / ZERO to zero. End commands with CR or LF. An unterminated line is parsed after 200 ms without input; lines over 63 bytes are discarded. Refused commands return ERR. Tare and zero require a local source address and pass freshness and stability checks.
Read, tare and zero commands
All three routes use POST: /api/scale/weight, /api/scale/tare, /api/scale/zero. They require HTTP Basic with a configured administrator account and a request-origin check. A native local client can send an Origin matching Host; a valid session CSRF token is another option. An operator account cannot use these commands.
curl --max-time 5 --user "$KDM_ADMIN_USER" \
-H "Origin: http://192.168.1.50" -X POST \
"http://192.168.1.50/api/scale/weight?confirm=1"curl prompts for the password. Even the read command requires confirm=1; it sends a command to the indicator and does not return a numeric reading. Read the value separately through /weight.
{"success":true,"command":"weight"}
{"success":false,"command":"zero","error":"refused: scale is loaded"}Check success even with HTTP 200. Missing confirmation returns 400 Missing confirm=1; missing or invalid credentials: 401; wrong role or origin: 403; authentication rate limit: 429; unhealthy storage or resource pressure: 503. Tare and zero require a stable reading less than one second old. Zero also requires weight within the configured zero range.
Label printing
A native LAN client interface, not browser JavaScript. It uses HTTP on a trusted network, without Basic authentication. Target the IPv4 address of the business Wi-Fi or Ethernet interface; AP and WireGuard-only destinations are excluded. The peer must have a private or link-local address. Every request needs X-ScalesBridge-Client: tsd-production-v1 and a numeric Host matching the destination and port. Browser headers such as Origin and Referer are rejected.
1. Capabilities and token: GET /api/v1/printer/capabilities without a body. Returns JSON including raster_version, transport, language, dpi, width_dots, max_height_dots, max_job_bytes, generation, print_token, token_ttl_seconds. Printing must already be enabled and configured. The token lasts 300 seconds; a new acquisition rotates it for that peer. Keep token and sequence only in memory.
curl --max-time 5 -H "X-ScalesBridge-Client: tsd-production-v1" \
http://192.168.1.50/api/v1/printer/capabilities2. Submit a job: POST /api/v1/print-jobs with the headers below. Persist the ID, content and SHA-256 before submission; never automatically retry a POST.
X-ScalesBridge-Client: tsd-production-v1
Host: 192.168.1.50
X-Print-Token: <current token>
X-Print-Sequence: <increasing positive uint32>
Content-Type: application/octet-stream
Content-Length: <exact byte count>
X-Job-Id: <saved unique ID>
X-Content-SHA256: <64 lowercase hex characters>
X-Bridge-Generation: <generation from capabilities>
X-Raster-Width: <width_dots from capabilities>
X-Raster-Height: <height within max_height_dots>
X-Copies: 1The body is raw monochrome raster: row-major, one bit per pixel, MSB first, 1 means black, each row padded to whole bytes. Size: ceil(width / 8) * height; at most 512 KiB and within reported limits. Chunked transfer is rejected. The sequence must increase and is consumed even if a later validation fails.
3. Query the result: GET /api/v1/print-jobs?job_id=<saved-id> with the client marker, Host and token; no sequence or body. JSON includes job_id, sha256, generation, state, bytes_sent, physical_print_confirmation. Match the job identity and original generation. TRANSMITTED means transport bytes, not a physically printed label. RESULT_UNKNOWN, disconnects or missing history require operator review; never automatically resubmit. RAM retains up to 16 jobs and storage the most recent one; there is no retention-time guarantee.
Common print errors
| HTTP | Code | Action |
|---|---|---|
| 403 | lan_print_forbidden | Peer, destination, Host or client/browser headers rejected |
| 401 | print_token_invalid | Refresh the token before querying status |
| 400 | invalid_print_sequence / invalid_raster_metadata / invalid_raster_content_type | Correct sequence, dimensions, headers or body length |
| 409 | print_sequence_replayed / job_id_content_conflict / capabilities_changed | Check sequence, job identity and generation; no automatic replay |
| 409 | configure_enabled_printer | Enable and configure the printer |
| 429 | print_clients_busy / print_token_rate_limited | Back off using Retry-After |
| 404 | job_not_found_no_retry_permission | No retained result; do not automatically reprint |
| 503 | printer_busy | Printer busy; this is not print confirmation |
Networking and remote access
The device can join Wi-Fi, provide its own Wi-Fi network or use Ethernet. HTTP and TCP streaming are intended for a controlled network. Basic credentials are not encrypted over HTTP; do not expose these ports to the internet.
An outbound WireGuard tunnel can be configured during installation without inbound port forwarding at the business. The print API’s local-destination restrictions still apply. Access details are supplied with the device; factory passwords are not published here.
Updates and interface version
Reviewed against firmware 1.0.20+24 source on 16 November 2026. This is a source review; check the version installed on a particular device before integration. Firmware updates run over the network at night. Automatic rollback depends on the bootloader support on that device.
For printing, check raster_version and preserve generation exactly as returned. A generation change requires fetching capabilities again; it never authorizes replay of an earlier job. Configuration, calibration and diagnostics endpoints are outside this public contract.
Troubleshooting
| Symptom | Check |
|---|---|
| Cannot connect | IP, power, network selection and firewall; TCP streaming is separately enabled and configured. |
| Missing or nonnumeric weight | Measurement source and protocol; null or UNSTABLE does not mean zero. |
| Tare or zero refused | Administrator role, request origin, confirm=1, freshness, stability and zero range. |
| Unknown print result | Query by job ID and match hash and generation. Inspect the physical result before requesting a new print. |
Integration support
Send the device version, scale model and a request/response example with credentials removed.