PHEMIUS API REFERENCE
Song metadata API
Song metadata API
The Song API lets trusted integrations add track metadata to a Phemius library. It does not accept or upload audio files; tracks created by this API appear in the library without audio.
Authentication
An administrator can generate and revoke keys at API keys in the site navigation. Give each integration its own key so it can be revoked independently. The full key is displayed only once when it is created; Phemius stores only a SHA-256 hash of it.
Send the key in the Authorization header over HTTPS:
Authorization: Bearer phm_your_api_key
Keep the key private and do not put it in a URL, source repository, or client-side application. A revoked key stops working immediately.
List songs
GET /api/v1/songs?page=1
Use the same bearer authentication header as the write endpoint. Pages are 1-based and contain up to 1,000 songs. If has_more is true, request next_page to continue. The order is newest created_at first, then artist, title, album, and ID for stable ties. Audio is never included.
{
"page": 1,
"per_page": 1000,
"has_more": true,
"next_page": 2,
"songs": [
{
"id": "8a6406f2-98f5-4a85-90d2-82b2fe0caf2a",
"title": "Blue in Green",
"artist": "Miles Davis",
"album": "Kind of Blue",
"year": 1959,
"genre": "Jazz",
"profanity": null,
"created_at": "2026-10-08T12:30:00+00:00"
}
]
}
page defaults to 1. The last page has has_more: false and next_page: null. created_at is the track's creation/upload timestamp.
profanity is true when a classifier has flagged profanity or explicit sexual content, false when checked and considered clear, and null before classification.
Add songs
POST /api/v1/songs
Send a JSON object with a songs array. Each request can contain 1–100 songs. The whole batch is validated before it is saved; if any song is invalid, none of the batch is saved.
Songs match existing tracks by exact, case-sensitive title and artist after trimming. A match is not inserted again. Instead, provided album, year, and genre values fill only fields that are currently blank/unknown; populated values are left unchanged. Omitted or null optional fields do not clear or replace existing values. This also makes repeated requests safe to retry.
POST /api/v1/songs HTTP/1.1
Content-Type: application/json
Authorization: Bearer phm_your_api_key
{
"songs": [
{
"title": "Blue in Green",
"artist": "Miles Davis",
"album": "Kind of Blue",
"year": 1959,
"genre": "Jazz"
},
{
"title": "So What",
"artist": "Miles Davis"
}
]
}
Song fields
| Field | Type | Required | Rules |
| --- | --- | --- | --- |
| title | string | Yes | Must not be empty after trimming; at most 500 characters. |
| artist | string | Yes | Must not be empty after trimming; at most 500 characters. |
| album | string | No | Defaults to an empty string; at most 500 characters. |
| year | integer or null | No | Defaults to unknown; must be between -32768 and 32767. |
| genre | string | No | Defaults to an empty string; at most 500 characters. |
Optional fields can be omitted or set to null. For a new track, these fields default to empty/unknown values. For a matching track, only non-empty supplied values can fill a currently empty field. Unknown fields are rejected, including audio and other file data. Text fields are trimmed before saving. Requests are limited to 1 MiB.
Response
Successful requests return 200 OK. inserted counts new tracks; skipped_duplicates counts title-and-artist matches; enriched counts matching tracks that had at least one blank optional field filled. Each result gives the existing or new ID:
{
"inserted": 1,
"skipped_duplicates": 1,
"enriched": 1,
"songs": [
{ "id": "8a6406f2-98f5-4a85-90d2-82b2fe0caf2a", "created": true, "enriched": false },
{ "id": "14ef5d52-f059-4a27-bbd0-ab01ac6d6e47", "created": false, "enriched": true }
]
}
Existing non-empty metadata and audio are never overwritten. Repeated entries within the same batch are also handled as matches. Save the returned IDs if you need to refer to the tracks later.
Errors
Errors are JSON objects with an error message.
| Status | Meaning |
| --- | --- |
| 400 Bad Request | Invalid JSON, unknown fields, an empty or oversized batch, or invalid song metadata. |
| 401 Unauthorized | The bearer key is missing, invalid, or revoked. |
| 413 Payload Too Large | The JSON request exceeds 1 MiB. |
| 500 Internal Server Error | The server could not save the batch. |