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

name
string
required
Label name
email
string
Label contact email address
description
string
Label description or bio
country
string
Country code (e.g., ‘US’, ‘UK’, ‘RW’). Defaults to ‘RW’

Response

message
string
Success message: “Label created successfully”
data
object
The created label object

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

size
number
default:"10"
Number of labels per page
page
number
default:"0"
Page number (zero-indexed)
You can also pass additional query parameters to filter labels by any field (e.g., country=US).

Response

message
string
Success message: “Labels returned successfully”
data
array
Array of label objects

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

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

Response

message
string
Success message: “Label found successfully”
data
object
The label object

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

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

Request body

All fields are optional. Only include the fields you want to update.
name
string
Updated label name
email
string
Updated email address
description
string
Updated description
country
string
Updated country code

Response

message
string
Success message: “Label updated successfully”
data
object
The updated label object

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

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

id
string
Unique label identifier (UUID)
name
string
Label name
email
string
Label contact email
description
string
Label description or bio
country
string
Country code (ISO 3166-1 alpha-2)
userId
string
ID of the user who created the label
createdAt
string
Timestamp when the label was created (ISO 8601)
updatedAt
string
Timestamp when the label was last updated (ISO 8601)

Build docs developers (and LLMs) love