API Reference Activity

The Docs are work-in-progress except API References!

Get Currently Playing Music

Get information about music you are currently listening to, or about another user if their profile is public.

  • OAuth Authorization Code is (only) required for private profiles or if no username is provided. For public profiles, anyone can access the activity without OAuth by providing the username query parameter.
  • If username is provided and the user's profile is public, OAuth is not required and anyone can access the activity.
  • If the profile is private or username is not provided, OAuth or authentication is required.

Request

username string
Optional

The username of the user whose activity you want to retrieve.

Example: /api/me?username=potato

svg string
Optional

If provided, the API will return a SVG image of the user's currently playing or last played music activity instead of JSON. This is useful for embedding a dynamic "Now Playing" badge or card in places that support SVG images, such as GitHub READMEs or personal websites.


Note: When using this query parameter, the API will ignore the service query parameter and always return the activity information for the service where you are currently listening to music.
Example:

<img src="https://yutify.cheapnightbot.me/api/me?svg" alt="Now Playing" />
<img src="https://yutify.cheapnightbot.me/api/me?username=potato&svg" alt="Now Playing" />

service string
Optional

The music service name to retrieve listening activity metadata from. It must be linked first in your account settings!

If provided, music information/metadata will be retrieved for the music you are currently listening to on this service. If it is not provided or does not contain allowed values, it will be simply ignored and music information/metadata will be retrieved for all the linked services.

If music information requested for all linked services, the one where you are currently listening to music will be given priority. However, if (for whatever reason), you are listening to music on all the linked services, these will be given priority at random. That is, you can't be sure for which linked service you will get music information returned.

Default: "all"
Allowed values: "all", "lastfm", "spotify"
Note: The query parameter for service is NOT ?service=<name> (i.e. key-value pair)! Instead, you just provide the service name directly as a key.
Example: /api/me?lastfm

embed string
Optional

If provided, the API will return a ready-to-embed HTML user activity card (instead of JSON) for the requested user. You should use it inside an <iframe>.

Note: When using this query parameter, API will ignore the service query parameter and will always return the activity information for the service where you are currently listening to music.
Example:

  • <iframe src="https://yutify.cheapnightbot.me/api/me?embed" frameborder="0" width="100%" height="612" loading="lazy"></iframe>
  • <iframe src="https://yutify.cheapnightbot.me/api/me?username=potato&embed" frameborder="0" width="100%" height="612" loading="lazy"></iframe>

Activity embed example
style string
Optional

The style of the embed (i.e. HTML and SVG embed, ?embed and ?svg respectively).

Default: "vertical"
Allowed values: "horizontal", "vertical"
Example: /api/me?embed&style=horizontal

Response

Successful response with the information about the music user is currently listening to on a linked service.

Response Examples
/api/me
{
  "activity_info": {
    "is_playing": true,
    "service": "lastfm",
    "timestamp": 1747255826.41405
  },
  "music_info": {
    "album_art": "https://deezer.com/6663629/album_art.jpg",
    "album_art_source": "deezer",
    "album_title": "Song",
    "album_type": "single",
    "artists": "Artist",
    "genre": "Electronic",
    "id": {
      "deezer": 6663629,
      "itunes": 6663629,
      "kkbox": "Dx6duYxp9UagGhiqwq",
      "spotify": "6rqhFgbbKwnb9MLmUQDhG6",
      "ytmusic": "xD69iRAEiu0"
    },
    "isrc": "US1234567890",
    "lyrics": "These are the lyrics of the song...",
    "release_date": "2025-10-25",
    "tempo": null,
    "title": "Song",
    "type": "track",
    "upc": null,
    "url": {
      "deezer": "https://www.deezer.com/track/6663629",
      "itunes": "https://music.apple.com/track/6663629",
      "kkbox": "https://www.kkbox.com/tw/tc/song/Dx6duYxp9UagGhiqwq",
      "spotify": "https://open.spotify.com/track/6rqhFgbbKwnb9MLmUQDhG6",
      "ytmusic": "https://music.youtube.com/watch?v=xD69iRAEiu0"
    }
  }
}
/api/me
{
  "activity_info": {
    "is_playing": true,
    "service": "lastfm",
    "timestamp": 1747260237.49223
  },
  "music_info": {
    "album_art": "https://last.fm/i/u/54f012e2fd7b87e0b87c7e410.jpg",
    "album_title": "Song",
    "album_type": null,
    "artists": "Artist",
    "genre": null,
    "id": null,
    "isrc": null,
    "lyrics": null,
    "release_date": null,
    "tempo": null,
    "title": "Song",
    "type": null,
    "upc": null,
    "url": "https://www.last.fm/music/Artist/Song"
  }
}
activity_info object
Always Present

An object containing information about user's currently listening activity.

It contains the following fields:

  • is_playing boolean
    Always Present

    Whether the user is currently listening to this music or not.
    It will be true if user is currently listening this music, otherwise false indicating that user is not currently listening to this music, but this was the last music they were listening to that yutify fetched.

  • service string
    Always Present

    The service name where this activity fetched from.

    Available values: "lastfm", "spotify"
    Example: "lastfm"

  • timestamp integer
    Always Present

    Unix Timestamp (in seconds) when the user started playing this music or when the activity first was fetched.

    Example: 1747255826.41405

