Fret API
Version 1.0.0
Everything the interface does goes through this JSON API, which you can use from scripts, home automation or your own tools. The command line uses it too.
- Format: JSON in and out, dates in RFC 3339 (
2026-11-12T14:02:00Z), sizes in bytes (-1when unknown), speeds in bytes per second. - Vocabulary: the API uses the technical words. A shipment is a
package, a parcel afile, the dock thequeue, a carrier ahoster, a forwarder adebrid(see the glossary). - Parcels are identified by their numeric
idor by their number:/files/42and/files/FR-0042are the same parcel. - Credentials: an API token in
Authorization: Bearer fret_…, created in Settings › API tokens, or the session cookie of the interface. WithFRET_AUTH=none, none. Without valid credentials, private operations answer401 unauthorized. - Cross-site requests: requests that change something and come from another website (browser
header
Sec-Fetch-Site: cross-site) are refused. Scripts and command-line tools are not affected.
Errors
An error answers with an HTTP status and a body:
{ "error": { "code": "invalid_state", "message": "action not possible in the file's current state" } }The code is stable and meant for programs; the message is plain English, for humans.
| Code | Status | Meaning |
|---|---|---|
bad_json, invalid_input, invalid_name, invalid_settings |
400 | The request is malformed or a value is out of bounds |
unknown_plugin |
400 | No carrier or forwarder by this name |
weak_password |
400 | Password shorter than 8 characters |
unauthorized |
401 | Sign-in or token required |
bad_credentials |
401 | Wrong password |
not_found |
404 | No such resource, or no such API route |
invalid_state |
409 | Not possible in the current state of the parcel or shipment |
not_storable |
409 | The shipment still has parcels that are not delivered |
setup_required |
409 | No password set yet |
already_set_up |
409 | The password is already set |
auth_disabled |
409 | Not available with FRET_AUTH=none |
too_large |
413 | Request body too large |
too_many_attempts |
429 | Too many sign-in attempts, wait a minute |
internal |
500 | Unexpected error, see the logs |
Live events
GET /events is a
Server-Sent Events stream: the
interface uses it to update the dock live.
curl -N -H "Authorization: Bearer $TOKEN" http://localhost:8080/api/v1/eventsThe first event is hello ({"version": "1.0.0"}). Every other event comes under its type, with a
JSON envelope {id, type, at, data}:
| Event | data |
When |
|---|---|---|
queue.state |
QueueState |
Settings, open/closed state, gauge, active transfers |
queue.reordered |
{} |
The order of the shipments changed: reload /queue |
package.updated |
Package |
A shipment was created or changed |
package.removed |
{id} |
A shipment was deleted |
package.stored |
{id} |
A shipment left the dock for the warehouse |
file.updated |
File |
A parcel changed status or information |
file.removed |
{id, packageId} |
A parcel was deleted |
progress |
Progress |
Progress of the running transfers, 4 times per second |
A : ping comment every 25 seconds keeps the connection open, and retry: 3000 asks the client to
reconnect after 3 seconds if it drops. Events are not replayed: after a reconnection, read /queue
again.
Base URL
http://localhost:8080/api/v1Authentication
- Cookie fret_session
- Bearer
Token created in Settings › API tokens
Operations
Access
First run, sign-in, sessions and API tokens.
- GETServer health
/health - GETAuthentication state
/auth/state - POSTFirst run: sets the password and opens a session
/auth/setup - POSTSign in (5 attempts, then 1 per minute and per IP address)
/auth/login - POSTSign out
/auth/logout - POSTChanges the password and closes every session
/auth/password - GETAPI tokens
/tokens - POSTCreates a token (its value is only returned here)
/tokens - DELETERevokes a token
/tokens/{id}
The dock
The state of the dock and its live event stream.
Shipments
Create, reorder, hold and delete shipments (package).
- POSTNew shipment
/packages - PATCHRenames, changes the priority of or moves a shipment
/packages/{id} - DELETEDeletes a shipment (delivered files stay in the warehouse unless files=true)
/packages/{id} - POSTHolds every parcel of the shipment
/packages/{id}/pause - POSTReleases the held parcels of the shipment
/packages/{id}/resume - POSTShips a collected shipment awaiting confirmation
/packages/{id}/confirm - POSTUnpacks again, with an optional new password
/packages/{id}/unpack
Warehouse
Store delivered shipments, search the register, read the stock.
Parcels
One parcel (file) with its segments and tracking history.
- GETParcel detail (shipment, segments, history)
/files/{id} - DELETERemoves a parcel (deletes the partial file; a delivered parcel stays in the warehouse)
/files/{id} - POSTHolds a parcel (a running transfer keeps its progress)
/files/{id}/pause - POSTReleases a parcel or sends it back to the dock
/files/{id}/resume
Carriers and accounts
Carriers, forwarders, their accounts and the check of links.
- POSTChecks the availability of links (100 at most)
/links/check - GETCarriers and forwarders, with their accounts
/carriers - POSTAdds an account (checked right away)
/accounts - PATCHEdits an account (a new key is checked)
/accounts/{id} - DELETEDeletes an account
/accounts/{id} - POSTChecks an account with the service
/accounts/{id}/check
Settings
Dock, unpacking and collection settings.