Playing via Spotify Playing via YouTube
Skip to YouTube video

Loading player…

Scrobble from Spotify?

Connect your Spotify account to your account and scrobble everything you listen to, from any Spotify app on any device or platform.

Connect to Spotify


# REST Requests


The API root URL is located at

Generally speaking, you will send a method parameter expressed as 'package.method' along with method specific arguments to the root URL. The following parameters are required for all calls:

api_key : A API Key.
method : An API method expressed as package.method, corresponding to a documented API method name.

For example:

If you are accessing a write service, you will need to submit your request as an HTTP POST request. All POST requests should be made to the root url:

With all parameters (including the 'method') sent in the POST body. In order to perform write requests you will need to authenticate a user with the API. See authentication for more.

# REST Responses

Responses will be wrapped in an lfm status node

<lfm status="$status">

Where $status is either ok or failed. If the status is failed you'll get an error code and message. You can strip the status wrapper from the response by sending a raw=true argument with your method call.

# REST Errors

See the individual method call pages for service specific error codes. Errors will communicate a code and a message in the following format:

<lfm status="failed">
    <error code="10">Invalid API Key</error>

# JSON Responses

You can request API responses in JSON format with the following parameters:

format=json : A API Key.
callback (Optional) : A callback function name which will wrap the JSON response.

# Note:

If you don't specify a callback, there's no default, and the response will be pure JSON content with a application/json MIME type. With a callback, the MIME type is text/javascript

The response is a translation of the XML response format, converted according to the following rules:

  1. Attributes are expressed as string member values with the attribute name as key.
  2. Element child nodes are expressed as object members values with the node name as key.
  3. Text child nodes are expressed as string values, unless the element also contains attributes, in which case the text node is expressed as a string member value with the key #text. *
  4. Repeated child nodes will be grouped as an array member with the shared node name as key.

* This idiom is rarely used in our XML responses.

# Example success response:

"results": {
    "tagmatches": {
      "tag": \[{
        "name": "disco",
        "count": "55483",
        "url": "\\/tag\\/disco"
        "name": "disco pop",
        "count": "160",
        "url": "\\/tag\\/disco%20pop"
    "for": "disco"

# Original XML response:

<?xml version="1.0" encoding="utf-8"?>
<lfm status="ok">
 <results for="disco" xmlns:opensearch="">
    <opensearch:Query role="request" searchTerms="disco" startPage="1" />
        <name>disco pop</name>

# JSON Errors

JSON errors do not follow the same transformation rules as success errors, but use the following simplified form:

# Example failure response:

    "error": 10,
    "message": "Invalid API Key"

API Calls