Skip to main content

Structure

GET /structure​

Get the structure of the Foundry world

Retrieves the folder and compendium structure for the specified Foundry world.

Required scope: structure:read

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
includeEntityDatabooleanqueryWhether to include full entity data or just UUIDs and names
pathstringqueryPath to read structure from (null = root)
recursivebooleanqueryWhether to read down the folder tree
recursiveDepthnumberqueryDepth to recurse into folders (default 5)
typesstringqueryTypes to return (Scene/Actor/Item/JournalEntry/RollTable/Cards/Macro/Playlist), can be comma-separated or JSON array
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - The folder and compendium structure

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/structure';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
includeEntityData: 'true',
recursive: 'true',
types: 'Scene'
};
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": "structure-result",
"requestId": "structure_1778896423682",
"data": {
"folders": {
"test-folder": { 3 keys }
},
"entities": {
"scenes": [ 20 items ]
}
}
}

GET /get-folder​

Get a specific folder by name

Required scope: structure:read

Parameters​

NameTypeRequiredSourceDescription
namestring✓body, queryName of the folder to retrieve
clientIdstringqueryClient ID for the Foundry world
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - The folder information and its contents

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/get-folder';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
name: 'test-folder'
};
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-folder-result",
"requestId": "get-folder_1778896423713",
"data": {
"id": "qVncHkNOxAuctXy2",
"uuid": "Folder.qVncHkNOxAuctXy2",
"name": "test-folder",
"type": "Scene",
"parentFolder": null,
"contents": []
}
}

POST /create-folder​

Create a new folder

Required scope: structure:write

Parameters​

NameTypeRequiredSourceDescription
namestring✓body, queryName of the new folder
folderTypestring✓body, queryType of folder (Scene, Actor, Item, JournalEntry, RollTable, Cards, Macro, Playlist)
clientIdstringqueryClient ID for the Foundry world
parentFolderIdstringbody, queryID of the parent folder (optional for root level)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - The created folder information

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/create-folder';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
name: 'test-folder',
folderType: 'Scene'
};
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'
}
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "create-folder-result",
"requestId": "create-folder_1778896423673",
"data": {
"id": "qVncHkNOxAuctXy2",
"uuid": "Folder.qVncHkNOxAuctXy2",
"name": "test-folder",
"type": "Scene",
"parentFolder": null
}
}

DELETE /delete-folder​

Delete a folder

Required scope: structure:write

Parameters​

NameTypeRequiredSourceDescription
folderIdstring✓body, queryID of the folder to delete
clientIdstringqueryClient ID for the Foundry world
deleteAllbooleanbody, queryWhether to delete all entities in the folder
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - Confirmation of deletion

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/delete-folder';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
folderId: 'qVncHkNOxAuctXy2'
};
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);

Response​

Status: 200

{
"type": "delete-folder-result",
"requestId": "delete-folder_1778896423715",
"data": {
"deleted": true,
"folderId": "qVncHkNOxAuctXy2",
"entitiesDeleted": 0,
"foldersDeleted": 1
}
}

GET /contents/:path​

This route is deprecated

Use /structure with the path query parameter instead.

Required scope: structure:read

Returns​

object - Error message directing to use /structure endpoint

Try It Out​