Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sdk.anghami.com/llms.txt

Use this file to discover all available pages before exploring further.

LibraryService is read-only and operates on the authenticated user’s personal library. All operations require an OAuth access token with the read scope — there is no API-key access.

Operations

RPCReturns
GetLikedItemsLiked songs and albums (filterable by content type, paginated).
CheckLikedItemsFor a given list of IDs, whether each is liked. Use this for like-toggle UI state.
GetSavedItemsSaved movies and shows (filterable, paginated).
CheckSavedItemsWhether each of a list of IDs is saved.
GetFollowedArtistsArtists the user follows.
CheckFollowedArtistsWhether each of a list of artist IDs is followed.
GetHistoryPlayback history (mixed content types, paginated).

Liked vs Saved — why two verbs

Anghami uses two distinct user-intent verbs, mirrored in the API:
  • Liked applies to music (songs and albums).
  • Saved applies to video (movies and shows).
Calling GetLikedItems for a movie ID, or GetSavedItems for a song ID, will return nothing — the verbs and the content classes are intentionally separate. Followed artists are a third bucket.

Toggle-state pattern

For a list view (e.g. an album’s track list), don’t call GetLikedItems and intersect — that’s expensive. Use the matching Check* RPC instead:
const res = await library.checkLikedItems({
  songIds: { values: trackList.map(value => ({ value })) },
});
// res.results: { [songId]: boolean }
Check* takes a typed list of IDs (song_ids or album_ids for likes; show_ids or movie_ids for saves; artist_ids for follows) and returns a results map of ID → boolean. Use it on every page render where toggle state matters.

History

GetHistory returns a paginated list of Content wrappers — songs, episodes, movies, etc. — in reverse-chronological order of last play. Filter with content_types to scope to e.g. “songs only” or “shows only”. Note that history reflects what the user acquired streams for (per Streaming & Billing) — there is no separate playback report. Treat each entry as “the user started this stream at time T”.

Mutating library state

Today, liking/unliking, saving/unsaving, and following/unfollowing happen inside the Anghami client, not via this SDK. The library service is read-only. A write-scoped mutation surface is reserved for a future revision.