Scene
GET /scene
Get scene(s)
Retrieves one or more scenes by ID, name, active status, viewed status, or all.
Required scope: scene:read
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | query | ID of a specific scene to retrieve | |
| name | string | query | Name of the scene to retrieve | |
| active | boolean | query | Set to true to get the currently active scene | |
| viewed | boolean | query | Set to true to get the currently viewed scene | |
| all | boolean | query | Set to true to get all scenes | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Scene data
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b',
all: 'true'
};
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);
curl -X GET 'http://localhost:3010/scene?clientId=fvtt_d3db244ce1d8af0b&all=true' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/scene'
params = {
'clientId': 'fvtt_d3db244ce1d8af0b',
'all': 'true'
}
url = f'{base_url}{path}'
response = requests.get(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b',
all: 'true'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'get',
headers: {
'x-api-key': 'your-api-key-here'
},
url
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/scene🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_d3db244ce1d8af0b🔤 ➡️ clientId
🔤all=true🔤 ➡️ all
🔤?🧲clientId🧲&🧲all🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤GET /scene🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌n❌r❌n🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "get-scene-result", "requestId": "get-scene_1780520747090", "data": [ 0: { "name": "Scene", "_id": "VMgXWxqpyTg9YMLM", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "width": 4000, "height": 3000, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "grid": { 8 keys }, "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } }, 1: { "grid": { 8 keys }, "height": 1000, "name": "test-scene-updated", "width": 1000, "_id": "AVBmSoK7PtJvvtVU", "active": true, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [ 1 item ], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } }, 2: { "grid": { 8 keys }, "height": 1000, "name": "test-scene-updated", "width": 1000, "_id": "D7u4piOGW6MssTg2", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } }, 3: { "grid": { 8 keys }, "height": 1000, "name": "test-scene-updated", "width": 1000, "_id": "HaoRAKtpNwkQnXch", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [ 1 item ], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } }, 4: { "grid": { 8 keys }, "height": 1000, "name": "test-scene-updated", "width": 1000, "_id": "ZRzmXcZ7N3aq4DlC", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [ 1 item ], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } }, 5: { "grid": { 8 keys }, "height": 1000, "name": "test-scene-updated", "width": 1000, "_id": "lIawgFuWnlgFq8e8", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [ 1 item ], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } }, 6: { "grid": { 8 keys }, "height": 1000, "name": "test-scene", "width": 1000, "_id": "Lxz4vYKs8VE4gpcw", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } }, 7: { "height": 500, "name": "test-scene-expendable", "width": 500, "_id": "2qQUvnbEhK3gO9eK", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { 11 keys }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { 3 keys }, "backgroundColor": "#999999", "grid": { 8 keys }, "tokenVision": true, "fog": { 3 keys }, "environment": { 6 keys }, "drawings": [], "tokens": [], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { 2 keys }, "flags": {}, "_stats": { 8 keys } } ]}
GET /scene/image/raw
Get the raw background image of a scene
Returns the scene's background image file without any tokens, lights, or other canvas elements rendered on it.
Required scope: scene:read
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | body, query | Scene ID (defaults to viewed/active scene) | |
| active | boolean | body, query | If true, explicitly use the player-facing active scene instead of the viewed scene | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
binary - The raw scene background image
Try It Out
POST /scene
Create a new scene
Required scope: scene:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| data | object | ✓ | body | Scene data object (name, width, height, grid, etc.) |
| clientId | string | query | Client ID for the Foundry world | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Created scene data
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b'
};
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({
"data": {
"name": "test-scene",
"width": 1000,
"height": 1000,
"grid": {
"size": 100
}
}
})
});
const data = await response.json();
console.log(data);
curl -X POST 'http://localhost:3010/scene?clientId=fvtt_d3db244ce1d8af0b' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"data":{"name":"test-scene","width":1000,"height":1000,"grid":{"size":100}}}'
import requests
base_url = 'http://localhost:3010'
path = '/scene'
params = {
'clientId': 'fvtt_d3db244ce1d8af0b'
}
url = f'{base_url}{path}'
response = requests.post(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
},
json={
"data": {
"name": "test-scene",
"width": 1000,
"height": 1000,
"grid": {
"size": 100
}
}
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'post',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
url,
data: {
"data": {
"name": "test-scene",
"width": 1000,
"height": 1000,
"grid": {
"size": 100
}
}
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/scene🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_d3db244ce1d8af0b🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Request body
🔤{"data":{"name":"test-scene","width":1000,"height":1000,"grid":{"size":100}}}🔤 ➡️ body
💭 Build HTTP request
🔤POST /scene🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 77❌r❌n❌r❌n🧲body🧲🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "create-scene-result", "requestId": "create-scene_1780520747073", "data": { "grid": { "size": 100, "type": 1, "style": "solidLines", "thickness": 1, "color": "#000000", "alpha": 0.2, "distance": 5, "units": "ft" }, "height": 1000, "name": "test-scene", "width": 1000, "_id": "Lxz4vYKs8VE4gpcw", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { "src": null, "anchorX": 0, "anchorY": 0, "offsetX": 0, "offsetY": 0, "fit": "fill", "scaleX": 1, "scaleY": 1, "rotation": 0, "tint": "#ffffff", "alphaThreshold": 0 }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { "x": null, "y": null, "scale": 0.5 }, "backgroundColor": "#999999", "tokenVision": true, "fog": { "exploration": true, "overlay": null, "colors": { 2 keys } }, "environment": { "darknessLevel": 0, "darknessLock": false, "globalLight": { 10 keys }, "cycle": true, "base": { 5 keys }, "dark": { 5 keys } }, "drawings": [], "tokens": [], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { "default": 0, "fCfNJPT9Atc26yyv": 3 }, "flags": {}, "_stats": { "compendiumSource": null, "duplicateSource": null, "coreVersion": "12.331", "systemId": "dnd5e", "systemVersion": "4.3.8", "createdTime": 1780520747075, "modifiedTime": 1780520747075, "lastModifiedBy": "fCfNJPT9Atc26yyv" } }}
PUT /scene
Update an existing scene
Required scope: scene:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| data | object | ✓ | body | Object containing the scene fields to update |
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | body, query | ID of the scene to update | |
| name | string | body, query | Name of the scene to update (alternative to sceneId) | |
| active | boolean | body, query | Set to true to target the active scene | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Updated scene data
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'PUT',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"sceneId": "Lxz4vYKs8VE4gpcw",
"data": {
"name": "test-scene-updated"
}
})
});
const data = await response.json();
console.log(data);
curl -X PUT 'http://localhost:3010/scene?clientId=fvtt_d3db244ce1d8af0b' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"sceneId":"Lxz4vYKs8VE4gpcw","data":{"name":"test-scene-updated"}}'
import requests
base_url = 'http://localhost:3010'
path = '/scene'
params = {
'clientId': 'fvtt_d3db244ce1d8af0b'
}
url = f'{base_url}{path}'
response = requests.put(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
},
json={
"sceneId": "Lxz4vYKs8VE4gpcw",
"data": {
"name": "test-scene-updated"
}
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'put',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
url,
data: {
"sceneId": "Lxz4vYKs8VE4gpcw",
"data": {
"name": "test-scene-updated"
}
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/scene🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_d3db244ce1d8af0b🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Request body
🔤{"sceneId":"Lxz4vYKs8VE4gpcw","data":{"name":"test-scene-updated"}}🔤 ➡️ body
💭 Build HTTP request
🔤PUT /scene🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 67❌r❌n❌r❌n🧲body🧲🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "update-scene-result", "requestId": "update-scene_1780520747095", "data": { "grid": { "size": 100, "type": 1, "style": "solidLines", "thickness": 1, "color": "#000000", "alpha": 0.2, "distance": 5, "units": "ft" }, "height": 1000, "name": "test-scene-updated", "width": 1000, "_id": "Lxz4vYKs8VE4gpcw", "active": false, "navigation": true, "navOrder": 0, "navName": "", "background": { "src": null, "anchorX": 0, "anchorY": 0, "offsetX": 0, "offsetY": 0, "fit": "fill", "scaleX": 1, "scaleY": 1, "rotation": 0, "tint": "#ffffff", "alphaThreshold": 0 }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { "x": null, "y": null, "scale": 0.5 }, "backgroundColor": "#999999", "tokenVision": true, "fog": { "exploration": true, "overlay": null, "colors": { 2 keys } }, "environment": { "darknessLevel": 0, "darknessLock": false, "globalLight": { 10 keys }, "cycle": true, "base": { 5 keys }, "dark": { 5 keys } }, "drawings": [], "tokens": [], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { "default": 0, "fCfNJPT9Atc26yyv": 3 }, "flags": {}, "_stats": { "compendiumSource": null, "duplicateSource": null, "coreVersion": "12.331", "systemId": "dnd5e", "systemVersion": "4.3.8", "createdTime": 1780520747075, "modifiedTime": 1780520747096, "lastModifiedBy": "fCfNJPT9Atc26yyv" } }}
DELETE /scene
Delete a scene
Required scope: scene:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | query | ID of the scene to delete | |
| name | string | query | Name of the scene to delete (alternative to sceneId) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Deletion result
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b',
sceneId: '2qQUvnbEhK3gO9eK'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'DELETE',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);
curl -X DELETE 'http://localhost:3010/scene?clientId=fvtt_d3db244ce1d8af0b&sceneId=2qQUvnbEhK3gO9eK' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/scene'
params = {
'clientId': 'fvtt_d3db244ce1d8af0b',
'sceneId': '2qQUvnbEhK3gO9eK'
}
url = f'{base_url}{path}'
response = requests.delete(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b',
sceneId: '2qQUvnbEhK3gO9eK'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'delete',
headers: {
'x-api-key': 'your-api-key-here'
},
url
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/scene🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_d3db244ce1d8af0b🔤 ➡️ clientId
🔤sceneId=2qQUvnbEhK3gO9eK🔤 ➡️ sceneId
🔤?🧲clientId🧲&🧲sceneId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤DELETE /scene🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌n❌r❌n🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "delete-scene-result", "requestId": "delete-scene_1780520752116", "success": true}
POST /switch-scene
Switch the active scene
Required scope: scene:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | body, query | ID of the scene to activate | |
| name | string | body, query | Name of the scene to activate (alternative to sceneId) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Result of the scene switch
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/switch-scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b'
};
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({
"sceneId": "Lxz4vYKs8VE4gpcw"
})
});
const data = await response.json();
console.log(data);
curl -X POST 'http://localhost:3010/switch-scene?clientId=fvtt_d3db244ce1d8af0b' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"sceneId":"Lxz4vYKs8VE4gpcw"}'
import requests
base_url = 'http://localhost:3010'
path = '/switch-scene'
params = {
'clientId': 'fvtt_d3db244ce1d8af0b'
}
url = f'{base_url}{path}'
response = requests.post(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
},
json={
"sceneId": "Lxz4vYKs8VE4gpcw"
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/switch-scene';
const params = {
clientId: 'fvtt_d3db244ce1d8af0b'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'post',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
url,
data: {
"sceneId": "Lxz4vYKs8VE4gpcw"
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/switch-scene🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_d3db244ce1d8af0b🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Request body
🔤{"sceneId":"Lxz4vYKs8VE4gpcw"}🔤 ➡️ body
💭 Build HTTP request
🔤POST /switch-scene🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 30❌r❌n❌r❌n🧲body🧲🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "switch-scene-result", "requestId": "switch-scene_1780520747102", "success": true, "data": { "grid": { "size": 100, "type": 1, "style": "solidLines", "thickness": 1, "color": "#000000", "alpha": 0.2, "distance": 5, "units": "ft" }, "height": 1000, "name": "test-scene-updated", "width": 1000, "_id": "Lxz4vYKs8VE4gpcw", "active": true, "navigation": true, "navOrder": 0, "navName": "", "background": { "src": null, "anchorX": 0, "anchorY": 0, "offsetX": 0, "offsetY": 0, "fit": "fill", "scaleX": 1, "scaleY": 1, "rotation": 0, "tint": "#ffffff", "alphaThreshold": 0 }, "foreground": null, "foregroundElevation": null, "thumb": null, "padding": 0.25, "initial": { "x": null, "y": null, "scale": 0.5 }, "backgroundColor": "#999999", "tokenVision": true, "fog": { "exploration": true, "overlay": null, "colors": { 2 keys } }, "environment": { "darknessLevel": 0, "darknessLock": false, "globalLight": { 10 keys }, "cycle": true, "base": { 5 keys }, "dark": { 5 keys } }, "drawings": [], "tokens": [], "lights": [], "notes": [], "sounds": [], "regions": [], "templates": [], "tiles": [], "walls": [], "playlist": null, "playlistSound": null, "journal": null, "journalEntryPage": null, "weather": "", "folder": null, "sort": 0, "ownership": { "default": 0, "fCfNJPT9Atc26yyv": 3 }, "flags": {}, "_stats": { "compendiumSource": null, "duplicateSource": null, "coreVersion": "12.331", "systemId": "dnd5e", "systemVersion": "4.3.8", "createdTime": 1780520747075, "modifiedTime": 1780520747103, "lastModifiedBy": "fCfNJPT9Atc26yyv" } }}
GET /scene/image
Get a rendered screenshot of a scene
Captures the full rendered canvas of a scene including all visible layers (tokens, lights, walls, etc.) as an image. The scene can be specified by ID or defaults to the active scene.
Required scope: scene:read
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| sceneId | string | query | Scene ID (defaults to viewed/active scene) | |
| active | boolean | query | If true, explicitly use the player-facing active scene instead of the viewed scene | |
| clientId | string | query | Client ID for the Foundry world | |
| format | string | query | Image format: png or jpeg (default: png) | |
| quality | number | query | Image quality 0-1 for JPEG (default: 0.9) | |
| viewport | boolean | query | If true, capture exactly what the browser currently shows instead of the full scene | |
| width | number | query | Output image width in pixels (default: scene width) | |
| height | number | query | Output image height in pixels (default: scene height) | |
| showGrid | boolean | query | Include grid lines in capture (default: false) | |
| hideOverlays | boolean | query | Hide fog of war, weather, vision, and UI overlays (default: false) | |
| userId | string | query | Foundry user ID or username |
Returns
binary - The scene screenshot as an image