Skip to content

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 (-1 when unknown), speeds in bytes per second.
  • Vocabulary: the API uses the technical words. A shipment is a package, a parcel a file, the dock the queue, a carrier a hoster, a forwarder a debrid (see the glossary).
  • Parcels are identified by their numeric id or by their number: /files/42 and /files/FR-0042 are the same parcel.
  • Credentials: an API token in Authorization: Bearer fret_…, created in Settings › API tokens, or the session cookie of the interface. With FRET_AUTH=none, none. Without valid credentials, private operations answer 401 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.

Terminal window
curl -N -H "Authorization: Bearer $TOKEN" http://localhost:8080/api/v1/events

The 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/v1

Authentication

  • Cookie fret_session
  • Bearer

    Token created in Settings › API tokens

Operations

Access

First run, sign-in, sessions and API tokens.

The dock

The state of the dock and its live event stream.

Shipments

Create, reorder, hold and delete shipments (package).

Warehouse

Store delivered shipments, search the register, read the stock.

Parcels

One parcel (file) with its segments and tracking history.

Carriers and accounts

Carriers, forwarders, their accounts and the check of links.

Settings

Dock, unpacking and collection settings.

Download the OpenAPI description

Built with Kiln