Villife API
The Villife REST API powers the web player, the desktop and iOS apps and Studio. It speaks JSON over HTTPS. This reference documents every endpoint of api.villife.org, plus the search host source.villife.org and the media host cdn.villife.org.
Base URL
| Host | Purpose |
|---|---|
https://api.villife.org | Accounts, catalog, library sync, Studio and moderation. |
https://source.villife.org | Search, HLS streaming and artwork proxy. |
https://cdn.villife.org | Uploaded audio and covers. |
Requests and responses are application/json; charset=utf-8 unless noted. Send Content-Type: application/json with a body.
Authentication
Signing in (/auth/login, /auth/email/verify, /auth/social or an approved QR session) creates a signed token valid for 30 days. You can present it in either way:
- Cookie —
sessionis set automatically (HttpOnly; Secure; SameSite=None). Browser clients must usecredentials: "include". - Bearer token — send
Authorization: Bearer <token>. Native apps and scripts should use this; the token is returned in the sign-in response body.
Signing out, changing the password or changing the email invalidates every token of the account at once.
Roles are user, artist, moderator and admin. Server-to-server tools may use X-Studio-Key or X-Admin-Key instead of a user session.
CSRF protection
For browser requests (those with an Origin header or a session cookie), every POST, PUT, PATCH and DELETE must include an X-CSRF-Token header equal to the csrf cookie, or the API answers 403 invalid csrf token. Get one from GET /auth/csrf. Requests that carry a Bearer token, X-Admin-Key or X-Studio-Key skip this check.
const API = "https://api.villife.org";
const { token } = await (await fetch(API + "/auth/csrf", { credentials: "include" })).json();
await fetch(API + "/auth/email/request", {
method: "POST",
credentials: "include",
headers: { "Content-Type": "application/json", "X-CSRF-Token": token },
body: JSON.stringify({ email: "[email protected]" })
});Errors
Errors use a non-2xx status and a JSON body with a short machine-readable message:
{ "error": "unauthorized" }| Status | Meaning |
|---|---|
400 | Invalid JSON, missing or malformed fields. |
401 | Not signed in, bad token, wrong credentials or code. |
403 | Signed in but not allowed, or invalid CSRF token. |
404 | Unknown route or object. |
409 | Conflict, such as an email that is already registered. |
410 | A one-time code has expired. |
429 | Rate limit exceeded. |
503 | A required service (auth, email delivery) is not configured or is unavailable. |
Rate limits
Limits are counted per client IP in a one-minute window: 30 requests to /auth/* and 60 to every other api.villife.org path. Some actions have tighter per-address limits (email codes: 3 requests and 5 verification attempts per minute). The search host allows 180 searches, 120 stream requests, 300 HLS requests and 240 image requests per minute. Exceeding a limit returns 429 {"error": "too many requests"}; wait a minute and retry.
Pagination and sorting
List endpoints accept limit (1–100, default 24) and offset. Where supported, sort selects one of the documented fields and order is asc or desc. Responses are plain JSON arrays.
CORS
Browsers may call the API from villife.org, web.villife.org, status.villife.org, docs.villife.org, source.villife.org, cdn.villife.org and from localhost. Allowed headers: Content-Type, Authorization, X-Admin-Key, X-Studio-Key, X-CSRF-Token. Credentials are allowed. Other origins can use the API with a Bearer token from non-browser clients.
Release status values
draft, pending review, approved, published, rejected.
System
#Service health
/healthPublicReports whether the API is up and whether its bindings (database and object storage) are available. The status page uses this endpoint.
Example
curl \
'https://api.villife.org/health'const response = await fetch("https://api.villife.org/health");
const data = await response.json();Response
{
"ready": true,
"r2": true,
"db": true
}Status codes
| Code | Description |
|---|---|
200 | The worker is running. r2 and db are false when the binding is missing. |
Authentication
Villife supports email codes, passwords and Microsoft. A successful sign-in sets the session cookie and returns the same token in the body.
#Get a CSRF token
/auth/csrfPublicReturns a random token and sets it in the csrf cookie (24 h, Secure; SameSite=None). Browsers must echo the token in the X-CSRF-Token header on every POST, PUT, PATCH and DELETE. Requests that carry Authorization: Bearer, X-Admin-Key or X-Studio-Key are exempt.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Example
curl \
'https://api.villife.org/auth/csrf'const response = await fetch("https://api.villife.org/auth/csrf", {
credentials: "include",
});
const data = await response.json();Response
{
"token": "9f2c…"
}Status codes
| Code | Description |
|---|---|
200 | Token issued. |
#Get Microsoft sign-in configuration
/auth/configPublicReturns the public Microsoft application settings used to start the OAuth (PKCE) flow in the browser.
Example
curl \
'https://api.villife.org/auth/config'const response = await fetch("https://api.villife.org/auth/config");
const data = await response.json();Response
{
"clientId": "00000000-0000-0000-0000-000000000000",
"tenant": "common"
}Status codes
| Code | Description |
|---|---|
200 | Configuration returned. Values are empty strings when Microsoft sign-in is not configured. |
#Register with a password
/auth/registerPublicCreates an unverified account and emails a 6-digit code. Verify it with POST /auth/email/verify before signing in with a password.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Body parameters
| Name | Type | Description |
|---|---|---|
emailrequired | string | A valid email address. Stored lower-case. |
passwordrequired | string | 8–128 characters. |
displayName | string | Up to 80 characters. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/register' \
-H \
'Content-Type: application/json' \
-d \
'{"email": "[email protected]", "password": "correct horse battery"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/register", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
body: JSON.stringify({ email, password }),
});
const data = await response.json();Response
{
"id": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"email": "[email protected]",
"displayName": "You",
"needsVerification": true,
"sent": true
}Status codes
| Code | Description |
|---|---|
200 | Account created. |
400 | Invalid email or password length (invalid credentials) or invalid JSON. |
409 | email already registered. |
503 | auth unavailable. |
#Sign in with a password
/auth/loginPublicSigns in and sets the session cookie (HttpOnly, 30 days). The same token is returned in the body so native clients can use it as a Bearer token. The email field also accepts a display name or a user id.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
emailrequired | string | Email, display name or user id. |
passwordrequired | string | The account password. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/login' \
-H \
'Content-Type: application/json' \
-d \
'{"email": "[email protected]", "password": "correct horse battery"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/login", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ email, password }),
});
const data = await response.json();Response
{
"id": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"email": "[email protected]",
"displayName": "You",
"role": "user",
"token": "eyJzdWIiOi…<signature>"
}Status codes
| Code | Description |
|---|---|
200 | Signed in. Set-Cookie: session=…. |
401 | invalid credentials. |
403 | email not verified — the body also contains email. |
429 | Rate limit. |
503 | auth unavailable. |
#Request a sign-in code
/auth/email/requestPublicEmails a 6-digit one-time code, valid for 10 minutes. Works for new and existing addresses — verifying a code for an unknown email creates the account. Limited to 3 requests per minute per address and IP.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Body parameters
| Name | Type | Description |
|---|---|---|
emailrequired | string | A valid email address. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/email/request' \
-H \
'Content-Type: application/json' \
-d \
'{"email": "[email protected]"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/email/request", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
body: JSON.stringify({ email }),
});
const data = await response.json();Response
{
"sent": true
}Status codes
| Code | Description |
|---|---|
200 | Code sent. |
400 | invalid email. |
429 | too many requests. |
503 | email delivery unavailable. |
#Verify a sign-in code
/auth/email/verifyPublicExchanges the emailed code for a session. Creates the account on first use and marks the email as verified. The code is single-use. Limited to 5 attempts per minute per address and IP.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
emailrequired | string | The address the code was sent to. |
coderequired | string | The 6-digit code. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/email/verify' \
-H \
'Content-Type: application/json' \
-d \
'{"email": "[email protected]", "code": "123456"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/email/verify", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ email, code }),
});
const data = await response.json();Response
{
"id": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"email": "[email protected]",
"displayName": "You",
"role": "user",
"token": "eyJzdWIiOi…<signature>"
}Status codes
| Code | Description |
|---|---|
200 | Signed in. Set-Cookie: session=…. |
401 | invalid code. |
410 | code expired. |
429 | too many attempts. |
#Get the signed-in user
/auth/meSessionReturns the account for the current session cookie or Bearer token.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Example
curl \
'https://api.villife.org/auth/me' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN'const response = await fetch("https://api.villife.org/auth/me", {
credentials: "include",
});
const data = await response.json();Response
{
"id": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"email": "[email protected]",
"displayName": "You",
"role": "user"
}Status codes
| Code | Description |
|---|---|
200 | The current user. |
401 | unauthorized — no session, an invalid token or a signed-out token. |
#Sign out
/auth/logoutPublicInvalidates every token of the account (the user's token_version is incremented) and clears the session and csrf cookies.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Example
curl \
-X \
POST \
'https://api.villife.org/auth/logout'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/logout", {
method: "POST",
headers: { "X-CSRF-Token": csrf },
credentials: "include",
});
const data = await response.json();Response
{
"signedOut": true
}Status codes
| Code | Description |
|---|---|
200 | Signed out. |
#Request a password reset code
/auth/password/reset/requestPublicEmails a 6-digit code valid for 10 minutes. The response does not reveal whether the address has an account. Limited to 3 requests per minute.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Body parameters
| Name | Type | Description |
|---|---|---|
emailrequired | string | A valid email address. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/password/reset/request' \
-H \
'Content-Type: application/json' \
-d \
'{"email": "[email protected]"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/password/reset/request", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
body: JSON.stringify({ email }),
});
const data = await response.json();Response
{
"sent": true
}Status codes
| Code | Description |
|---|---|
200 | sent is false if the email could not be delivered. |
400 | invalid email. |
429 | too many requests. |
#Reset the password
/auth/password/reset/confirmPublicSets a new password using the emailed code and invalidates all existing sessions.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Body parameters
| Name | Type | Description |
|---|---|---|
emailrequired | string | The account email. |
coderequired | string | The 6-digit code. |
passwordrequired | string | The new password, 8–128 characters. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/password/reset/confirm' \
-H \
'Content-Type: application/json' \
-d \
'{"email": "[email protected]", "code": "123456", "password": "correct horse battery"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/password/reset/confirm", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
body: JSON.stringify({ email, code, password }),
});
const data = await response.json();Response
{
"reset": true
}Status codes
| Code | Description |
|---|---|
200 | Password changed. |
400 | invalid credentials — bad password length. |
401 | invalid code. |
404 | not found. |
410 | code expired. |
429 | too many attempts. |
QR sign-in
QR sign-in lets a desktop or browser sign in by scanning a code with a phone that is already signed in. Flow: create → show QR → poll status → the phone calls approve → the next poll returns approved and sets the cookie.
#Create a QR sign-in session
/auth/qr/createPublicStarts a sign-in session for a device that wants to be approved from a phone. The session lives for 5 minutes. Encode https://villife.org/qr/?session=<session>&device=<device> in the QR code.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Body parameters
| Name | Type | Description |
|---|---|---|
device | string | Human-readable device name, up to 120 characters. Default Unknown device. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/qr/create' \
-H \
'Content-Type: application/json' \
-d \
'{}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/qr/create", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
body: JSON.stringify({ }),
});
const data = await response.json();Response
{
"session": "4f1b…e2",
"device": "Windows 11",
"expires": 1796040000000
}Status codes
| Code | Description |
|---|---|
200 | expires is a Unix timestamp in milliseconds. |
#Poll a QR session
/auth/qr/statusPublicReturns the state of a QR session. When it becomes approved, the response also sets the session cookie on the polling device — poll with credentials: "include" and then call GET /auth/me. The token is never placed in the body. Poll roughly once a second.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Query parameters
| Name | Type | Description |
|---|---|---|
sessionrequired | string | The session value from /auth/qr/create. |
Example
curl \
'https://api.villife.org/auth/qr/status?session=<session>'const response = await fetch(`https://api.villife.org/auth/qr/status?session=${encodeURIComponent(session)}`, {
credentials: "include",
});
const data = await response.json();Response
{
"status": "pending",
"device": "Windows 11"
}status is one of pending, approved, denied or expired.
Status codes
| Code | Description |
|---|---|
200 | Current state. |
404 | not found. |
#Approve or deny a QR session
/auth/qr/approveSessionCalled from the phone that scanned the code and is already signed in. Approving mints a 30-day session for the waiting device.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
sessionrequired | string | The session id from the QR code. |
decisionrequired | string | approve or deny. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/qr/approve' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN' \
-H \
'Content-Type: application/json' \
-d \
'{"session": "<session>", "decision": "approve"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/qr/approve", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ session, decision }),
});
const data = await response.json();Response
{
"status": "approved"
}Status codes
| Code | Description |
|---|---|
200 | Decision stored. |
400 | invalid decision. |
401 | unauthorized. |
404 | not found. |
409 | session unavailable — expired or already decided. |
Account
#Change the password
/auth/password/changeSessionChanges the password and signs out every device (the session cookie is cleared; sign in again).
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
currentPasswordrequired | string | The current password. |
newPasswordrequired | string | 8–128 characters. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/password/change' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN' \
-H \
'Content-Type: application/json' \
-d \
'{"currentPassword": "old", "newPassword": "new password"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/password/change", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ currentPassword, newPassword }),
});
const data = await response.json();Response
{
"changed": true
}Status codes
| Code | Description |
|---|---|
200 | Password changed. |
400 | invalid credentials — bad length. |
401 | unauthorized or wrong current password. |
#Request an email change
/auth/email/change/requestSessionSends a 6-digit code to the new address. Limited to 3 requests per minute.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
emailrequired | string | The new email address. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/email/change/request' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN' \
-H \
'Content-Type: application/json' \
-d \
'{"email": "[email protected]"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/email/change/request", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ email }),
});
const data = await response.json();Response
{
"sent": true
}Status codes
| Code | Description |
|---|---|
200 | Code sent. |
400 | invalid email. |
401 | unauthorized. |
409 | email already registered. |
429 | too many requests. |
#Confirm an email change
/auth/email/change/confirmSessionApplies the new address and invalidates all sessions.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
coderequired | string | The 6-digit code sent to the new address. |
Example
curl \
-X \
POST \
'https://api.villife.org/auth/email/change/confirm' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN' \
-H \
'Content-Type: application/json' \
-d \
'{"code": "123456"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/auth/email/change/confirm", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ code }),
});
const data = await response.json();Response
{
"email": "[email protected]",
"changed": true
}Status codes
| Code | Description |
|---|---|
200 | Email changed. |
401 | unauthorized or invalid code. |
409 | email already registered. |
410 | code expired. |
429 | too many attempts. |
Library & history
#Record a play
/historySessionAdds a track to the listening history.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
trackIdrequired | string | Track id, up to 128 characters. |
Example
curl \
-X \
POST \
'https://api.villife.org/history' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN' \
-H \
'Content-Type: application/json' \
-d \
'{"trackId": "tr-…"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/history", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ trackId }),
});
const data = await response.json();Response
{
"recorded": true
}Status codes
| Code | Description |
|---|---|
200 | Recorded. |
400 | missing trackId. |
401 | unauthorized. |
#List listening history
/historySessionMost recent plays first.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Query parameters
| Name | Type | Description |
|---|---|---|
limit | integer | Page size, 1–100. Default 24. |
Example
curl \
'https://api.villife.org/history?' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN'const response = await fetch("https://api.villife.org/history", {
credentials: "include",
});
const data = await response.json();Response
[
{
"track_id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"played_at": "2026-11-29 12:04:11",
"title": "Night Drive",
"artwork_url": "https://cdn.villife.org/covers/….webp"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of plays. |
401 | unauthorized. |
#Get recommendations
/recommendationsSessionPublished tracks by artists the user already listens to, excluding tracks already played, ranked by score (the number of plays of that artist). Admins may pass another user.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Query parameters
| Name | Type | Description |
|---|---|---|
user | string | User id. Ignored unless it is your own id or you are an admin. |
limit | integer | 1–50. Default 12. |
Example
curl \
'https://api.villife.org/recommendations?' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN'const response = await fetch("https://api.villife.org/recommendations", {
credentials: "include",
});
const data = await response.json();Response
[
{
"id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"title": "Night Drive",
"duration": 214,
"artwork_url": "https://cdn.villife.org/covers/….webp",
"artist": "Nova",
"album": "Neon",
"score": 7
}
]Status codes
| Code | Description |
|---|---|
200 | Array of tracks. |
401 | unauthorized. |
#Follow an artist
/users/{artistId}/followSessionThe path segment is the artist id.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
artistIdrequired | string | Artist id. |
Example
curl \
-X \
POST \
'https://api.villife.org/users/<artistId>/follow' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch(`https://api.villife.org/users/${artistId}/follow`, {
method: "POST",
headers: { "X-CSRF-Token": csrf },
credentials: "include",
});
const data = await response.json();Response
{
"followerId": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"artistId": "ar-5b7e2a90-61c4-4a3d-b2f1-7e8d9c0a1b23",
"following": true
}Status codes
| Code | Description |
|---|---|
200 | Now following (idempotent). |
401 | unauthorized. |
#Unfollow an artist
/users/{artistId}/followSessionRemoves the follow.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
artistIdrequired | string | Artist id. |
Example
curl \
-X \
DELETE \
'https://api.villife.org/users/<artistId>/follow' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch(`https://api.villife.org/users/${artistId}/follow`, {
method: "DELETE",
headers: { "X-CSRF-Token": csrf },
credentials: "include",
});
const data = await response.json();Response
{
"following": false
}Status codes
| Code | Description |
|---|---|
200 | Done. |
401 | unauthorized. |
#List followed artists
/users/{userId}/followingSession · self or adminOnly the user themself or an admin may read this list.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
userIdrequired | string | User id. |
Query parameters
| Name | Type | Description |
|---|---|---|
limit | integer | Page size, 1–100. Default 24. |
Example
curl \
'https://api.villife.org/users/<userId>/following?' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN'const response = await fetch(`https://api.villife.org/users/${userId}/following`, {
credentials: "include",
});
const data = await response.json();Response
[
{
"artist_id": "ar-5b7e2a90-61c4-4a3d-b2f1-7e8d9c0a1b23",
"created_at": "2026-11-20 09:12:00"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of follows. |
403 | forbidden. |
#Get synced data
/sync/{userId}Session · self or adminReturns the JSON document the apps use to sync settings, library and playlists.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
userIdrequired | string | User id. |
Example
curl \
'https://api.villife.org/sync/<userId>' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN'const response = await fetch(`https://api.villife.org/sync/${userId}`, {
credentials: "include",
});
const data = await response.json();Response
{
"data": {
"playlists": [],
"favorites": []
},
"updatedAt": "2026-11-29 12:00:00"
}Returns { "data": null } if nothing was stored yet.
Status codes
| Code | Description |
|---|---|
200 | Stored document. |
403 | forbidden. |
#Store synced data
/sync/{userId}Session · self or adminReplaces the stored document. The serialized JSON must be at most 1 MiB.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
userIdrequired | string | User id. |
Body parameters
| Name | Type | Description |
|---|---|---|
datarequired | any | Any JSON value. If data is omitted the whole body is stored. |
Example
curl \
-X \
PUT \
'https://api.villife.org/sync/<userId>' \
-H \
'Authorization: Bearer $VILLIFE_TOKEN' \
-H \
'Content-Type: application/json' \
-d \
'{"data": {"favorites": []}}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch(`https://api.villife.org/sync/${userId}`, {
method: "PUT",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ data }),
});
const data = await response.json();Response
{
"ownerId": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"updated": true
}Status codes
| Code | Description |
|---|---|
200 | Stored. |
400 | invalid json or too large. |
403 | forbidden. |
#Report content
/reportsPublicFiles a moderation report. It appears in the moderation log as pending review.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Body parameters
| Name | Type | Description |
|---|---|---|
targetTyperequired | string | What is reported, for example track, release or lyrics. |
targetIdrequired | string | Id of the reported object. |
reasonrequired | string | Up to 2000 characters. |
Example
curl \
-X \
POST \
'https://api.villife.org/reports' \
-H \
'Content-Type: application/json' \
-d \
'{"targetType": "track", "targetId": "tr-…", "reason": "Copyright claim"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/reports", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
body: JSON.stringify({ targetType, targetId, reason }),
});
const data = await response.json();Response
{
"id": "b7f0…",
"status": "pending review"
}Status codes
| Code | Description |
|---|---|
200 | Report stored. |
400 | missing fields. |
Catalog
Catalog endpoints return only published content and are public.
#List artists
/artistsPublicSearches artists by name.
Query parameters
| Name | Type | Description |
|---|---|---|
q | string | Substring of the name. |
limit | integer | Page size, 1–100. Default 24. |
offset | integer | Number of rows to skip. Default 0. |
sort | string | One of name, created_at. Default name. |
order | string | asc (default) or desc. |
Example
curl \
'https://api.villife.org/artists?'const response = await fetch("https://api.villife.org/artists");
const data = await response.json();Response
[
{
"id": "ar-5b7e2a90-61c4-4a3d-b2f1-7e8d9c0a1b23",
"name": "Nova",
"avatar_url": ""
}
]Status codes
| Code | Description |
|---|---|
200 | Array of artists. |
#List albums
/albumsPublicOnly albums with a published release are returned.
Query parameters
| Name | Type | Description |
|---|---|---|
q | string | Substring of the album title or artist name. |
artist | string | Filter by artist id. |
limit | integer | Page size, 1–100. Default 24. |
offset | integer | Number of rows to skip. Default 0. |
sort | string | One of title, release_date. Default release_date. |
order | string | asc (default) or desc. |
Example
curl \
'https://api.villife.org/albums?'const response = await fetch("https://api.villife.org/albums");
const data = await response.json();Response
[
{
"id": "al-1",
"title": "Neon",
"artwork_url": "",
"release_date": "2026-10-01",
"artist": "Nova"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of albums. |
#List tracks
/tracksPublicOnly published tracks are returned.
Query parameters
| Name | Type | Description |
|---|---|---|
q | string | Substring of the title or artist name. |
album | string | Filter by album id. |
artist | string | Filter by artist id. |
limit | integer | Page size, 1–100. Default 24. |
offset | integer | Number of rows to skip. Default 0. |
sort | string | One of title, duration. Default title. |
order | string | asc (default) or desc. |
Example
curl \
'https://api.villife.org/tracks?'const response = await fetch("https://api.villife.org/tracks");
const data = await response.json();Response
[
{
"id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"title": "Night Drive",
"duration": 214,
"artwork_url": "https://cdn.villife.org/covers/….webp",
"artist": "Nova",
"album": "Neon"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of tracks. |
#Get a track
/tracks/{id}PublicReturns a published track.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Track id. |
Example
curl \
'https://api.villife.org/tracks/<id>'const response = await fetch(`https://api.villife.org/tracks/${id}`);
const data = await response.json();Response
{
"id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"title": "Night Drive",
"duration": 214,
"artwork_url": "https://cdn.villife.org/covers/….webp",
"artist": "Nova",
"album": "Neon"
}Status codes
| Code | Description |
|---|---|
200 | The track. |
404 | not found — unknown or unpublished. |
#Search the catalog
/searchPublicSearches artists (up to 8), albums (up to 8) and tracks (up to 16) at once. An empty q returns empty lists.
Query parameters
| Name | Type | Description |
|---|---|---|
qrequired | string | Search text. |
Example
curl \
'https://api.villife.org/search?q=night'const response = await fetch(`https://api.villife.org/search?q=${encodeURIComponent(q)}`);
const data = await response.json();Response
{
"artists": [
{
"id": "ar-5b7e2a90-61c4-4a3d-b2f1-7e8d9c0a1b23",
"name": "Nova",
"avatar_url": ""
}
],
"albums": [
{
"id": "al-1",
"title": "Neon",
"artwork_url": ""
}
],
"tracks": [
{
"id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"title": "Night Drive",
"duration": 214,
"artwork_url": ""
}
]
}Status codes
| Code | Description |
|---|---|
200 | Grouped results. |
#Get lyrics
/lyrics/{trackId}PublicReturns published lyrics for a published track.
Path parameters
| Name | Type | Description |
|---|---|---|
trackIdrequired | string | Track id. |
Example
curl \
'https://api.villife.org/lyrics/<trackId>'const response = await fetch(`https://api.villife.org/lyrics/${trackId}`);
const data = await response.json();Response
{
"language": "en",
"text": "…"
}Status codes
| Code | Description |
|---|---|
200 | Lyrics. |
404 | not found. |
#Check offline eligibility
/offline/eligible/{trackId}PublicTells whether the latest release of the track is published, allows offline playback and has not expired.
Path parameters
| Name | Type | Description |
|---|---|---|
trackIdrequired | string | Track id. |
Example
curl \
'https://api.villife.org/offline/eligible/<trackId>'const response = await fetch(`https://api.villife.org/offline/eligible/${trackId}`);
const data = await response.json();Response
{
"trackId": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"allowed": true
}Status codes
| Code | Description |
|---|---|
200 | Always 200; read allowed. |
#Get artist statistics
/analytics/artist/{id}PublicTotal plays, distinct listeners and track count for an artist.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Artist id. |
Example
curl \
'https://api.villife.org/analytics/artist/<id>'const response = await fetch(`https://api.villife.org/analytics/artist/${id}`);
const data = await response.json();Response
{
"artistId": "ar-5b7e2a90-61c4-4a3d-b2f1-7e8d9c0a1b23",
"plays": 1280,
"listeners": 342,
"tracks": 9
}Status codes
| Code | Description |
|---|---|
200 | Statistics. |
Studio
Studio endpoints are for artists and moderators. Authenticate with a user whose role is artist, moderator or admin (session cookie or Bearer token), or with the X-Studio-Key header. A release moves through draft → pending review → approved → published, or to rejected with a reason; rejected releases can be edited and resubmitted.
#List your releases
/studio/releasesStudioReleases owned by owner. Non-admins can only list their own.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Query parameters
| Name | Type | Description |
|---|---|---|
ownerrequired | string | Owner user id. |
limit | integer | Page size, 1–100. Default 24. |
offset | integer | Number of rows to skip. Default 0. |
Example
curl \
'https://api.villife.org/studio/releases?owner=<user-id>' \
-H \
'X-Studio-Key: $STUDIO_KEY'const response = await fetch(`https://api.villife.org/studio/releases?owner=${encodeURIComponent(owner)}`, {
credentials: "include",
});
const data = await response.json();Response
[
{
"id": "rel-1a2b3c4d-5e6f-4789-9abc-def012345678",
"album_id": null,
"track_id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"owner_id": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"status": "draft",
"reason": null,
"updated_at": "2026-11-29 12:00:00"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of releases. |
403 | forbidden. |
#Upload audio
/studio/uploadStudioUploads an audio file to object storage. The file type is detected from its bytes: MP3 (ID3), Ogg, FLAC, MP4/M4A and WAV. Maximum 50 MiB.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
filerequired | file | The audio file (multipart/form-data). |
Example
curl \
-X \
POST \
'https://api.villife.org/studio/upload' \
-H \
'X-Studio-Key: $STUDIO_KEY' \
-F \
'file=@./track.mp3'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const form = new FormData();
form.append("file", fileInput.files[0]);
const response = await fetch("https://api.villife.org/studio/upload", {
method: "POST",
headers: { "X-CSRF-Token": csrf },
credentials: "include",
body: form,
});
const data = await response.json();Response
{
"key": "audio/0c4e…-….mp3",
"sha256": "e3b0c442…"
}Status codes
| Code | Description |
|---|---|
200 | Stored. Pass key to POST /studio/tracks. |
400 | no file, file too large, invalid type or invalid form. |
403 | forbidden. |
#Upload a cover
/studio/upload-coverStudioUploads a JPEG, PNG or WebP image. Maximum 10 MiB.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
filerequired | file | The image (multipart/form-data). |
Example
curl \
-X \
POST \
'https://api.villife.org/studio/upload-cover' \
-H \
'X-Studio-Key: $STUDIO_KEY' \
-F \
'file=@./track.mp3'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const form = new FormData();
form.append("file", fileInput.files[0]);
const response = await fetch("https://api.villife.org/studio/upload-cover", {
method: "POST",
headers: { "X-CSRF-Token": csrf },
credentials: "include",
body: form,
});
const data = await response.json();Response
{
"key": "covers/7a1d…-….webp"
}Status codes
| Code | Description |
|---|---|
200 | Stored. The public URL is https://cdn.villife.org/<key>. |
400 | no file, file too large or invalid type. |
403 | forbidden. |
#Create an artist
/studio/artistsStudioCreates an artist profile owned by the caller.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
namerequired | string | Up to 120 characters. |
Example
curl \
-X \
POST \
'https://api.villife.org/studio/artists' \
-H \
'X-Studio-Key: $STUDIO_KEY' \
-H \
'Content-Type: application/json' \
-d \
'{"name": "Nova"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/studio/artists", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ name }),
});
const data = await response.json();Response
{
"id": "ar-5b7e2a90-61c4-4a3d-b2f1-7e8d9c0a1b23",
"name": "Nova",
"ownerId": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b"
}Status codes
| Code | Description |
|---|---|
200 | Created. |
400 | missing name. |
403 | forbidden. |
#Create a track draft
/studio/tracksStudioCreates a track and a draft release. Non-admins must own the artist; an unowned artist without tracks is claimed on first use.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Body parameters
| Name | Type | Description |
|---|---|---|
titlerequired | string | Track title. |
artistIdrequired | string | Artist id. |
ownerIdrequired | string | Your user id. |
audioKeyrequired | string | key from /studio/upload. |
duration | number | Length in seconds. |
artworkUrl | string | Cover URL. |
territory | string | Release territory. |
licenseType | string | License type. |
Example
curl \
-X \
POST \
'https://api.villife.org/studio/tracks' \
-H \
'X-Studio-Key: $STUDIO_KEY' \
-H \
'Content-Type: application/json' \
-d \
'{"title": "Night Drive", "artistId": "ar-…", "ownerId": "usr-…", "audioKey": "audio/….mp3"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/studio/tracks", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ title, artistId, ownerId, audioKey }),
});
const data = await response.json();Response
{
"id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"releaseId": "rel-1a2b3c4d-5e6f-4789-9abc-def012345678",
"status": "draft"
}Status codes
| Code | Description |
|---|---|
200 | Draft created. |
400 | missing fields. |
403 | forbidden or artist owned by another account. |
404 | unknown artist. |
#Get a track and its status
/studio/tracks/{id}StudioReturns the track with its release status and moderation reason.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Track id. |
Example
curl \
'https://api.villife.org/studio/tracks/<id>' \
-H \
'X-Studio-Key: $STUDIO_KEY'const response = await fetch(`https://api.villife.org/studio/tracks/${id}`, {
credentials: "include",
});
const data = await response.json();Response
{
"id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"title": "Night Drive",
"duration": 214,
"artwork_url": "",
"status": "rejected",
"reason": "Cover contains a watermark"
}Status codes
| Code | Description |
|---|---|
200 | The track. |
403 | forbidden. |
404 | not found. |
#Edit a track
/studio/tracks/{id}StudioAllowed only while the release is draft or rejected. Editing a rejected release returns it to draft.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Track id. |
Body parameters
| Name | Type | Description |
|---|---|---|
titlerequired | string | New title. |
duration | number | Length in seconds. |
artworkUrl | string | Cover URL. |
Example
curl \
-X \
PATCH \
'https://api.villife.org/studio/tracks/<id>' \
-H \
'X-Studio-Key: $STUDIO_KEY' \
-H \
'Content-Type: application/json' \
-d \
'{"title": "Night Drive"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch(`https://api.villife.org/studio/tracks/${id}`, {
method: "PATCH",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
credentials: "include",
body: JSON.stringify({ title }),
});
const data = await response.json();Response
{
"id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"title": "Night Drive",
"duration": 214,
"artworkUrl": ""
}Status codes
| Code | Description |
|---|---|
200 | Updated. |
403 | forbidden. |
404 | not found. |
409 | not editable. |
#Submit a release for review
/studio/releases/{id}/submitStudioMoves a draft or rejected release to pending review.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Browser calls need credentials: "include" so the session cookie is sent or stored.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Release id (rel-…). |
Example
curl \
-X \
POST \
'https://api.villife.org/studio/releases/<id>/submit' \
-H \
'X-Studio-Key: $STUDIO_KEY'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch(`https://api.villife.org/studio/releases/${id}/submit`, {
method: "POST",
headers: { "X-CSRF-Token": csrf },
credentials: "include",
});
const data = await response.json();Response
{
"id": "rel-1a2b3c4d-5e6f-4789-9abc-def012345678",
"status": "pending review"
}Status codes
| Code | Description |
|---|---|
200 | Submitted. |
400 | invalid status. |
403 | forbidden. |
404 | not found. |
Admin
Admin endpoints require X-Admin-Key. If two-factor is enabled on the server, also send the current TOTP code in X-Admin-Code. These endpoints are not meant for browsers.
#List releases
/releasesAdminModeration queue across all owners.
Query parameters
| Name | Type | Description |
|---|---|---|
status | string | One of draft, pending review, approved, published, rejected. |
limit | integer | Page size, 1–100. Default 24. |
offset | integer | Number of rows to skip. Default 0. |
sort | string | One of updated_at, status. Default updated_at. |
order | string | asc (default) or desc. |
Example
curl \
'https://api.villife.org/releases?' \
-H \
'X-Admin-Key: $ADMIN_KEY'const response = await fetch("https://api.villife.org/releases", {
headers: { "X-Admin-Key": adminKey },
});
const data = await response.json();Response
[
{
"id": "rel-1a2b3c4d-5e6f-4789-9abc-def012345678",
"album_id": null,
"track_id": "tr-9d1c1c5e-2f0a-4b8e-8f6e-0b7d5f1a2c34",
"owner_id": "usr-3f2b9c1e-7a54-4d0e-9a6b-1c2d3e4f5a6b",
"status": "pending review",
"reason": null,
"territory": "",
"license_type": "",
"updated_at": "2026-11-29 12:00:00"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of releases. |
403 | forbidden. |
#Moderate a release or lyrics
/releases/{id}/statusAdminAlso available as POST /lyrics/{id}/status for lyrics. The change is written to the moderation log.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Release or lyrics id. |
Body parameters
| Name | Type | Description |
|---|---|---|
statusrequired | string | One of draft, pending review, approved, published, rejected. |
reason | string | Shown to the owner. |
actor | string | Moderator name for the log. Default admin. |
Example
curl \
-X \
POST \
'https://api.villife.org/releases/<id>/status' \
-H \
'X-Admin-Key: $ADMIN_KEY' \
-H \
'Content-Type: application/json' \
-d \
'{"status": "published"}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch(`https://api.villife.org/releases/${id}/status`, {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf, "X-Admin-Key": adminKey },
body: JSON.stringify({ status }),
});
const data = await response.json();Response
{
"id": "rel-1a2b3c4d-5e6f-4789-9abc-def012345678",
"status": "published"
}Status codes
| Code | Description |
|---|---|
200 | Updated. |
400 | invalid status. |
403 | forbidden. |
404 | not found. |
#Import tracks
/catalog/importAdminBulk-inserts track metadata. Existing ids are skipped. id must match ^[a-zA-Z0-9:_-]{1,128}$.
Browsers must send X-CSRF-Token (see CSRF). Not needed with a Bearer token or API key.
Body parameters
| Name | Type | Description |
|---|---|---|
itemsrequired | array | Objects with id, title, artistId, and optionally albumId, duration, artworkUrl. A bare array body is also accepted. |
Example
curl \
-X \
POST \
'https://api.villife.org/catalog/import' \
-H \
'X-Admin-Key: $ADMIN_KEY' \
-H \
'Content-Type: application/json' \
-d \
'{"items": [{"id": "tr-1", "title": "…", "artistId": "ar-1"}]}'const { token: csrf } = await (await fetch("https://api.villife.org/auth/csrf", { credentials: "include" })).json();
const response = await fetch("https://api.villife.org/catalog/import", {
method: "POST",
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf, "X-Admin-Key": adminKey },
body: JSON.stringify({ items }),
});
const data = await response.json();Response
{
"imported": 2,
"skipped": 1,
"errors": [
{
"id": null,
"error": "invalid metadata"
}
]
}Status codes
| Code | Description |
|---|---|
200 | Result per batch. |
403 | forbidden. |
#Find duplicate tracks
/catalog/duplicatesAdminTracks that share a title and artist (up to 100 groups).
Example
curl \
'https://api.villife.org/catalog/duplicates' \
-H \
'X-Admin-Key: $ADMIN_KEY'const response = await fetch("https://api.villife.org/catalog/duplicates", {
headers: { "X-Admin-Key": adminKey },
});
const data = await response.json();Response
[
{
"title_key": "night drive",
"artist": "Nova",
"copies": 2,
"ids": "tr-1,tr-2"
}
]Status codes
| Code | Description |
|---|---|
200 | Groups of duplicates. |
403 | forbidden. |
#Get catalog totals
/analyticsAdminRow counts for the main tables.
Example
curl \
'https://api.villife.org/analytics' \
-H \
'X-Admin-Key: $ADMIN_KEY'const response = await fetch("https://api.villife.org/analytics", {
headers: { "X-Admin-Key": adminKey },
});
const data = await response.json();Response
{
"artists": 120,
"albums": 80,
"tracks": 940,
"releases": 960,
"lyrics": 310,
"rights": 0,
"users": 2100,
"playlists": 420,
"listening_history": 58000,
"moderation_actions": 77
}Status codes
| Code | Description |
|---|---|
200 | Totals. |
403 | forbidden. |
Search & streaming
Search and streaming live on a separate host, https://source.villife.org. These endpoints need no authentication and no CSRF token. Responses use the same JSON error shape: {"error": "…"}.
#Search tracks
/searchPublicSearches SoundCloud and returns up to 24 streamable tracks. Limited to 180 requests per minute.
Query parameters
| Name | Type | Description |
|---|---|---|
qrequired | string | Search text. |
Example
curl \
'https://source.villife.org/search?q=night'const response = await fetch(`https://source.villife.org/search?q=${encodeURIComponent(q)}`);
const data = await response.json();Response
[
{
"id": "sc:123456789",
"title": "Night Drive",
"artist": "Nova",
"artistId": "sc:1234",
"avatar": "",
"artwork": "https://source.villife.org/image?url=…",
"duration": 214,
"preview": "",
"stream": "/api/stream?id=sc%3A123456789",
"url": "https://soundcloud.com/…"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of tracks. |
400 | no query. |
429 | Rate limit. |
#Search playlists
/search/playlistsPublicUp to 12 playlists. Limited to 180 requests per minute.
Query parameters
| Name | Type | Description |
|---|---|---|
qrequired | string | Search text. |
Example
curl \
'https://source.villife.org/search/playlists?q=night'const response = await fetch(`https://source.villife.org/search/playlists?q=${encodeURIComponent(q)}`);
const data = await response.json();Response
[
{
"id": "sc-set:987",
"title": "Night mix",
"artist": "Nova",
"artistId": "sc:1234",
"artwork": "https://source.villife.org/image?url=…",
"trackCount": 12,
"year": "2026",
"type": "playlist"
}
]type is album or playlist.
Status codes
| Code | Description |
|---|---|
200 | Array of playlists. |
400 | no query. |
#Get an HLS stream
/streamPublicReturns an HLS master playlist (application/vnd.apple.mpegurl) whose segments are proxied through /hls. Limited to 120 requests per minute.
Query parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Track id such as sc:123456789. |
Example
curl \
'https://source.villife.org/stream?id=sc:123456789'const response = await fetch(`https://source.villife.org/stream?id=${encodeURIComponent(id)}`);
const body = await response.text();Response
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=128000
https://source.villife.org/hls?url=…Status codes
| Code | Description |
|---|---|
200 | HLS playlist. |
400 | invalid id. |
502 | track unavailable or stream unavailable. |
#Find an artist by name
/artistPublicUp to 5 matching users.
Query parameters
| Name | Type | Description |
|---|---|---|
namerequired | string | Artist name. |
Example
curl \
'https://source.villife.org/artist?name=Nova'const response = await fetch(`https://source.villife.org/artist?name=${encodeURIComponent(name)}`);
const data = await response.json();Response
[
{
"id": "sc:1234",
"name": "Nova"
}
]Status codes
| Code | Description |
|---|---|
200 | Array of matches; empty without name. |
#Proxy an image
/imagePublicFetches and caches artwork from soundcloud.com and sndcdn.com only. Limited to 240 requests per minute.
Query parameters
| Name | Type | Description |
|---|---|---|
urlrequired | string | Absolute image URL. |
Example
curl \
'https://source.villife.org/image?url=<image-url>'const response = await fetch(`https://source.villife.org/image?url=${encodeURIComponent(url)}`);
const body = await response.text();Response
(binary image)Status codes
| Code | Description |
|---|---|
200 | The image. |
400 | invalid url. |
403 | forbidden — host not allowed. |
502 | image unavailable. |
#Warm-up / health
/warmPublicLightweight readiness probe used by the status page.
Example
curl \
'https://source.villife.org/warm'const response = await fetch("https://source.villife.org/warm");
const data = await response.json();Response
{
"ready": true
}Status codes
| Code | Description |
|---|---|
200 | Ready. |
CDN
Media is served from https://cdn.villife.org. Keys come from the Studio upload endpoints.
#Download an object
/{key}PublicServes objects uploaded through Studio, for example audio/<uuid>.mp3 or covers/<uuid>.webp. Supports Range requests (206 Partial Content), HEAD and CORS for any origin. Only GET, HEAD and OPTIONS are allowed.
Path parameters
| Name | Type | Description |
|---|---|---|
keyrequired | string | Object key, up to 512 characters. |
Example
curl \
'https://cdn.villife.org/<key>'const response = await fetch(`https://cdn.villife.org/${key}`);
const body = await response.text();Response
(object bytes)Status codes
| Code | Description |
|---|---|
200 | Whole object. |
206 | Requested byte range. |
404 | Object not found. |
405 | Method not allowed. |
#Sign in with Microsoft
/auth/socialPublicAccepts a Microsoft
id_tokenobtained through the PKCE flow, verifies its signature, audience, tenant, issuer and expiry, creates the account if needed and signs in.Browsers must send
X-CSRF-Token(see CSRF). Not needed with a Bearer token or API key.Browser calls need
credentials: "include"so the session cookie is sent or stored.Body parameters
idTokenrequiredExample
Response
Status codes
200401invalid token.503auth unavailable.