Skip to main content

User

GET /users​

List all Foundry users

Retrieves a list of all users configured in the Foundry VTT world, including their roles and online status. This is a GM-only operation.

Required scope: user:read

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 user objects with id, name, role, isGM, active, color, avatar, and character fields

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/users';
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-users-result",
"requestId": "get-users_1778896442204",
"data": [
0: {
"id": "5ypAoBvOiyjDKiaZ",
"name": "Gamemaster",
"role": 4,
"isGM": true,
"active": false,
"color": "#28cca2",
"avatar": "icons/svg/mystery-man.svg",
"character": null
},
1: {
"id": "r6bXhB7k9cXa3cif",
"name": "tester",
"role": 4,
"isGM": true,
"active": true,
"color": "#cc2829",
"avatar": "icons/svg/mystery-man.svg",
"character": null
},
2: {
"id": "XQP35eYL5dUPscgE",
"name": "s2s-test-2",
"role": 1,
"isGM": false,
"active": false,
"color": "#a0cc28",
"avatar": "icons/svg/mystery-man.svg",
"character": null
},
3: {
"id": "JLfKTeTgCDpAdDfw",
"name": "some-cool-guy",
"role": 1,
"isGM": false,
"active": false,
"color": "#6328cc",
"avatar": "icons/svg/mystery-man.svg",
"character": null
},
4: {
"id": "NIY9RLVBVRZgBH66",
"name": "test",
"role": 1,
"isGM": false,
"active": false,
"color": "#cc6328",
"avatar": "icons/svg/mystery-man.svg",
"character": null
}
]
}

GET /user​

Get a single Foundry user

Retrieves a single user by their ID or name. This is a GM-only operation.

Required scope: user:read

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
idstringqueryID of the user to retrieve
namestringqueryName of the user to retrieve (alternative to id)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - User object with id, name, role, isGM, active, color, avatar, and character fields

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/user';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
id: '7odiSNcQcQ6jG68g'
};
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-user-result",
"requestId": "get-user_1778896442215",
"data": {
"id": "7odiSNcQcQ6jG68g",
"name": "test-api-user",
"role": 1,
"isGM": false,
"active": false,
"color": "#28cc4c",
"avatar": "icons/svg/mystery-man.svg",
"character": null
}
}

POST /user​

Create a new Foundry user

Creates a new user in the Foundry VTT world with the specified name, role, and optional password. This is a GM-only operation.

Required scope: user:write

Parameters​

NameTypeRequiredSourceDescription
namestring✓bodyUsername for the new user
clientIdstringqueryClient ID for the Foundry world
rolenumberbodyUser role: 0=None, 1=Player, 2=Trusted, 3=Assistant, 4=GM (default: 1)
passwordstringbodyPassword for the new user
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - The created user object

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/user';
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({
"name": "test-api-user",
"role": 1,
"password": "your-password-here"
})
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "create-user-result",
"requestId": "create-user_1778896442206",
"data": {
"id": "7odiSNcQcQ6jG68g",
"name": "test-api-user",
"role": 1,
"isGM": false,
"active": false,
"color": "#28cc4c",
"avatar": "icons/svg/mystery-man.svg",
"character": null
}
}

PUT /user​

Update an existing Foundry user

Updates fields on an existing user. Identify the user by id or name, then pass the fields to update in the data object. Cannot demote the last GM user. This is a GM-only operation.

Required scope: user:write

Parameters​

NameTypeRequiredSourceDescription
dataobject✓bodyObject containing user fields to update (name, role, password, color, avatar, character)
clientIdstringqueryClient ID for the Foundry world
idstringbody, queryID of the user to update
namestringbody, queryName of the user to update (alternative to id)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - The updated user object

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/user';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
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({
"id": "7odiSNcQcQ6jG68g",
"data": {
"role": 2
}
})
});
const data = await response.json();
console.log(data);

Response​

Status: 200

{
"type": "update-user-result",
"requestId": "update-user_1778896442218",
"data": {
"id": "7odiSNcQcQ6jG68g",
"name": "test-api-user",
"role": 2,
"isGM": false,
"active": false,
"color": "#28cc4c",
"avatar": "icons/svg/mystery-man.svg",
"character": null
}
}

DELETE /user​

Delete a Foundry user

Permanently deletes a user from the Foundry VTT world. Cannot delete yourself or the last GM user. This is a GM-only operation.

Required scope: user:write

Parameters​

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
idstringqueryID of the user to delete
namestringqueryName of the user to delete (alternative to id)
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns​

object - Deletion result

Try It Out​

Code Examples​

const baseUrl = 'http://localhost:3010';
const path = '/user';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
id: '7odiSNcQcQ6jG68g'
};
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-user-result",
"requestId": "delete-user_1778896442232",
"success": true
}