HTTP API¶
Nemorosa provides a comprehensive HTTP API for integration with external tools, automation systems, and custom workflows.
Base URL¶
Authentication¶
API Key Authentication¶
Include the API key in the Authorization header:
No Authentication¶
If no API key is configured, all endpoints are publicly accessible:
Endpoints¶
Root Information¶
GET /¶
Get server information and available endpoints.
Response:
{
"message": "Nemorosa Web Server",
"version": "0.1.0",
"endpoints": {
"webhook": "/api/webhook",
"announce": "/api/announce",
"job": "/api/job",
"docs": "/docs"
}
}
Webhook Processing¶
POST /api/webhook¶
Process a single torrent by infohash.
Parameters:
infohash(query, required) - Torrent infohash
Example:
curl -X POST "http://localhost:8256/api/webhook?infohash=abc123def456" \
-H "Authorization: Bearer your-api-key"
Response:
{
"status": "success",
"message": "Successfully processed torrent: Artist - Album (2024) [FLAC] (abc123def456)"
}
Status Codes:
200 OK- Successfully processed (injected/saved/already exists)204 No Content- No matching torrent found (normal case)401 Unauthorized- Invalid API key500 Internal Server Error- Processing error
Response on Error (500):
Announce Processing¶
POST /api/announce¶
Process torrent announce from external systems.
Request Body:
{
"name": "Artist - Album (2024) [FLAC]",
"link": "https://tracker.example.com/torrents.php?id=12345",
"album": "Album"
}
Example:
curl -X POST "http://localhost:8256/api/announce" \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "Artist - Album (2024) [FLAC]",
"link": "https://tracker.example.com/torrents.php?id=12345",
"album": "Album"
}'
Response:
{
"status": "success",
"message": "Successfully processed reverse announce torrent: Artist - Album (2024) [FLAC]"
}
Status Codes:
200 OK- Successfully processed204 No Content- No matching torrent found or skipped400 Bad Request- Invalid request parameters401 Unauthorized- Invalid API key500 Internal Server Error- Processing error
Response on Error (400/500):
Job Management¶
POST /api/job¶
Trigger a scheduled job to run early.
Parameters:
job_type(query, required) - Job type:searchorcleanup
Example:
curl -X POST "http://localhost:8256/api/job?job_type=search" \
-H "Authorization: Bearer your-api-key"
Response:
{
"status": "success",
"message": "Job triggered successfully",
"job_name": "search",
"next_run": "2024-01-15T10:30:00",
"last_run": "2024-01-15T06:30:00"
}
Status Codes:
200 OK- Job triggered successfully401 Unauthorized- Invalid API key404 Not Found- Job not found or disabled409 Conflict- Job already running or not eligible500 Internal Server Error- Trigger error
Response on Error (404/409):
GET /api/job¶
Get status of a scheduled job.
Parameters:
job_type(query, required) - Job type:searchorcleanup
Example:
Response:
{
"status": "active",
"message": "Job is active and scheduled",
"job_name": "search",
"next_run": "2024-01-15T10:30:00",
"last_run": "2024-01-15T06:30:00"
}
Status Codes:
200 OK- Success400 Bad Request- Invalid job type401 Unauthorized- Invalid API key404 Not Found- Job not found500 Internal Server Error- Status error
Response Formats¶
ProcessResponse (Webhook & Announce)¶
Used by /api/webhook and /api/announce endpoints.
{
"status": "success|not_found|error|skipped|skipped_potential_trump",
"message": "status message"
}
Status values:
success- Torrent processed successfullynot_found- No cross-seeding opportunity foundskipped- Already processed or filtered outskipped_potential_trump- Potential conflict detectederror- Processing failed
JobResponse¶
Used by /api/job endpoints.
{
"status": "success|not_found|conflict|error",
"message": "Human-readable message",
"job_name": "search|cleanup",
"next_run": "2024-01-15T10:30:00",
"last_run": "2024-01-15T06:30:00"
}
Note: next_run and last_run fields may be null if not available.
Error Response¶
Used for HTTP errors (400, 401, 404, 409, 500).
Status Codes¶
HTTP Status Codes¶
200 OK- Request successful204 No Content- No matching torrent found (normal case for webhook/announce)400 Bad Request- Invalid request parameters401 Unauthorized- Authentication required or invalid API key404 Not Found- Resource not found409 Conflict- Resource conflict (e.g., job already running)500 Internal Server Error- Server error