The labels endpoints allow you to create, read, update, and delete record label profiles. All endpoints require JWT authentication.
Create label
POST /api/labels
Create a new record label.
Authentication required: Yes (JWT Bearer token)
Request body
Label contact email address
Country code (e.g., ‘US’, ‘UK’, ‘RW’). Defaults to ‘RW’
Response
Success message: “Label created successfully”
Example request
curl -X POST https://your-domain.com/api/labels \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Sonic Wave Records",
"email": "[email protected]",
"description": "Independent electronic music label",
"country": "US"
}'
const response = await fetch('https://your-domain.com/api/labels', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Sonic Wave Records',
email: '[email protected]',
description: 'Independent electronic music label',
country: 'US'
})
});
const data = await response.json();
Example response
{
"message": "Label created successfully",
"data": {
"id": "b2c3d4e5-f6a7-4b5c-8d7e-9f8a7b6c5d4e",
"name": "Sonic Wave Records",
"email": "[email protected]",
"description": "Independent electronic music label",
"country": "US",
"userId": "550e8400-e29b-41d4-a716-446655440000",
"createdAt": "2024-03-04T10:00:00.000Z",
"updatedAt": "2024-03-04T10:00:00.000Z"
}
}
List labels
GET /api/labels
Retrieve a paginated list of labels.
Authentication required: Yes (JWT Bearer token)
Query parameters
Number of labels per page
Page number (zero-indexed)
You can also pass additional query parameters to filter labels by any field (e.g., country=US).
Response
Success message: “Labels returned successfully”
Example request
curl -X GET "https://your-domain.com/api/labels?size=20&page=0&country=US" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const params = new URLSearchParams({
size: '20',
page: '0',
country: 'US'
});
const response = await fetch(`https://your-domain.com/api/labels?${params}`, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const data = await response.json();
Example response
{
"message": "Labels returned successfully",
"data": [
{
"id": "b2c3d4e5-f6a7-4b5c-8d7e-9f8a7b6c5d4e",
"name": "Sonic Wave Records",
"email": "[email protected]",
"description": "Independent electronic music label",
"country": "US",
"userId": "550e8400-e29b-41d4-a716-446655440000",
"createdAt": "2024-03-04T10:00:00.000Z",
"updatedAt": "2024-03-04T10:00:00.000Z"
}
]
}
Get label by ID
GET /api/labels/:id
Retrieve a specific label by ID.
Authentication required: Yes (JWT Bearer token)
Path parameters
The unique identifier (UUID) of the label
Response
Success message: “Label found successfully”
Example request
curl -X GET https://your-domain.com/api/labels/b2c3d4e5-f6a7-4b5c-8d7e-9f8a7b6c5d4e \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const labelId = 'b2c3d4e5-f6a7-4b5c-8d7e-9f8a7b6c5d4e';
const response = await fetch(`https://your-domain.com/api/labels/${labelId}`, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const data = await response.json();
Error responses
404 Not Found - Label does not exist
{
"statusCode": 404,
"message": "Label not found"
}
Update label
PATCH /api/labels/:id
Update an existing label.
Authentication required: Yes (JWT Bearer token)
Path parameters
The unique identifier (UUID) of the label
Request body
All fields are optional. Only include the fields you want to update.
Response
Success message: “Label updated successfully”
Example request
curl -X PATCH https://your-domain.com/api/labels/b2c3d4e5-f6a7-4b5c-8d7e-9f8a7b6c5d4e \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "Premier independent electronic music label",
"email": "[email protected]"
}'
const response = await fetch(`https://your-domain.com/api/labels/${labelId}`, {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: 'Premier independent electronic music label',
email: '[email protected]'
})
});
const data = await response.json();
Error responses
404 Not Found - Label does not exist
{
"statusCode": 404,
"message": "Label not found"
}
Delete label
DELETE /api/labels/:id
Delete a label.
Authentication required: Yes (JWT Bearer token)
Path parameters
The unique identifier (UUID) of the label
Response
Returns 204 No Content on successful deletion.
Example request
curl -X DELETE https://your-domain.com/api/labels/b2c3d4e5-f6a7-4b5c-8d7e-9f8a7b6c5d4e \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const response = await fetch(`https://your-domain.com/api/labels/${labelId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
}
});
if (response.status === 204) {
console.log('Label deleted successfully');
}
Error responses
404 Not Found - Label does not exist
{
"statusCode": 404,
"message": "Label not found"
}
Label object structure
Unique label identifier (UUID)
Country code (ISO 3166-1 alpha-2)
ID of the user who created the label
Timestamp when the label was created (ISO 8601)
Timestamp when the label was last updated (ISO 8601)