The lyrics endpoints allow you to create and retrieve lyrics for music tracks. All endpoints require JWT authentication.
Create lyrics
POST /api/lyrics
Create lyrics for a track. Lyrics can include synchronized timestamps for karaoke-style display.
Authentication required: Yes (JWT Bearer token)
Request body
UUID of the track these lyrics belong to
Array of lyric line objects. Each object should have:
text (string, required): The lyric text
time (string, optional): Timestamp in format “mm:ss.ms” for synchronized lyrics
Language code (e.g., ‘en’, ‘es’, ‘fr’). Defaults to ‘en’
Response
Success message: “Lyrics created successfully”
The created lyrics object
Example request
curl -X POST https://your-domain.com/api/lyrics \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"trackId": "d4e5f6a7-b8c9-4d5e-8f7a-9b8c7d6e5f4a",
"content": [
{"time": "00:00.00", "text": "Walking down the midnight street"},
{"time": "00:05.50", "text": "City lights beneath my feet"},
{"text": "Feeling the rhythm of the night"}
],
"language": "en"
}'
const response = await fetch('https://your-domain.com/api/lyrics', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
trackId: 'd4e5f6a7-b8c9-4d5e-8f7a-9b8c7d6e5f4a',
content: [
{ time: '00:00.00', text: 'Walking down the midnight street' },
{ time: '00:05.50', text: 'City lights beneath my feet' },
{ text: 'Feeling the rhythm of the night' }
],
language: 'en'
})
});
const data = await response.json();
Example response
{
"message": "Lyrics created successfully",
"data": {
"id": "e5f6a7b8-c9d0-4e5f-8a7b-9c8d7e6f5a4b",
"trackId": "d4e5f6a7-b8c9-4d5e-8f7a-9b8c7d6e5f4a",
"content": [
{ "time": "00:00.00", "text": "Walking down the midnight street" },
{ "time": "00:05.50", "text": "City lights beneath my feet" },
{ "text": "Feeling the rhythm of the night" }
],
"language": "en",
"createdAt": "2024-03-04T10:00:00.000Z",
"updatedAt": "2024-03-04T10:00:00.000Z"
}
}
List lyrics
GET /api/lyrics
Retrieve a paginated list of lyrics. You can filter by track ID.
Authentication required: Yes (JWT Bearer token)
Query parameters
Number of lyrics per page
Page number (zero-indexed)
Filter lyrics by track ID
Response
Success message: “Lyrics fetched successfully”
Example request
curl -X GET "https://your-domain.com/api/lyrics?trackId=d4e5f6a7-b8c9-4d5e-8f7a-9b8c7d6e5f4a" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const params = new URLSearchParams({
size: '20',
page: '0',
trackId: 'd4e5f6a7-b8c9-4d5e-8f7a-9b8c7d6e5f4a'
});
const response = await fetch(`https://your-domain.com/api/lyrics?${params}`, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const data = await response.json();
Example response
{
"message": "Lyrics fetched successfully",
"data": [
{
"id": "e5f6a7b8-c9d0-4e5f-8a7b-9c8d7e6f5a4b",
"trackId": "d4e5f6a7-b8c9-4d5e-8f7a-9b8c7d6e5f4a",
"content": [
{ "time": "00:00.00", "text": "Walking down the midnight street" },
{ "time": "00:05.50", "text": "City lights beneath my feet" }
],
"language": "en",
"createdAt": "2024-03-04T10:00:00.000Z",
"updatedAt": "2024-03-04T10:00:00.000Z"
}
]
}
Get lyrics by ID
GET /api/lyrics/:id
Retrieve specific lyrics by ID.
Authentication required: Yes (JWT Bearer token)
Path parameters
The unique identifier (UUID) of the lyrics
Response
Success message: “Lyrics fetched successfully”
Example request
curl -X GET https://your-domain.com/api/lyrics/e5f6a7b8-c9d0-4e5f-8a7b-9c8d7e6f5a4b \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const lyricsId = 'e5f6a7b8-c9d0-4e5f-8a7b-9c8d7e6f5a4b';
const response = await fetch(`https://your-domain.com/api/lyrics/${lyricsId}`, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const data = await response.json();
Example response
{
"message": "Lyrics fetched successfully",
"data": {
"id": "e5f6a7b8-c9d0-4e5f-8a7b-9c8d7e6f5a4b",
"trackId": "d4e5f6a7-b8c9-4d5e-8f7a-9b8c7d6e5f4a",
"content": [
{ "time": "00:00.00", "text": "Walking down the midnight street" },
{ "time": "00:05.50", "text": "City lights beneath my feet" },
{ "text": "Feeling the rhythm of the night" }
],
"language": "en",
"createdAt": "2024-03-04T10:00:00.000Z",
"updatedAt": "2024-03-04T10:00:00.000Z"
}
}
Lyrics object structure
Unique lyrics identifier (UUID)
ID of the associated track
Array of lyric line objects stored as JSONB. Each object contains:
text (string): The lyric text
time (string, optional): Timestamp for synchronized playback
Language code (ISO 639-1 format, e.g., ‘en’, ‘es’, ‘fr’)
Timestamp when the lyrics were created (ISO 8601)
Timestamp when the lyrics were last updated (ISO 8601)
Notes
- The
content field is stored as JSONB in the database, allowing flexible structure
- Timestamps in the
time field should follow the format “mm:ss.ms” (e.g., “01:23.45”)
- Not all lyric lines require timestamps - you can mix timestamped and non-timestamped lines
- Each track can have multiple lyrics entries in different languages
- Lyrics are deleted when the associated track is deleted