Skip to content

API Reference ​

Trackarr exposes several API endpoints for tracker operations and frontend interactions.

Tracker Endpoints ​

Announce ​

The announce endpoint is used by BitTorrent clients to report their status and receive peer lists.

HTTP Announce ​

GET /announce?info_hash={info_hash}&peer_id={peer_id}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&event={event}
ParameterTypeDescription
info_hashstring20-byte SHA-1 hash of the torrent's info dictionary (URL-encoded)
peer_idstring20-byte unique identifier for the client
portintegerPort the client is listening on
uploadedintegerTotal bytes uploaded this session
downloadedintegerTotal bytes downloaded this session
leftintegerBytes remaining to download (0 = seeder)
eventstringOptional: started, completed, stopped
compactintegerOptional: 1 for compact peer list
numwantintegerOptional: number of peers wanted (default: 50)

Response (bencoded):

d8:completei10e10:incompletei5e8:intervali1800e5:peersXX:...e

Scrape ​

Get statistics for one or more torrents:

GET /scrape?info_hash={info_hash}

Response (bencoded):

d5:filesd20:{info_hash}d8:completei10e10:downloadedi50e10:incompletei5eeee

WebSocket Announces ​

Trackarr supports WebSocket announces for WebTorrent clients:

javascript
const ws = new WebSocket('wss://announce.your-domain.com')

ws.send(JSON.stringify({
  action: 'announce',
  info_hash: '...',
  peer_id: '...',
  // ... other parameters
}))

REST API ​

Authentication ​

All authenticated endpoints require a valid session cookie.

Torrents ​

List Torrents ​

GET /api/torrents

Query parameters:

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page (default: 25, max: 100)
sortstringSort field: created, seeders, leechers, size
orderstringSort order: asc, desc
categorystringFilter by category slug
searchstringFull-text search query

Get Torrent ​

GET /api/torrents/{id}

Download Torrent ​

GET /api/torrents/{id}/download

Returns the .torrent file with the user's passkey embedded.

User ​

Get Current User ​

GET /api/user/me

Get User Stats ​

GET /api/user/{id}/stats

Rate Limits ​

All API endpoints are rate-limited:

Endpoint TypeLimitWindow
Read operations1001 minute
Write operations101 minute
Authentication55 minutes
Tracker announces2001 minute

Exceeding limits returns 429 Too Many Requests.

Error Responses ​

All errors follow this format:

json
{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many requests. Please try again later."
  }
}

Common error codes:

CodeHTTP StatusDescription
UNAUTHORIZED401Not authenticated
FORBIDDEN403Not authorized for this action
NOT_FOUND404Resource not found
RATE_LIMITED429Too many requests
INTERNAL_ERROR500Server error

Released under the MIT License.