Skip to main content

Subsonic API

Subsonic API support

Ampache implements the OpenSubsonic API as well as a pure Subsonic API.

Each user can enable OpenSubsonic by disabling the Enable legacy Subsonic API responses for compatibility issues preference on the Options page. (preferences.php?tab=options)

Compatible Versions:

  • Ampache7.6.0 => Separated OpenSubsonic docs & Subsonic API's 1.16.1
  • Ampache7 => OpenSubsonic extensions & Subsonic 1.16.1
  • Ampache6 => Subsonic 1.16.1
  • Ampache5 => Subsonic 1.13.0
  • Ampache4 => Subsonic 1.13.0
  • Ampache3 => Subsonic 1.11.0

OpenSubsonic API extension

OpenSubsonic API is an open source initiative to create backward-compatible extensions for the original Subsonic API.

Ampache Subsonic support is being extended to support these changes

Extensions

Api Key authentication

The key that must be passed to Ampache is the API Key generated for a specific user (none by default, only the administrator can generate one).

Then call the following URL (Where localhost/ampache is the location of your Ampache installation):

http://localhost/ampache/rest/ping.view?apiKey=API_KEY&v=1.2.0&c=DSub&f=json

NOTE Do not send a user (u) parameter or auth will be rejected.

The key can be also be passed to Ampache using SHA256(USER+KEY) where KEY is SHA256('APIKEY'). Below is a PHP example

$user = 'username';
$key = hash('sha256', 'myapikey');
$passphrase = hash('sha256', $user . $key);

HTTP Header Authentication

Ampache supports sending your apiKey parameter to the server using a Bearer Token.

The apiKey parameter does not need to be sent with your URL. We will check your header for a token first

GET http://localhost/ampache/rest/ping.view?v=1.2.0&c=DSub&f=jsonHTTP/1.1
Authorization: Bearer 000111112233334444455556667777788888899aaaaabbbbcccccdddeeeeeeff

Endpoint extension

Partially implemented

  • stream
    • Support timeOffset (Parameter is supported but untested)
    • Enable subsonic_always_download preference (preferences.php?tab=options) to stop scrobbling plays

NOT implemented

  • getLyricsBySongId
    • Currently Ampache lyrics do not track individual lines or timestamps

Subsonic Examples

You can get examples from an official Subsonic release as well as examples from Ampache.

These servers are using a Subsonic 1.16.1 compatible API version.