Skip to main content

Music

This document describes the available music endpoints and their features.

List Music

Retrieve a list of all available music tracks.

Endpoint

  • Method: GET
  • URL: /api/musics

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer YOUR_API_TOKENYes

Success Response

{
"success": true,
"message": "Data retrieved successfully",
"data": [
{
"id": 1,
"title": "Relaxing Melody",
"sub_title": "Calming Sounds",
"description": "A peaceful melody to help you relax",
"file": "/storage/music/relaxing.mp3",
"file_extension": "mp3",
"is_vip": true,
"can_access": true
}
]
}

Response Fields

FieldTypeDescription
idintegerUnique identifier for the music track
titlestringTitle of the music track (localized based on Accept-Language)
sub_titlestringSubtitle of the music track (localized based on Accept-Language)
descriptionstringDescription of the music track (localized based on Accept-Language)
filestringURL to the music file
file_extensionstringFile extension of the music file (e.g., mp3, wav)
is_vipbooleanWhether this track is for VIP users only
can_accessbooleanWhether the current user can access this track

Implementation Notes

  • Music tracks are ordered by order_number in ascending order
  • The can_access field is calculated based on:
    • Track's VIP status (is_vip)
    • User's VIP subscription status
    • Non-VIP tracks are accessible to all users
    • VIP tracks are only accessible to users with active VIP subscriptions
  • File URLs are generated using Laravel's Storage facade
  • Responses are localized based on the Accept-Language header