Unified TypeScript SDK for Sonarr, Radarr, Lidarr, Readarr, and Prowlarr
npm install arr-sdkUnified TypeScript SDK for Sonarr, Radarr, Lidarr, Readarr, and Prowlarr APIs.
- Full TypeScript support with types generated from official OpenAPI specs
- Native fetch API (no dependencies)
- Subpath exports for tree-shaking
- Async pagination helpers
- Comprehensive error handling
- Request/response hooks
``bash`
npm install arr-sdk
`typescript
import { SonarrClient } from 'arr-sdk/sonarr'
const sonarr = new SonarrClient({
baseUrl: 'http://localhost:8989',
apiKey: 'your-api-key'
})
// Get all series
const series = await sonarr.series.getAll()
// Search for a series
const results = await sonarr.series.lookup('Breaking Bad')
// Add a series
const newSeries = await sonarr.series.create({
tvdbId: 81189,
title: 'Breaking Bad',
qualityProfileId: 1,
rootFolderPath: '/tv'
})
`
`typescript
import { RadarrClient } from 'arr-sdk/radarr'
const radarr = new RadarrClient({
baseUrl: 'http://localhost:7878',
apiKey: 'your-api-key'
})
// Get all movies
const movies = await radarr.movie.getAll()
// Search for a movie
const results = await radarr.movie.lookup('The Matrix')
// Add a movie
const newMovie = await radarr.movie.create({
tmdbId: 603,
title: 'The Matrix',
qualityProfileId: 1,
rootFolderPath: '/movies'
})
`
`typescript
import { LidarrClient } from 'arr-sdk/lidarr'
const lidarr = new LidarrClient({
baseUrl: 'http://localhost:8686',
apiKey: 'your-api-key'
})
// Get all artists
const artists = await lidarr.artist.getAll()
// Search for an artist
const results = await lidarr.artist.lookup('The Beatles')
// Add an artist
const newArtist = await lidarr.artist.create({
foreignArtistId: 'b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d',
artistName: 'The Beatles',
qualityProfileId: 1,
metadataProfileId: 1,
rootFolderPath: '/music'
})
// Get all albums
const albums = await lidarr.album.getAll()
// Get tracks for an album
const tracks = await lidarr.track.getByAlbumId(1)
`
`typescript
import { ReadarrClient } from 'arr-sdk/readarr'
const readarr = new ReadarrClient({
baseUrl: 'http://localhost:8787',
apiKey: 'your-api-key'
})
// Get all authors
const authors = await readarr.author.getAll()
// Search for an author
const results = await readarr.author.lookup('Stephen King')
// Add an author
const newAuthor = await readarr.author.create({
foreignAuthorId: '12345-67890-abcdef',
authorName: 'Stephen King',
qualityProfileId: 1,
metadataProfileId: 1,
rootFolderPath: '/books'
})
// Get all books
const books = await readarr.book.getAll()
// Get books by author
const authorBooks = await readarr.book.getByAuthorId(1)
`
`typescript
import { ProwlarrClient } from 'arr-sdk/prowlarr'
const prowlarr = new ProwlarrClient({
baseUrl: 'http://localhost:9696',
apiKey: 'your-api-key'
})
// Get all indexers
const indexers = await prowlarr.indexer.getAll()
// Search across indexers
const results = await prowlarr.search.query({
query: 'ubuntu',
type: 'search'
})
`
`typescript
import { SonarrClient } from 'arr-sdk/sonarr'
const client = new SonarrClient({
baseUrl: 'http://localhost:8989',
apiKey: 'your-api-key',
// Optional: custom timeout (default: 30000ms)
timeout: 60000,
// Optional: custom headers
headers: {
'X-Custom-Header': 'value'
},
// Optional: request/response hooks
onRequest: (config) => {
console.log('Request:', config.method, config.url.href)
},
onResponse: (response) => {
console.log('Response:', response.status)
},
onError: (error) => {
console.error('Error:', error.message)
}
})
`
For endpoints that return paginated results:
`typescript
// Async generator for memory-efficient iteration
for await (const item of client.queue.getAll()) {
console.log(item)
}
// Or get all results at once
const allItems = await client.queue.getAllArray()
`
`typescript
import {
ArrError,
NotFoundError,
UnauthorizedError,
ValidationError
} from 'arr-sdk'
try {
await client.series.getById(99999)
} catch (error) {
if (error instanceof NotFoundError) {
console.log('Series not found')
} else if (error instanceof UnauthorizedError) {
console.log('Invalid API key')
} else if (error instanceof ValidationError) {
console.log('Validation errors:', error.errors)
} else if (error instanceof ArrError) {
console.log('API error:', error.statusCode, error.message)
}
}
`
See CHANGELOG.md for a complete list of breaking changes.
The quality field in GetQueueOptions changed from number to number[]:
`typescript
// Before (v0.1.x)
await client.queue.get({ quality: 1 })
// After (v0.2.0+)
await client.queue.get({ quality: [1] })
`
- series - Series managementepisode
- - Episode managementepisodeFile
- - Episode file managementcalendar
- - Calendar/upcoming episodes (includes iCal feed)queue
- - Download queuewanted
- - Missing and cutoff unmet episodeshistory
- - Activity historycommand
- - Commands (refresh, scan, manualImport, etc.)qualityProfile
- - Quality profilesqualityDefinition
- - Quality definitionsrootFolder
- - Root folderstag
- - Tagsindexer
- - Indexer configurationdownloadClient
- - Download client configurationimportList
- - Import listsnotification
- - Notificationsmetadata
- - Metadata providersrelease
- - Release search/grabblocklist
- - Blocklisted releasessystem
- - System info, health, logs, pingfilesystem
- - Browse filesystem pathsmediaCover
- - Download series cover imagesconfig
- - Host/UI/naming configuration
- movie - Movie managementcollection
- - Collection managementcalendar
- - Calendar/upcoming releases (includes iCal feed)queue
- - Download queuewanted
- - Missing and cutoff unmet movieshistory
- - Activity historycommand
- - Commands (refresh, scan, manualImport, etc.)qualityProfile
- - Quality profilesqualityDefinition
- - Quality definitionscustomFormat
- - Custom formatsrootFolder
- - Root folderstag
- - Tagsindexer
- - Indexer configurationdownloadClient
- - Download client configurationimportList
- - Import listsnotification
- - Notificationsmetadata
- - Metadata providersrelease
- - Release search/grabblocklist
- - Blocklisted releasessystem
- - System info, health, logs, pingfilesystem
- - Browse filesystem pathsmediaCover
- - Download movie cover imagesconfig
- - Host/UI/naming configuration
- artist - Artist managementalbum
- - Album managementtrack
- - Track managementtrackFile
- - Track file managementcalendar
- - Calendar/upcoming releasesqueue
- - Download queuewanted
- - Missing albums and cutoff unmethistory
- - Activity historycommand
- - Commands (refresh, scan, etc.)qualityProfile
- - Quality profilesqualityDefinition
- - Quality definitionsmetadataProfile
- - Metadata profiles (Lidarr-specific)rootFolder
- - Root folderstag
- - Tagssystem
- - System info, health, logs, ping
- author - Author managementbook
- - Book managementedition
- - Edition access (different book versions)bookFile
- - Book file managementcalendar
- - Calendar/upcoming releasesqueue
- - Download queuewanted
- - Missing books and cutoff unmethistory
- - Activity historycommand
- - Commands (refresh, scan, etc.)qualityProfile
- - Quality profilesqualityDefinition
- - Quality definitionsmetadataProfile
- - Metadata profilesrootFolder
- - Root folderstag
- - Tagssystem
- - System info, health, logs, ping
- indexer - Indexer managementindexerStats
- - Indexer statistics with filteringindexerProxy
- - Indexer proxiesapplication
- - Application connectionsappProfile
- - App sync profilessearch
- - Search across indexersnewznab
- - Newznab/Torznab protocol (caps, search, download)command
- - Commandshistory
- - Search historytag
- - TagsdownloadClient
- - Download clientsnotification
- - Notificationssystem
- - System info, health, logs, pingfilesystem
- - Browse filesystem pathslocalization
- - Localization stringsconfig
- - Configuration
Import only what you need:
`typescript
// Import only Sonarr (smaller bundle)
import { SonarrClient } from 'arr-sdk/sonarr'
// Import only Radarr
import { RadarrClient } from 'arr-sdk/radarr'
// Import only Lidarr
import { LidarrClient } from 'arr-sdk/lidarr'
// Import only Readarr
import { ReadarrClient } from 'arr-sdk/readarr'
// Import only Prowlarr
import { ProwlarrClient } from 'arr-sdk/prowlarr'
// Or import everything
import { SonarrClient, RadarrClient, LidarrClient, ReadarrClient, ProwlarrClient } from 'arr-sdk'
`
- Node.js >= 18.0.0 (uses native fetch`)
MIT