music_info object
Always Present

An object containing music information about user's currently listening activity.

It contains the following fields:

  • album_art string
    Always Present

    The URL to the album art (image) of the requested music.

  • album_art_source string

    The music platform name where the album art retrieved from.

    Example: "spotify"

  • album_title string
    Always Present

    The title of the album for the requested music.

    Note: It will be the same as the title if album_type is "single.

  • album_type string null
    Always Present

    The type of the album for the requested music.

    Available values: "album", "ep", "single"
    Example: "single"

  • artists string
    Always Present

    A comma-separated string of artist name(s) for the requested music.

    Example: "Ahrix", "花譜, Hoshimachi Suisei"

  • genre string null
    Always Present

    The genre of the requested music.

    Example: "Electronic"

  • id integer string object null
    Always Present

    The unique ID of the music on the respective music platform(s).
    The "id" itself can be either integer or string based on the music platform. For example, "id" for YouTube Music will be 11 characters long alpha-numeric string.

    Note: If it is an object, each key will be the music platform name and value being actual ID of the music on that platform.
    Examples:

    "id": "7e8XZUuB78uEOil4i3ONox"
    The music platform keys in this object can vary based on if that music found on respective platform or not. For example, if the music was not found on Spotify, the "id" object will not have "spotify" key.
    "id": {
      "itunes": 123456789,
      "deezer": 123456789,
      "kkbox": "XyxzETEWlclsnflt",
      "spotify": "7e8XZUuB78uEOil4i3ONox",
      "ytmusic": "AdLFtTiA8d5"
    }
  • isrc string null
    Always Present

    The ISRC code of the requested music. If the album_type is not "single" or ISRC was not found, then it will be null.

  • lyrics string null
    Always Present

    The lyrics of the requested music.

  • release_date string null
    Always Present

    The date when requested music was released in ISO format: YYYY-MM-DD

    Example: "2025-05-14"

  • tempo integer null
    Always Present

    The tempo of the requested music in beats per minute (BPM).
    Currently, it is always going to be null. Please see this issue on GitHub for more information.

  • title string
    Always Present

    The title / name of the requested music.

  • type string null
    Always Present

    The type of the requested music.

    Available values: "album", "track"
    Note: Don't get confused with album_type! This one tells you whether you requested a track (which can be part of an album) or an album itself.
    Example: If you requested a track "Third Track" which is part of an album "Best Album", then "type" will be track. However, if you requested "Best Album", the "type" will be "album".

  • upc string null
    Always Present

    The UPC code of the requested music. If the album_type is not "album" or "ep" or if UPC was not found, then it will be null.

  • url string object
    Always Present

    The streaming URL of the music on the requested music platform(s).

    Note: It will be a string, if query parameter for platform contains a value from "Allowed values" except "all". Otherwise, if platform="all" or no query parameter provided, it will be an object with each key representing the music platform name and value being actual streaming URL of the music on that platform.
    Examples:

    "url": "https://open.spotify.com/track/7e8XZUuB78uEOil4i3ONox"
    The music platform keys in this object can vary based on if that music found on respective platform or not. For example, if the music was not found on Spotify, the "url" object will not have "spotify" key.
    "url": {
      "itunes": "https://music.apple.com/album/123456789",
      "deezer": "https://www.deezer.com/track/123456789",
      "kkbox": "https://www.kkbox.com/song/XyxzETEWlclsnflt",
      "spotify": "https://open.spotify.com/track/7e8XZUuB78uEOil4i3ONox",
      "ytmusic": "https://music.youtube.com/watch?v=AdLFtTiA8d5"
    }

Successful response, but either user have not linked any service to their account or is not listening to any music on linked service(s).

Note: The 404 response will not be sent if the user is not listening to any music, but user's recent activity was found in database. In that case, is_playing will be false and the 200 response will be sent along with the music information.

Response Examples
/api/me
{
  "error": "No service is linked. Please link one in your settings."
}
/api/me
{
  "error": "No activity found. Listen to music on your linked service to see it here."
}
error string
Always Present

The error message explaining that the listening activity was not found or user have no services linked to their account.

Unsuccessful response explaining that you have exceeded the default ratelimit.

Response Examples
/api/me
{
  "error": "ratelimit exceeded! you are allowed to make 20 request(s) per 1 minute."
}
error string
Always Present

The error message explaining you have exceeded the default ratelimit.

The default ratelimit is 20 requests per 1 minute, but might change.
It will always contain what default ratelimits are in this format: "x requests per y timeframe".

Returns a PNG image of the user's current or last played music activity.

Request

username string
Optional

The username of the user whose activity you want to retrieve.

Example: /api/activity.png?username=potato

Example Usage

HTML
<img src="https://yutify.cheapnightbot.me/api/activity.png?username=<YOUR_USERNAME>" alt="Now Playing" />
Markdown
![Yutify Activity](https://yutify.cheapnightbot.me/api/activity.png?username=<YOUR_USERNAME>)