Skip to main content
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

name
string
required
Artist name
status
string
Artist status. Options: active, inactive (defaults to active)

Response

message
string
Success message: “Artist created successfully”
data
object
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

size
number
default:"10"
Number of artists per page
page
number
default:"0"
Page number (zero-indexed)
labelId
string
Filter artists by label ID

Response

message
string
Success message: “Artists fetched successfully”
data
array
Array of artist objects

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

id
string
required
The unique identifier (UUID) of the artist

Response

message
string
Success message: “Artist fetched successfully”
data
object
The artist object

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

id
string
required
The unique identifier (UUID) of the artist

Request body

name
string
Updated artist name
status
string
Updated status. Options: active, inactive

Response

message
string
Success message: “Artist updated successfully”
data
object
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

id
string
required
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

id
string
Unique artist identifier (UUID)
name
string
Artist name
status
string
Artist status: active or inactive
userId
string
ID of the user who created the artist
createdAt
string
Timestamp when the artist was created (ISO 8601)
updatedAt
string
Timestamp when the artist was last updated (ISO 8601)

Build docs developers (and LLMs) love