The artists endpoints allow you to create, read, update, and delete artist profiles. All endpoints require JWT authentication.
Create artist
POST /api/artists
Create a new artist profile.
Authentication required: Yes (JWT Bearer token)
Request body
Artist status. Options: active, inactive (defaults to active)
Response
Success message: “Artist created successfully”
The created artist object
Example request
curl -X POST https://your-domain.com/api/artists \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "The Midnight Collective",
"status": "active"
}'
const response = await fetch('https://your-domain.com/api/artists', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'The Midnight Collective',
status: 'active'
})
});
const data = await response.json();
Example response
{
"message": "Artist created successfully",
"data": {
"id": "a1b2c3d4-e5f6-4a5b-8c7d-9e8f7a6b5c4d",
"name": "The Midnight Collective",
"status": "active",
"userId": "550e8400-e29b-41d4-a716-446655440000",
"createdAt": "2024-03-04T10:00:00.000Z",
"updatedAt": "2024-03-04T10:00:00.000Z"
}
}
List artists
GET /api/artists
Retrieve a paginated list of artists. Non-admin users see only their own active artists.
Authentication required: Yes (JWT Bearer token)
Query parameters
Number of artists per page
Page number (zero-indexed)
Filter artists by label ID
Response
Success message: “Artists fetched successfully”
Example request
curl -X GET "https://your-domain.com/api/artists?size=20&page=0" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const params = new URLSearchParams({
size: '20',
page: '0',
labelId: 'label-uuid-here' // optional
});
const response = await fetch(`https://your-domain.com/api/artists?${params}`, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const data = await response.json();
Example response
{
"message": "Artists fetched successfully",
"data": [
{
"id": "a1b2c3d4-e5f6-4a5b-8c7d-9e8f7a6b5c4d",
"name": "The Midnight Collective",
"status": "active",
"userId": "550e8400-e29b-41d4-a716-446655440000",
"createdAt": "2024-03-04T10:00:00.000Z",
"updatedAt": "2024-03-04T10:00:00.000Z"
}
]
}
Get artist by ID
GET /api/artists/:id
Retrieve a specific artist by ID.
Authentication required: Yes (JWT Bearer token)
Path parameters
The unique identifier (UUID) of the artist
Response
Success message: “Artist fetched successfully”
Example request
curl -X GET https://your-domain.com/api/artists/a1b2c3d4-e5f6-4a5b-8c7d-9e8f7a6b5c4d \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const artistId = 'a1b2c3d4-e5f6-4a5b-8c7d-9e8f7a6b5c4d';
const response = await fetch(`https://your-domain.com/api/artists/${artistId}`, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const data = await response.json();
Error responses
404 Not Found - Artist does not exist
{
"statusCode": 404,
"message": "Artist not found"
}
403 Forbidden - Insufficient permissions to view inactive artist
{
"statusCode": 403,
"message": "Forbidden"
}
Update artist
PATCH /api/artists/:id
Update an existing artist. Non-admin users can only update their own active artists.
Authentication required: Yes (JWT Bearer token)
Path parameters
The unique identifier (UUID) of the artist
Request body
Updated status. Options: active, inactive
Response
Success message: “Artist updated successfully”
The updated artist object
Example request
curl -X PATCH https://your-domain.com/api/artists/a1b2c3d4-e5f6-4a5b-8c7d-9e8f7a6b5c4d \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "The Midnight Collective (Updated)",
"status": "active"
}'
const response = await fetch(`https://your-domain.com/api/artists/${artistId}`, {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'The Midnight Collective (Updated)'
})
});
const data = await response.json();
Delete artist
DELETE /api/artists/:id
Delete an artist. Admin users can delete any artist; regular users can only delete their own.
Authentication required: Yes (JWT Bearer token)
Path parameters
The unique identifier (UUID) of the artist
Response
Returns 204 No Content on successful deletion.
Example request
curl -X DELETE https://your-domain.com/api/artists/a1b2c3d4-e5f6-4a5b-8c7d-9e8f7a6b5c4d \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const response = await fetch(`https://your-domain.com/api/artists/${artistId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
}
});
if (response.status === 204) {
console.log('Artist deleted successfully');
}
Error responses
403 Forbidden - Insufficient permissions
{
"statusCode": 403,
"message": "Forbidden"
}
Artist object structure
Unique artist identifier (UUID)
Artist status: active or inactive
ID of the user who created the artist
Timestamp when the artist was created (ISO 8601)
Timestamp when the artist was last updated (ISO 8601)