Appearance
Authentication
Every request is authenticated with a Token header and a Fingerprint header.
Headers
| Header | Rules |
|---|---|
Token | Exactly 20 characters, [A-Za-z0-9]. Issued when the camera is created. See getting a token. |
Fingerprint | 16 to 64 characters. Generated by the camera and stable for the device's lifetime. |
Both are required on every request. Every request also needs a non-empty User-Agent header that names your firmware and version, for example MyCam/1.2.0. Without it the request is rejected with 400.
bash
curl https://camera-service.prusa3d.com/v1/camera-info \
-H "Token: $TOKEN" -H "Fingerprint: $FINGERPRINT" -H "User-Agent: MyCam/1.2.0"Choosing a fingerprint
Generate the fingerprint on the device and keep it the same for the device's whole lifetime. A good source is a hash of the MAC address or the serial number. Do not generate a new random value on each boot: store it permanently, or derive it from a stable identifier.
Binding
The first authenticated call to any of the three endpoints (GET /v1/camera-info, PUT /v1/camera-info, PUT /v1/snapshot) binds the fingerprint to the token permanently. After that, a request with a different fingerprint gets 403.
To move a token to another device, delete the camera and create a new one.
Registration window
The first authenticated call must arrive within 15 minutes of creating the camera. After that the token stops working and the camera disappears. See getting a token.
Query parameters
The ?token= and ?fingerprint= query parameters work too. Prefer headers, because query strings end up in logs and browser history.
Keep the fingerprint 16 to 64 characters. A fingerprint longer than 64 characters is currently rejected with a server error (500) on the first call, so do not retry: shorten it.
Authentication errors
| Status | Meaning |
|---|---|
| 400 | User-Agent header missing or empty |
| 401 | Token or Fingerprint header missing |
| 403 | Unknown token, fingerprint mismatch, or registration window expired |
| 422 | Token not 20 characters, or fingerprint shorter than 16 |
On /v1/snapshot, a missing or empty Fingerprint or Token may be answered by the upload gateway, without a JSON body. Full bodies and troubleshooting are in errors.