> ## 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.

# GetPlaylist

> GetPlaylist retrieves a playlist by ID along with its paginated items.
 Accessible with either an API key (public playlists) or OAuth token.



## OpenAPI

````yaml /api/anghami-sdk.openapi.yaml get /v1/playlists/{id}
openapi: 3.1.0
info:
  title: Anghami + OSN+ SDK
  description: >-
    Unified OpenAPI bundle covering all Anghami + OSN+ SDK services (music +
    video streaming).
  contact:
    name: Anghami Developer Platform
    email: developers@anghami.com
  version: 1.0.0
servers:
  - url: https://sdk.anghami.com
security: []
paths:
  /v1/playlists/{id}:
    get:
      tags:
        - PlaylistService
      summary: GetPlaylist
      description: |-
        GetPlaylist retrieves a playlist by ID along with its paginated items.
         Accessible with either an API key (public playlists) or OAuth token.
      operationId: GetPlaylist
      parameters:
        - name: Authorization
          in: header
          description: >-
            OAuth 2.0 Bearer token for user-authenticated requests. Format:
            Bearer <access_token>. Required for GetUserPlaylists; optional for
            GetPlaylist if x-api-key is provided.
          required: false
          schema:
            type: string
            example: Bearer eyJhbGciOiJSUzI1NiIs...
        - name: x-api-key
          in: header
          description: >-
            API key for server-to-server access. Only valid for GetPlaylist on
            public playlists.
          required: false
          schema:
            type: string
            example: ang_live_...
        - name: Accept-Language
          in: header
          description: Preferred locale for localized content in playlist items (BCP 47).
          required: false
          schema:
            type: string
            example: ar
        - name: id
          in: path
          description: Unique identifier of the playlist to retrieve.
          required: true
          schema:
            type: string
        - name: page_size
          in: query
          description: Maximum number of items to return per page (1-100, default 20).
          required: false
          schema:
            type: integer
            format: int32
        - name: page_token
          in: query
          description: Opaque page token from a previous response. Omit for the first page.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/sdk_playlist_v1_GetPlaylistResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    sdk_playlist_v1_GetPlaylistResponse:
      type: object
      properties:
        playlist:
          $ref: '#/components/schemas/sdk_playlist_v1_Playlist'
        items:
          type: array
          items:
            $ref: '#/components/schemas/sdk_playlist_v1_PlaylistItem'
        nextPageToken:
          type: string
          description: Token for the next page of items. Empty if no more pages.
      description: >-
        GetPlaylistResponse is the response message containing the playlist and
        its items.
    ValidationError:
      type: object
      properties:
        violations:
          type: array
          items:
            $ref: '#/components/schemas/FieldViolation'
          description: List of validation violations
      required:
        - violations
      description: >-
        ValidationError is returned when request validation fails. It contains a
        list of field violations describing what went wrong.
    Error:
      type: object
      properties:
        message:
          type: string
          description: Error message (e.g., 'user not found', 'database connection failed')
      description: >-
        Error is returned when a handler encounters an error. It contains a
        simple error message that the developer can customize.
    sdk_playlist_v1_Playlist:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/sdk_shared_v1_PlaylistID'
        name:
          $ref: '#/components/schemas/sdk_shared_v1_LocalizedString'
        description:
          $ref: '#/components/schemas/sdk_shared_v1_LocalizedString'
        visibility:
          type: string
          enum:
            - PLAYLIST_VISIBILITY_UNSPECIFIED
            - PLAYLIST_VISIBILITY_PUBLIC
            - PLAYLIST_VISIBILITY_PRIVATE
          description: PlaylistVisibility defines whether a playlist is publicly visible.
        ownerId:
          $ref: '#/components/schemas/sdk_shared_v1_UserID'
        ownerName:
          type: string
          description: Display name of the playlist owner.
        coverArtwork:
          $ref: '#/components/schemas/sdk_shared_v1_Image'
        itemCount:
          type: integer
          format: int32
          description: Total number of items in the playlist.
        totalDurationMs:
          type: string
          format: int64
          description: Total duration of all items in milliseconds.
        createdAt:
          type: string
          description: ISO 8601 timestamp of when the playlist was created.
        updatedAt:
          type: string
          description: ISO 8601 timestamp of when the playlist was last updated.
      description: Playlist represents a user-created or editorial playlist.
    sdk_playlist_v1_PlaylistItem:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/sdk_shared_v1_Content'
        position:
          type: integer
          format: int32
          description: Position of this item within the playlist (0-based).
        addedAt:
          type: string
          description: ISO 8601 timestamp of when this item was added to the playlist.
      description: |-
        PlaylistItem represents a single item within a playlist,
         wrapping a Content reference with position metadata.
    FieldViolation:
      type: object
      properties:
        field:
          type: string
          description: >-
            The field path that failed validation (e.g., 'user.email' for nested
            fields). For header validation, this will be the header name (e.g.,
            'X-API-Key')
        description:
          type: string
          description: >-
            Human-readable description of the validation violation (e.g., 'must
            be a valid email address', 'required field missing')
      required:
        - field
        - description
      description: FieldViolation describes a single validation error for a specific field.
    sdk_shared_v1_PlaylistID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the playlist identifier.
      required:
        - value
      description: PlaylistID is a typed identifier for a playlist.
    sdk_shared_v1_LocalizedString:
      type: object
      properties:
        value:
          type: string
          description: |-
            The text value resolved for the requested locale.
             The server selects this based on the Accept-Language header.
        originalValue:
          type: string
          description: |-
            The text value in its original language.
             For content originally in Arabic, this is the Arabic text.
             For content originally in English/Latin, this is the English text.
             May be identical to value when the requested locale matches the original.
      description: |-
        LocalizedString provides a text value in the requested locale along with
         the original-language value. The resolved value is determined server-side
         from the Accept-Language request header.

         Anghami's catalog is Arabic-first, meaning most content has both Arabic and
         Latin/transliterated titles. This message allows clients to display either
         representation as needed by the user interface.
    sdk_shared_v1_UserID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the user identifier.
      required:
        - value
      description: UserID is a typed identifier for a user.
    sdk_shared_v1_Image:
      type: object
      properties:
        url:
          type: string
          description: URL of the image.
        width:
          type: integer
          format: int32
          description: Width in pixels.
        height:
          type: integer
          format: int32
          description: Height in pixels.
      description: Image represents artwork or visual media at a specific size.
    sdk_shared_v1_Content:
      type: object
      properties:
        songId:
          $ref: '#/components/schemas/sdk_shared_v1_SongID'
        albumId:
          $ref: '#/components/schemas/sdk_shared_v1_AlbumID'
        artistId:
          $ref: '#/components/schemas/sdk_shared_v1_ArtistID'
        playlistId:
          $ref: '#/components/schemas/sdk_shared_v1_PlaylistID'
        showId:
          $ref: '#/components/schemas/sdk_shared_v1_ShowID'
        seasonId:
          $ref: '#/components/schemas/sdk_shared_v1_SeasonID'
        episodeId:
          $ref: '#/components/schemas/sdk_shared_v1_EpisodeID'
        movieId:
          $ref: '#/components/schemas/sdk_shared_v1_MovieID'
        title:
          type: string
          description: Display title of the content item.
        subtitle:
          type: string
          description: >-
            Subtitle or secondary text (e.g., artist name for songs, show name
            for episodes).
        artwork:
          $ref: '#/components/schemas/sdk_shared_v1_Image'
      description: |-
        Content is a generic wrapper for any content entity in the catalog.
         It uses common display fields for rendering in mixed-content lists.
    sdk_shared_v1_SongID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the song identifier.
      required:
        - value
      description: SongID is a typed identifier for a song.
    sdk_shared_v1_AlbumID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the album identifier.
      required:
        - value
      description: AlbumID is a typed identifier for an album.
    sdk_shared_v1_ArtistID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the artist identifier.
      required:
        - value
      description: ArtistID is a typed identifier for an artist.
    sdk_shared_v1_ShowID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the show identifier.
      required:
        - value
      description: ShowID is a typed identifier for a show.
    sdk_shared_v1_SeasonID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the season identifier.
      required:
        - value
      description: SeasonID is a typed identifier for a season.
    sdk_shared_v1_EpisodeID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the episode identifier.
      required:
        - value
      description: EpisodeID is a typed identifier for an episode.
    sdk_shared_v1_MovieID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the movie identifier.
      required:
        - value
      description: MovieID is a typed identifier for a movie.

````