Skip to main content

Playlist

GET /playlists​

Get all playlists

Returns all playlists in the world with their tracks/sounds, including playing status, mode, and volume information.

Required scope: playlist:control

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

array - Array of playlists with their sounds

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/playlists';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;

const response = await fetch(url, {
method: 'GET',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "get-playlists-result",
"requestId": "get-playlists_1778896440084",
"data": {
"playlists": [
0: { 8 keys }
]
}
}

POST /playlist/play​

Play a playlist or specific sound

Starts playback of an entire playlist or a specific sound within it. The playlist can be identified by ID or name. Optionally specify a specific sound/track to play within the playlist.

Required scope: playlist:control

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
playlistIdstringbody, queryID of the playlist (optional if playlistName provided)
playlistNamestringbody, queryName of the playlist (optional if playlistId provided)
soundIdstringbody, queryID of a specific sound to play within the playlist
soundNamestringbody, queryName of a specific sound to play (optional if soundId provided)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - Playback status confirmation

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/playlist/play';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"playlistName": "test-rest-api-playlist"
})
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "playlist-play-result",
"requestId": "playlist-play_1778896440090",
"data": {
"playlist": {
"id": "4lS0v0rGoaO5NnLq",
"name": "test-rest-api-playlist",
"description": "",
"playing": true,
"mode": 0,
"folder": null,
"sorting": "a",
"sounds": [ 1 item ]
}
}
}

POST /playlist/stop​

Stop a playlist

Stops playback of the specified playlist.

Required scope: playlist:control

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
playlistIdstringbody, queryID of the playlist (optional if playlistName provided)
playlistNamestringbody, queryName of the playlist (optional if playlistId provided)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - Stop confirmation

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/playlist/stop';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"playlistName": "test-rest-api-playlist"
})
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "playlist-stop-result",
"requestId": "playlist-stop_1778896440103",
"data": {
"playlist": {
"id": "4lS0v0rGoaO5NnLq",
"name": "test-rest-api-playlist",
"description": "",
"playing": false,
"mode": 0,
"folder": null,
"sorting": "a",
"sounds": [ 1 item ]
}
}
}

POST /playlist/next​

Skip to next track in a playlist

Advances to the next sound/track in the specified playlist.

Required scope: playlist:control

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
playlistIdstringbody, queryID of the playlist (optional if playlistName provided)
playlistNamestringbody, queryName of the playlist (optional if playlistId provided)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - Next track information

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/playlist/next';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"playlistName": "test-rest-api-playlist"
})
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "playlist-next-result",
"requestId": "playlist-next_1778896440096",
"data": {
"playlist": {
"id": "4lS0v0rGoaO5NnLq",
"name": "test-rest-api-playlist",
"description": "",
"playing": true,
"mode": 0,
"folder": null,
"sorting": "a",
"sounds": [ 1 item ]
}
}
}

POST /playlist/volume​

Set volume for a playlist or specific sound

Adjusts the volume of an entire playlist or a specific sound within it. Volume is specified as a float between 0 (silent) and 1 (full volume).

Required scope: playlist:control

Parameters​

NameTypeRequiredSourceDescription
volumenumber✓body, queryVolume level from 0.0 (silent) to 1.0 (full volume)
clientIdstringqueryClient ID for the Foundry world
playlistIdstringbody, queryID of the playlist (optional if playlistName provided)
playlistNamestringbody, queryName of the playlist (optional if playlistId provided)
soundIdstringbody, queryID of a specific sound to adjust volume for
soundNamestringbody, queryName of a specific sound to adjust volume for (optional if soundId provided)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - Updated volume level

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/playlist/volume';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"playlistName": "test-rest-api-playlist",
"volume": 0.75
})
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "playlist-volume-result",
"requestId": "playlist-volume_1778896440100",
"data": {
"playlist": {
"id": "4lS0v0rGoaO5NnLq",
"name": "test-rest-api-playlist",
"description": "",
"playing": true,
"mode": 0,
"folder": null,
"sorting": "a",
"sounds": [ 1 item ]
}
}
}

POST /stop-sound​

Play a one-shot sound effect

Triggers playback of an audio file by its path. Useful for sound effects, ambient sounds, or any audio that should play once without being part of a playlist. Stop a playing sound Stops playback of a currently playing sound by its source path. If no src is provided, stops all currently playing sounds.

Required scope: playlist:control

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
srcstringbody, queryPath to the audio file to stop (omit to stop all sounds)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - Stop confirmation

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/stop-sound';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"src": "sounds/dice.wav"
})
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "stop-sound-result",
"requestId": "stop-sound_1778896440110",
"data": {
"stopped": 0,
"src": "sounds/dice.wav"
}
}