{"id":21270711,"url":"https://github.com/explodingcamera/subsonic-api","last_synced_at":"2026-05-10T14:19:14.312Z","repository":{"id":129697323,"uuid":"549234429","full_name":"explodingcamera/subsonic-api","owner":"explodingcamera","description":"typescript/javascript library for interacting with subsonic-compatible apis","archived":false,"fork":false,"pushed_at":"2024-10-05T21:16:16.000Z","size":760,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-31T21:36:37.636Z","etag":null,"topics":["airsonic","navidrome","subsonic"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/subsonic-api","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/explodingcamera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-10T22:12:09.000Z","updated_at":"2024-10-10T03:40:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed987038-2d5a-4d72-a979-75083b7f04f4","html_url":"https://github.com/explodingcamera/subsonic-api","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodingcamera%2Fsubsonic-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodingcamera%2Fsubsonic-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodingcamera%2Fsubsonic-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodingcamera%2Fsubsonic-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/explodingcamera","download_url":"https://codeload.github.com/explodingcamera/subsonic-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225694179,"owners_count":17509312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["airsonic","navidrome","subsonic"],"created_at":"2024-11-21T08:18:22.340Z","updated_at":"2026-05-10T14:19:14.307Z","avatar_url":"https://github.com/explodingcamera.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Subsonic-API \u003ca href=\"https://www.npmjs.com/package/subsonic-api\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/subsonic-api?style=flat\u0026colorA=000000\u0026colorB=efefef\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/explodingcamera/subsonic-api/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/explodingcamera/subsonic-api/test.yml?branch=main\u0026style=flat\u0026colorA=000000\"/\u003e\u003c/a\u003e\n\nA lightweight Subsonic/Opensubsonic Client written in TypeScript. Supports Node, Deno, Bun, and modern Browsers.\n\n## Features\n\n- Supports all Subsonic API methods up to version 1.16.1 / Subsonic 6.1.4.\n- Supports most of OpenSubsonic's new API methods.\n- Supports both GET and POST requests.\n\n## Installation\n\n```bash\n$ npm install subsonic-api  # npm\n$ bun add subsonic-api      # bun\n```\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { SubsonicAPI } from \"https://esm.sh/subsonic-api\";\n\u003c/script\u003e\n```\n\n## Example Usage\n\n```ts\nimport { SubsonicAPI } from \"subsonic-api\";\n\nconst api = new SubsonicAPI({\n  url: \"https://demo.navidrome.org\",\n  auth: {\n    username: \"demo\",\n    password: \"demo\",\n  },\n});\n\nconst { randomSongs } = await api.getRandomSongs();\nconsole.log(randomSongs);\n```\n\n## API\n\n`subsonic-api` supports all of the Subsonic API methods as documented [here](http://www.subsonic.org/pages/api.jsp), up to API version 1.16.1 / Subsonic 6.1.4. Additionally, most of [OpenSubsonic's new API methods](https://opensubsonic.netlify.app/) are also supported.\nAll methods return a promise that resolves to the JSON response from the server.\n\nSee the [JSDoc documentation](https://www.jsdocs.io/package/subsonic-api#SubsonicAPI) for a complete list of supported methods and their parameters.\n\n### `new SubsonicAPI`\n\n```ts\nnew SubsonicAPI(config: SubsonicConfig)\n```\n\nCreates a new SubsonicAPI instance.\n\n```ts\ninterface SubsonicConfig {\n  // The base URL of the Subsonic server, e.g., https://demo.navidrome.org.\n  url: string;\n\n  // The authentication details to use when connecting to the server.\n  auth:\n    | {\n        username: string;\n        password: string;\n      }\n    | {\n        // See https://opensubsonic.netlify.app/docs/extensions/apikeyauth/\n        apiKey: string;\n      };\n\n  // A salt to use when hashing the password. Not used if `auth.apiKey` is provided.\n  salt?: string;\n\n  // Whether to reuse generated salts. If not provided,\n  // a random salt will be generated for each request.\n  // Ignored if `salt` is provided or `auth.apiKey` is used.\n  reuseSalt?: boolean;\n\n  // Whether to use a POST requests instead of GET requests.\n  // Only supported by OpenSubsonic compatible servers with the `formPost` extension.\n  post?: boolean;\n\n  // The fetch implementation to use. If not provided, the global fetch will be used.\n  fetch?: typeof fetch;\n\n  // The crypto implementation to use. If not provided, the global WebCrypto object\n  // or the Node.js crypto module will be used.\n  crypto?: Crypto;\n}\n```\n\n### `navidromeSession`\n\n```ts\nsubsonicSession(): Promise\u003cSessionInfo\u003e\n```\n\nCreates a new Navidrome session\n\n```ts\ninterface SessionInfo {\n  id: string;\n  isAdmin: boolean;\n  name: string;\n  subsonicSalt: string;\n  subsonicToken: string;\n  token: string;\n  username: string;\n}\n```\n\n### `baseURL`\n\n```ts\nbaseURL(): string\n```\n\nReturns the base URL of the server. Useful for interacting with other APIs like Navidrome's.\n\n### `custom`\n\n```ts\ncustom(method: string, params: Params): Promise\u003cResponse\u003e\n```\n\nAllows you to make a custom request to the server.\n\n### `customJSON`\n\n```ts\ncustomJSON\u003cT\u003e(method: string, params: Params): Promise\u003cT\u003e\n```\n\nAllows you to make a custom request to the server and parse the response as JSON.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplodingcamera%2Fsubsonic-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexplodingcamera%2Fsubsonic-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplodingcamera%2Fsubsonic-api/lists"}