Configuration¶
The API reads its configuration from environment variables (prefix APP_), the worker
from SNATCH_*. Everything else is stored in Postgres and edited through the API or the
UI.
API (snatcharr)¶
| Variable | Default | Meaning |
|---|---|---|
APP_DB_DSN |
required | Postgres DSN, e.g. postgres://snatcharr:secret@postgres:5432/snatcharr?sslmode=disable |
APP_HTTP_ADDR |
:8080 |
HTTP listen address (API, SSE, embedded UI) |
APP_GRPC_LISTEN |
:9090 |
gRPC listen address for workers |
APP_GRPC_KEEPALIVE_MAX_CONNECTION_AGE |
2m |
After this age a worker connection takes no new RPCs and new ones move to a fresh connection; negative = never |
APP_GRPC_KEEPALIVE_MAX_CONNECTION_AGE_GRACE |
unlimited | How long RPCs already running on an aged connection may finish. A finite value must be at least 35s (the 30 s LeaseRun long-poll plus margin) or the API refuses to start; note that a finite value can still cut a run's ReportEvents stream |
APP_CRYPTO_KEY |
required in prod | Key that encrypts *arr API keys and download-client secrets at rest (openssl rand -hex 32). The dev profile without it runs on a development key published in the source and warns that stored secrets are unprotected; prod refuses to start on that key |
APP_HTTP_CSRF_SECRET |
not read | No longer used: the API refuses cross-site requests from the browser's Sec-Fetch-Site and Origin headers, which needs no secret and cannot be switched off. A value that is still set is ignored |
APP_LEADER_ENABLED |
false |
Elect one replica (Postgres advisory lock) to run the planner, Seerr sync, instance checks and Configarr poll; leave off for a single replica |
APP_LEADER_NAME |
snatcharr |
Lock name; one per deployment |
APP_LEADER_IDENTITY |
hostname | This replica's name in logs |
APP_LEADER_PG_RETRY |
2s |
How often a follower retries the lock |
APP_CACHE_MEMORY_MAX_SIZE |
10000 |
Entries in the shared in-process cache that outbound metadata providers (TheTVDB) use; each provider keeps its own key prefix and expiry |
APP_CACHE_MEMORY_TTL |
5m |
Default expiry for that cache; a provider with its own expiry (TheTVDB: 24 hours for a hit, 1 hour for an unknown item) overrides it |
APP_SNATCHARR_PROFILE |
prod |
prod or dev; dev relaxes cookie security and uses the built-in dev key |
APP_SNATCHARR_PUBLIC_URL |
External base URL (cookies, links) | |
APP_SNATCHARR_WORKER_TOKEN |
Shared bearer the worker presents over gRPC | |
APP_SNATCHARR_SESSION_TTL |
8h |
Cookie session lifetime |
APP_SNATCHARR_SESSION_SECURE |
true |
Secure flag on the session cookie; while it is on, responses also carry Strict-Transport-Security (one year), so leave it on only when browsers reach SnatchArr over HTTPS |
APP_SNATCHARR_APIKEY_SECRET |
required in prod | HMAC secret for API keys |
APP_SNATCHARR_CONFIGARR_CONFIG |
Path to Configarr config.yml (linked mode) |
|
APP_SNATCHARR_CONFIGARR_DOWNLOAD_CLIENTS |
Path to download clients YAML file (linked mode) | |
APP_SNATCHARR_CONFIGARR_POLICIES |
Path to declarative snatch and queue policies YAML file (linked mode) | |
APP_SNATCHARR_CONFIGARR_SECRETS |
Path to Configarr secrets.yml |
|
APP_SNATCHARR_CONFIGARR_WATCH |
true |
Re-import on file change |
APP_SNATCHARR_PROWLARR_LIMIT_THRESHOLD |
0.9 |
Fraction (0, 1] of an indexer's Prowlarr query limit at which SnatchArr treats the indexer as exhausted (Prowlarr) |
APP_SNATCHARR_PROWLARR_SEARCH_DB_TIMEOUT |
10s |
Deadline for Prowlarr DB link lookups and budget transactions, including lock waits; range 1s to 60s inclusive (snatcharr.prowlarr.search_db_timeout) |
APP_SNATCHARR_PROWLARR_MAX_CACHED_RELEASES |
1000 |
Largest search result kept in the variant cache; range 1 to 10000 inclusive. Larger results are returned uncached but still debited (snatcharr.prowlarr.max_cached_releases) |
APP_SNATCHARR_JELLYFIN_ENABLED |
false |
Enable Jellyfin authentication and Quick Connect |
APP_SNATCHARR_JELLYFIN_URL |
Jellyfin server base URL (must be http or https with host) | |
APP_SNATCHARR_JELLYFIN_API_KEY |
Jellyfin service account API key | |
APP_SNATCHARR_JELLYFIN_TIMEOUT |
10s |
HTTP request timeout for Jellyfin client calls |
APP_SNATCHARR_JELLYFIN_DEFAULT_ROLE |
requester |
Role for a non-admin Jellyfin member on first sign-in (requester or viewer); Jellyfin administrators become admin |
APP_SNATCHARR_METADATA_TVDB_API_KEY |
Optional TheTVDB API key (secret, write-only). Empty keeps the TVDB provider off and SnatchArr makes no TVDB request. When set, TVDB translations and aliases join the foreign-title list that getForeignTitles previews; no search uses that list until issue #1150 (ADR-0048) |
|
APP_SNATCHARR_METADATA_TVDB_PIN |
Optional TheTVDB subscriber PIN (secret, write-only); needed only for a user-supported key. Ignored without the API key | |
APP_SNATCHARR_LOGS_RING_SIZE |
2000 |
Log records the API keeps in memory for the admin Logs page; clamped to 100 to 20000 |
APP_SNATCHARR_WEB_DEV |
false |
Disable the embedded SPA (Vite dev server proxies instead) |
APP_SNATCHARR_PROXY_TRUSTED |
Comma-separated CIDRs of trusted reverse proxies (e.g. 10.0.0.0/8). Enables client IP resolution from X-Forwarded-For for login throttling |
|
APP_SNATCHARR_SETUP_SECRET |
Optional bootstrap secret required by POST /auth/setup. Generated by default in Helm chart; empty allows setup without a secret until the first admin user is created |
|
APP_SNATCHARR_OIDC_ENABLED |
false |
Enable OIDC SSO (Single Sign-On) |
APP_SNATCHARR_OIDC_ISSUER_URL |
OIDC issuer URL (https, or http in dev profile) | |
APP_SNATCHARR_OIDC_CLIENT_ID |
OAuth2 client ID | |
APP_SNATCHARR_OIDC_CLIENT_SECRET |
OAuth2 client secret | |
APP_SNATCHARR_OIDC_REDIRECT_URL |
OAuth2 callback URL (defaults to public.url + /api/v1/auth/oidc/callback) |
|
APP_SNATCHARR_OIDC_SCOPES |
openid,email,profile |
Comma-separated scopes (openid always present) |
APP_SNATCHARR_OIDC_ADMIN_GROUPS |
Comma-separated groups that sign in as admin (required) | |
APP_SNATCHARR_OIDC_REQUESTER_GROUPS |
Comma-separated groups that sign in as requesters | |
APP_SNATCHARR_OIDC_VIEWER_GROUPS |
Comma-separated groups that sign in as viewers | |
APP_SNATCHARR_OIDC_GROUPS_CLAIM |
groups |
ID token claim holding the groups |
APP_SNATCHARR_OIDC_DISCOVERY_TIMEOUT |
10s |
IdP discovery timeout |
APP_SNATCHARR_PROXY_AUTH_ENABLED |
false |
Enable trusted proxy-header auth (Single Sign-On) |
APP_SNATCHARR_PROXY_AUTH_HEADER |
Remote-User |
Name of header containing authenticated username |
APP_SNATCHARR_PROXY_AUTH_TRUSTED_CIDRS |
Comma-separated CIDRs of reverse proxies trusted for proxy-header auth | |
APP_SNATCHARR_PROXY_AUTH_GROUPS_HEADER |
X-authentik-groups |
Header containing \|-separated groups |
APP_SNATCHARR_PROXY_AUTH_SECRET_HEADER |
X-SnatchArr-Proxy-Secret |
Name of header containing shared proxy secret |
APP_SNATCHARR_PROXY_AUTH_SECRET |
Shared secret reverse proxy must present (min 32 bytes) | |
APP_SNATCHARR_PROXY_AUTH_ADMIN_GROUPS |
Comma-separated groups that sign in as admin (required) | |
APP_SNATCHARR_PROXY_AUTH_REQUESTER_GROUPS |
Comma-separated groups that sign in as requesters | |
APP_SNATCHARR_PROXY_AUTH_VIEWER_GROUPS |
Comma-separated groups that sign in as viewers | |
APP_SNATCHARR_METRICS_ADDR |
Dedicated HTTP listen address for Prometheus /metrics (e.g. :9464); empty leaves /metrics on main HTTP port |
|
APP_OTEL_ENABLED |
true |
OpenTelemetry export (no-op without an endpoint) |
APP_LOG_FORMAT |
json |
json or text |
APP_SNATCHARR_OIDC_ALLOWED_SUBJECTS |
Deprecated; rejected if set | |
APP_SNATCHARR_OIDC_ALLOWED_EMAILS |
Deprecated; rejected if set | |
APP_SNATCHARR_PROXY_AUTH_ALLOWED_USERS |
Deprecated; rejected if set | |
APP_SNATCHARR_ITEM_SEARCH_COOLDOWN_SECONDS |
60 |
Per-user item search cooldown in seconds (0 = off) |
APP_SNATCHARR_DOWNLOAD_PRIORITY_INTERVAL_SECONDS |
60 |
Leader priority observation interval in seconds (15..3600; restart to apply; defined in api/internal/config/download_priority.go) |
APP_HTTP_TIMEOUTS_READ |
30s |
HTTP server read timeout |
APP_HTTP_TIMEOUTS_HEADER |
5s |
HTTP server header read timeout |
APP_HTTP_TIMEOUTS_WRITE |
60s |
HTTP server write timeout |
APP_HTTP_TIMEOUTS_IDLE |
120s |
HTTP server keep-alive idle timeout |
APP_HTTP_TIMEOUTS_SHUTDOWN |
30s |
HTTP server graceful shutdown timeout |
APP_HTTP_LIMITS_HEADER |
1048576 |
HTTP server maximum header size in bytes |
APP_HTTP_LIMITS_BODY |
10485760 |
HTTP server maximum request body size in bytes |
APP_HTTP_LIMITS_UNLIMITED |
false |
Disable HTTP server request body limit |
APP_HTTP_TLS_CERT |
Path to TLS certificate file for HTTP server | |
APP_HTTP_TLS_KEY |
Path to TLS private key file for HTTP server | |
APP_HTTP_TLS_CA |
Path to TLS client CA bundle for HTTP server | |
APP_HTTP_TLS_CLIENTAUTH |
Client certificate validation policy for HTTP server | |
APP_GRPC_TLS |
false |
Enable TLS on gRPC worker listener |
APP_GRPC_CERT_FILE |
Path to TLS certificate file for gRPC worker listener | |
APP_GRPC_KEY_FILE |
Path to TLS private key file for gRPC worker listener | |
APP_GRPC_MAX_RECV_SIZE |
4194304 |
Maximum incoming gRPC message size in bytes |
APP_GRPC_MAX_SEND_SIZE |
4194304 |
Maximum outgoing gRPC message size in bytes |
APP_GRPC_CA_FILE |
Path to TLS CA bundle for gRPC client certificate verification | |
APP_GRPC_CLIENT_AUTH |
Client certificate authentication policy for gRPC worker listener | |
APP_GRPC_KEEPALIVE_TIME |
1m |
gRPC server keepalive ping interval |
APP_GRPC_KEEPALIVE_TIMEOUT |
20s |
gRPC server keepalive ping acknowledgement timeout |
APP_GRPC_KEEPALIVE_MIN_TIME |
5m |
Minimum client ping interval accepted by gRPC server |
APP_GRPC_KEEPALIVE_PERMIT_WITHOUT_STREAM |
false |
Permit gRPC client pings when there are no active streams |
APP_GRPC_HEALTH |
false |
Register standard gRPC health checking service |
APP_GRPC_CLIENT_TLS |
false |
Enable TLS for outgoing gRPC client connections |
APP_GRPC_CLIENT_CERT_FILE |
Path to TLS certificate file for gRPC client | |
APP_GRPC_CLIENT_KEY_FILE |
Path to TLS private key file for gRPC client | |
APP_GRPC_CLIENT_CA_FILE |
Path to TLS CA bundle for gRPC client | |
APP_GRPC_CLIENT_SERVER_NAME |
Server name override for gRPC client TLS verification | |
APP_GRPC_CLIENT_KEEPALIVE_TIME |
gRPC client keepalive ping interval | |
APP_GRPC_CLIENT_KEEPALIVE_TIMEOUT |
gRPC client keepalive ping timeout | |
APP_GRPC_CLIENT_KEEPALIVE_PERMIT_WITHOUT_STREAM |
false |
Permit gRPC client pings without active streams |
APP_GRPC_CLIENT_RETRY_MAX_ATTEMPTS |
0 |
Maximum retry attempts for gRPC client calls |
APP_GRPC_CLIENT_RETRY_INITIAL_BACKOFF |
100ms |
Initial backoff duration for gRPC client retries |
APP_GRPC_CLIENT_RETRY_MAX_BACKOFF |
1s |
Maximum backoff duration for gRPC client retries |
APP_GRPC_CLIENT_RETRY_BACKOFF_MULTIPLIER |
2 |
Backoff multiplier for gRPC client retries |
APP_DB_PASSWORD_FILE |
Path to file containing database password | |
APP_DB_READ_DSN |
Postgres DSN for read-only replica queries | |
APP_DB_SSL_MODE |
Postgres SSL connection mode (disable, require, verify-ca, verify-full) | |
APP_DB_SSL_ROOTCERT |
Path to root certificate for Postgres SSL verification | |
APP_DB_SSL_CERT |
Path to client certificate for Postgres SSL authentication | |
APP_DB_SSL_KEY |
Path to client private key for Postgres SSL authentication | |
APP_DB_POOL_MIN |
0 |
Minimum number of connections in database connection pool |
APP_DB_POOL_MAX |
10 |
Maximum number of connections in database connection pool |
APP_DB_POOL_LIFETIME |
1h |
Maximum lifetime of connections in database pool |
APP_DB_POOL_IDLE |
30m |
Maximum idle duration before closing a database pool connection |
APP_DB_POOL_HEALTHCHECK |
1m |
Healthcheck interval for connections in database pool |
APP_DB_CONNECT_TIMEOUT |
5s |
Timeout for establishing a database connection |
APP_DB_RETRY_ATTEMPTS |
10 |
Maximum retry attempts when connecting to database |
APP_DB_RETRY_INITIAL |
50ms |
Initial retry backoff when connecting to database |
APP_DB_RETRY_MAX |
5s |
Maximum retry backoff when connecting to database |
APP_DB_TRACING_SLOW |
200ms |
Execution threshold above which database queries are logged as slow |
APP_DB_MIGRATE_PATH |
Filesystem path to database migration files (overridden by embedded migrations) | |
APP_DB_MIGRATE_AUTO |
false |
Automatically run database migrations at startup |
APP_DB_MIGRATE_DSN |
Dedicated Postgres DSN for running database migrations | |
APP_OTEL_ENDPOINT |
OpenTelemetry collector gRPC/HTTP endpoint | |
APP_OTEL_INSECURE |
true |
Allow insecure communication with OpenTelemetry collector |
APP_OTEL_SERVICE_NAME |
Service name reported in OpenTelemetry resource attributes | |
APP_OTEL_SERVICE_VERSION |
Service version reported in OpenTelemetry resource attributes | |
APP_OTEL_SERVICE_NAMESPACE |
Service namespace reported in OpenTelemetry resource attributes | |
APP_OTEL_SAMPLE_RATIO |
1.0 |
Trace sampling ratio between 0.0 and 1.0 |
APP_OTEL_EXPORT_TRACES |
true |
Export OpenTelemetry distributed trace spans |
APP_OTEL_EXPORT_METRICS |
true |
Export OpenTelemetry metric points |
APP_OTEL_EXPORT_LOGS |
true |
Export OpenTelemetry log records |
APP_OTEL_EXPORT_PROMETHEUS |
false |
Enable OpenTelemetry Prometheus exporter |
APP_OTEL_LOGS_TRACE_IDS |
true |
Include active trace and span IDs in application logs |
APP_LOG_LEVEL |
info |
Root logger minimum severity level (debug, info, warn, error) |
Worker (snatch-worker)¶
| Variable | Default | Meaning |
|---|---|---|
SNATCH_API_GRPC |
http://127.0.0.1:9090 |
API gRPC endpoint |
SNATCH_WORKER_TOKEN |
Bearer token (must match APP_SNATCHARR_WORKER_TOKEN) |
|
SNATCH_CONCURRENCY |
2 |
Snatches executed in parallel (1-16) |
SNATCH_HEARTBEAT_SECS |
30 |
Heartbeat interval in seconds (5-60) |
SNATCH_LEASE_WAIT_SECS |
30 |
Long-poll wait per lease request in seconds (1-30) |
SNATCH_ARR_TIMEOUT_SECS |
30 |
Per-request *arr timeout in seconds (5-120) |
SNATCH_STALE_SECS |
180 |
Age of the last successful API call after which /livez fails, in seconds (60-3600). Must be at least twice the longer of the heartbeat interval and the lease wait. |
RUST_LOG |
info |
Log filter |
A value outside its range stops the worker at startup with an error naming the variable and its allowed range (see worker/crates/snatch-worker/src/config.rs). The chart schema in deploy/helm/snatcharr/values.schema.json holds the same ranges; the worker test helm_worker_ranges_match_worker_ranges in config.rs fails when they differ.
The worker never holds state. It leases a snatch, heartbeats while working, reports events and completes; a restart loses nothing.
MCP stdio client (snatcharr mcp stdio)¶
These environment variables configure the client-side snatcharr mcp stdio CLI proxy. They are client-side variables supplied to the proxy subprocess, not APP_ server configurations.
| Variable | Default | Meaning |
|---|---|---|
SNATCHARR_URL |
required | Base URL of the SnatchArr instance (e.g. http://localhost:8080 or https://snatcharr.example.com). Proxy posts to <base>/api/v1/mcp |
SNATCHARR_API_KEY |
required | Scoped bearer API key minted on /account under API keys |
Instances¶
Administrators register instances under /instances (POST /api/v1/instances). Supported kind values are the six *arr kinds (sonarr, radarr, lidarr, readarr (legacy), whisparr_v2, whisparr_v3) plus stash (ADR-0032). Instance API keys are write-only on the HTTP API and encrypted at rest with AES-GCM (APP_CRYPTO_KEY).
A stash instance is a companion only:
- Companion only, never snatched:
stashinstances never enter snatch planning (ListInstancesToPlan), worker leases, queue management, Seerr resolution, Configarr import, hourly stamina caps (/api/v1/hourly-caps), or priority presets. - Minimum version
v0.31.0: Connectivity probes (POST /api/v1/instances/{id}/testandPOST /api/v1/instances/test) query the Stash GraphQLversionfield viagithub.com/golusoris/goenvoy/mediaserver/stash/v2and require Stash0.31.0or newer (for.stashignoresupport). Older versions are rejected with HTTP 422.
Snatch policy¶
Every instance has one policy (GET/PUT /api/v1/instances/{id}/policy). On PUT, an omitted dry_run or skip_unavailable_movies keeps the stored value; a sent value replaces it. The same holds for enabled and the other optional fields whose create default the API reference names on instances, download clients, Seerr and Prowlarr links, notification channels, rules and targets, watch-aware sources and adult sources.
| Field | Default | Range |
|---|---|---|
missing_per_cycle |
2 | 0 to 100 (0 disables; ADR-0020) |
upgrade_per_cycle |
1 | 0 to 100 (ADR-0020) |
cycle_interval_s |
900 | at least 60 |
hourly_cap (stamina) |
15 | 1 to 500 (ADR-0020) |
selection |
random |
random, sequential, recent |
monitored_only |
true | |
skip_future_releases |
true | |
radarr_release_type |
physical |
physical, digital, cinema |
sonarr_missing_mode |
dynamic |
episodes, season_packs, shows, dynamic |
sonarr_upgrade_mode |
episodes |
episodes, season_packs, dynamic |
lidarr_missing_mode |
artist |
artist, album |
processed_ttl_h (afterglow) |
168 | 1 to 8760 |
max_queue_size |
-1 | -1 disables the *arr queue ceiling |
await_command |
false | Poll the search command until it completes (5 min max) |
page_size |
100 | 10 to 1000 |
recent_grab_window_h |
24 | 0 to 720; items grabbed this recently (and everything queued) are skipped |
afterglow_max_h |
720 | 1 to 8760; cap for the doubling afterglow |
include_tags |
empty | up to 100 *arr tag ids; when not empty, only items with one of these tags |
exclude_tags |
empty | up to 100 *arr tag ids; items with any of these tags are skipped; an id may not be in both tag lists |
include_quality_profiles |
empty | up to 100 *arr quality profile ids; when not empty, only items using one of these profiles |
exclude_quality_profiles |
empty | up to 100 *arr quality profile ids; items using any of these are skipped; an id may not be in both profile lists |
release_delay_h |
0 | 0 to 8760; skip items released less than this many hours ago (0 = off; items without a date are kept) |
dry_run |
false | When true, scheduled and periodic runs only preview without dispatching searches |
skip_unavailable_movies |
true | Radarr only: skip movies whose minimum availability is not reached (isAvailable false); they cost no stamina, and the run's candidates_filtered event counts them. Movies without the flag are searched |
An episode, album or book has the tags and quality profile of its series, artist or author.
GET /api/v1/instances/{id}/policy/filter-options lists the tags and quality profiles the
instance offers (admins only); the policy form picks from that list.
Foreign-search preflight¶
GET /api/v1/instances/{id}/foreign-search/preflight provides a read-only compatibility check for Radarr instances (admins only). It evaluates whether each configured quality profile accepts releases found by foreign-title searches across supported rule languages (de, fr), assembled by ForeignPreflight (api/internal/policies/options.go). The endpoint contract is declared at /instances/{instanceId}/foreign-search/preflight in OpenAPI (api/openapi/openapi.yaml). Admin access is enforced by GetForeignSearchPreflight (api/internal/httpapi/handlers_instances.go).
The verdict rules (api/internal/foreigntitle/radarrlang.go), covered by language decision tests (api/internal/foreigntitle/radarrlang_test.go), report one of three verdicts per profile and target language:
allowed: The profile language isAny(-1) or explicitly matches the target language.original_only: The profile language isOriginal(-2); searches pass only when the target language matches the movie's original language.skipped: The profile language differs from the target language or is missing, or the target is unmapped for a profile other thanAny.
The profile fetch (api/internal/arrclient/profilelang.go) uses only GET /api/v3/qualityprofile; it never writes quality profile configurations. Profile fetch tests (api/internal/arrclient/profilelang_test.go) cover the method, language conversion, upstream failures and response bounds.
TheTVDB titles (opt-in)¶
The foreign-title list starts with the aliases the Sonarr or Radarr instance already caches. Setting a TheTVDB API key adds TVDB translations and aliases for the series or movie to that list; no search sends the list until issue #1150 wires it into the budgeted Prowlarr search (ADR-0048). Data courtesy of TheTVDB.com (https://thetvdb.com).
- Off by default. With no
snatcharr.metadata.tvdb.api_key(orAPP_SNATCHARR_METADATA_TVDB_API_KEY), SnatchArr makes no TVDB request. Get a key at https://thetvdb.com/api-information; set the optionalsnatcharr.metadata.tvdb.pinonly for a user-supported key. Both are secret-class settings: encrypted at rest, write-only in the API, restart to apply, never logged. - What is asked. Sonarr items use the series' TVDB id. Radarr items are found through TVDB's remote-id search (IMDB id first, then TMDB id; movie hits only). Other app kinds make no call. TVDB uses three-letter language codes; the provider maps each rule language (
detodeu,frtofra). - Bounds. Calls are rate limited, time limited and cached in memory (24 hours for a hit, 1 hour for an unknown item). A refused login (wrong key or PIN) latches: no further TVDB request is made until the key changes and the API restarts. An HTTP 429 is retried a bounded number of times, then reported. A TVDB failure never fails the request: the *arr titles still return.
- Inspect.
GET /api/v1/instances/{id}/items/{itemId}/foreign-titles?language=de(admins only; optionalseason) previews the titles foreign-title search will use once issue #1150 lands, each taggedarrortvdb, plus the provider status (disabled,ok,unauthorized,rate_limited,unavailable) and the attribution text. Contract:getForeignTitlesinapi/openapi/openapi.yaml; handlerGetForeignTitlesinapi/internal/httpapi/handlers_foreign_titles.go; providerapi/internal/metadata/tvdb. - Helm. Create a Secret with the key
tvdb-api-key(andtvdb-pinfor a user-supported key) and setmetadata.tvdb.existingSecret;metadata.tvdb.apiKeyKeyandmetadata.tvdb.pinKeyrename the keys. The chart has no inline value for either: the schema refuses one. Test:deploy/helm/snatcharr/tests/metadata_test.yaml. - Compose. The compose file in
deploy/compose/runs the *arr test stack, not the API; setAPP_SNATCHARR_METADATA_TVDB_API_KEY(andAPP_SNATCHARR_METADATA_TVDB_PIN) in the API's environment from your secret store where you run the API.
Queue policy¶
Each instance has a queue policy (GET/PUT /api/v1/instances/{id}/queue-policy; PUT is
admin-only). When enabled is true, the elected replica sweeps the instance's *arr download
queue and counts consecutive strikes per download. GET /api/v1/instances/{id}/queue-strikes
lists the downloads that hold a strike now; downloads the last sweep found clean are left out.
The rules and their order are described in ADR-0012.
Every rule starts in observe mode: a strike is recorded and shown, and the queue is left
alone. A rule in act mode removes the download once its strike count reaches the threshold;
every rule except unwanted_unmonitored also blocklists the release so the *arr searches again.
Whisparr v2 and v3 queues are swept and force-imported like the others: a v2 candidate needs
a mapped series and episodes, a v3 candidate a mapped movie.
Rules¶
| Rule | Matches when | Default threshold |
|---|---|---|
stalled |
Downloading, and the remaining size did not shrink since the last sweep (applies to torrents only) | 6 |
metadata_stuck |
A torrent still waiting for its magnet metadata; threshold in minutes since the item was added (30..1440) | 180 |
slow |
Downloading slower than min_bytes_per_second since the last sweep |
6 |
failed |
Queue status or tracked state is failed | 2 |
import_blocked |
The *arr cannot import the finished download | 6 |
unwanted_score |
Custom format score below min_custom_format_score |
1 |
unwanted_unmonitored |
The episode, movie, album or book is no longer monitored | 1 |
Queued, paused and delayed downloads, downloads being imported, and downloads younger than the grace period are never evaluated.
Policy fields¶
| Field | Default | Range | Meaning |
|---|---|---|---|
enabled |
false |
bool | Sweep this instance's queue |
grace_seconds |
900 | 0 to 86400 | Minimum age before any rule looks at a download (the UI edits it in minutes) |
min_bytes_per_second |
0 | >= 0 | Floor for slow; 0 turns slow off |
min_custom_format_score |
unset | integer | Floor for unwanted_score; unset turns unwanted_score off |
max_removals_per_sweep |
10 | 1 to 100 | Most downloads one sweep may remove |
Runtime settings¶
GET/PUT /api/v1/settings (on PUT, an omitted llm_enabled, brand_mark or sfw_mode keeps the stored value):
| Field | Default | Meaning |
|---|---|---|
history_retention_days |
90 | 1 to 3650; how long events and finished runs are kept. The elected replica deletes older ones once an hour |
user_agent |
SnatchArr/1.0 (...) |
Sent to every *arr and download client |
global_hourly_cap |
0 | Stamina shared by every instance (0 = off) |
The same hourly pass also forgets afterglow entries 90 days after they expired, spent
stamina buckets after two hours, expired login sessions and workers that have not called
for history_retention_days. It deletes at most 100,000 rows
per table per pass and logs one retention: purge pass line with the counts. A larger
backlog shrinks over the following hours.
Configarr¶
Point APP_SNATCHARR_CONFIGARR_CONFIG (and _SECRETS) at your Configarr files and every
sonarr, radarr, lidarr, readarr (legacy) and whisparr instance is
imported on start and kept in sync: the files are polled every 30 seconds (inotify misses Kubernetes ConfigMap
swaps, polling does not). Only base_url, api_key and the enabled flags are read;
!secret, !env and !file values are resolved like Configarr does. Whisparr entries are
probed to tell v2 from v3: the reported major version decides (2.x is Whisparr v2, 3.x is Whisparr v3). A probe
that fails keeps the kind already stored, with a warning; a Whisparr entry that was never imported, or one that
reports another major version, is not imported and the import result names why. An instance that disappears from the file is switched off, not
deleted. Imported instances are read-only in SnatchArr except for their snatch policy. Deleting
one that the file still declares, enabled or not, is refused with 403; once it is gone from the
file and switched off, it can be deleted.
POST /api/v1/configarr/import runs a one-shot import (with config_path and
secrets_path in the body, or the linked files); GET /api/v1/configarr/status shows
linked mode and the last result.
Declarative Download Clients¶
When APP_SNATCHARR_CONFIGARR_DOWNLOAD_CLIENTS points to a YAML file, download clients are declaratively provisioned and kept in sync alongside instances:
qbittorrent: # section = domain.DownloadClientKind value; accept every kind ParseDownloadClientKind accepts
main: # entry name -> key "qbittorrent/main", Name "main"
base_url: http://qbittorrent.media.svc:8080
username: !env QBIT_USER
password: !file /etc/snatcharr/configarr-secrets/qbit-password
instance: sonarr/main # optional Configarr instance key; omitted = applies to every instance
max_active: 0 # optional int
max_queued: 0 # optional int
bandwidth_budget_bps: 0 # optional int64
enabled: true # optional, default true
sabnzbd:
main:
base_url: http://sabnzbd.media.svc:8080
api_key: !secret sabnzbd_api_key # secret = api_key or password, exactly one, both -> parse error
!secret (resolved from APP_SNATCHARR_CONFIGARR_SECRETS), !env and !file tags work identically to instance secrets. When an entry disappears from the file, it is pruned. Provisioned clients are marked with source configarr; mutating or deleting them via the UI or API is rejected with 403 Forbidden.
Declarative Policies¶
When APP_SNATCHARR_CONFIGARR_POLICIES points to a YAML file, snatch policies and queue policies are declaratively applied to Configarr instances:
defaults: # optional, applied to every Configarr instance first
queue:
enabled: true
instances:
sonarr/series: # Configarr key <app>/<name>, as Definition.Key
snatch:
missing_per_cycle: 2
hourly_cap: 30
queue:
enabled: true
rules:
failed: { mode: observe, threshold: 2 }
Field names match the API JSON field names of SnatchPolicy and QueuePolicy in the OpenAPI specification. Policies are partial: only listed fields change, while unlisted fields keep their current stored value (merging instance entries over defaults, over stored values). The UI keeps editing policies; a later import overwrites the fields the file lists ("the file wins for the fields it names").
!secret (resolved from APP_SNATCHARR_CONFIGARR_SECRETS), !env and !file tags work identically to instance secrets. Declarative policies apply only to source=configarr instances; manual instances are untouched. Unknown instance keys, unknown fields, or values rejected by the service are reported as warnings in the import status while remaining instances apply.