Encounter
GET /encounters
Get all active encounters
Retrieves a list of all currently active encounters in the Foundry world.
Required scope: encounter:read
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| 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
array - An array of active encounters with details
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/encounters';
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);
curl -X GET 'http://localhost:3010/encounters?clientId=fvtt_099ad17ea199e7e3' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/encounters'
params = {
'clientId': 'fvtt_099ad17ea199e7e3'
}
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 = '/encounters';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
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
🔤/encounters🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤GET /encounters🧲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": "encounters-result", "requestId": "encounters_1778896436545", "encounters": [ 0: { "id": "PB0vvGNb0h66rsIi", "round": 1, "turn": 0, "current": true, "combatants": [ 1 item ] } ]}
POST /start-encounter
Start a new encounter
Initiates a new encounter in the Foundry world.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| tokens | array | body | Array of token UUIDs to include in the encounter | |
| startWithSelected | boolean | body | Whether to start with selected tokens | |
| startWithPlayers | boolean | body | Whether to start with players | |
| rollNPC | boolean | body | Whether to roll for NPCs | |
| rollAll | boolean | body | Whether to roll for all tokens | |
| name | string | body | The name of the encounter | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the started encounter
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/start-encounter';
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({
"startWithSelected": true,
"rollAll": true
})
});
const data = await response.json();
console.log(data);
curl -X POST 'http://localhost:3010/start-encounter?clientId=fvtt_099ad17ea199e7e3' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"startWithSelected":true,"rollAll":true}'
import requests
base_url = 'http://localhost:3010'
path = '/start-encounter'
params = {
'clientId': 'fvtt_099ad17ea199e7e3'
}
url = f'{base_url}{path}'
response = requests.post(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
},
json={
"startWithSelected": True,
"rollAll": True
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/start-encounter';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
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: {
"startWithSelected": true,
"rollAll": true
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/start-encounter🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Request body
🔤{"startWithSelected":true,"rollAll":true}🔤 ➡️ body
💭 Build HTTP request
🔤POST /start-encounter🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 41❌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": "start-encounter-result", "requestId": "start-encounter_1778896436492", "encounterId": "PB0vvGNb0h66rsIi", "encounter": { "id": "PB0vvGNb0h66rsIi", "round": 1, "turn": 0, "combatants": [ 0: { 8 keys } ] }}
POST /next-turn
Advance to the next turn in the encounter
Moves the encounter to the next turn.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| encounter | string | body, query | The ID of the encounter (optional, defaults to current encounter) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the next turn
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/next-turn';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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);
curl -X POST 'http://localhost:3010/next-turn?clientId=fvtt_099ad17ea199e7e3&encounterId=PB0vvGNb0h66rsIi' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/next-turn'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'encounterId': 'PB0vvGNb0h66rsIi'
}
url = f'{base_url}{path}'
response = requests.post(
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 = '/next-turn';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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'
},
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
🔤/next-turn🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤encounterId=PB0vvGNb0h66rsIi🔤 ➡️ encounterId
🔤?🧲clientId🧲&🧲encounterId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤POST /next-turn🧲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": "next-turn-result", "requestId": "next-turn_1778896436560", "encounterId": "PB0vvGNb0h66rsIi", "action": "nextTurn", "currentTurn": 0, "currentRound": 2, "actorTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG.Actor.S6Nh5SfYPcyyUhRg", "tokenTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG", "encounter": { "id": "PB0vvGNb0h66rsIi", "round": 2, "turn": 0 }}
POST /next-round
Advance to the next round in the encounter
Moves the encounter to the next round.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| encounter | string | body, query | The ID of the encounter (optional, defaults to current encounter) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the next round
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/next-round';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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);
curl -X POST 'http://localhost:3010/next-round?clientId=fvtt_099ad17ea199e7e3&encounterId=PB0vvGNb0h66rsIi' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/next-round'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'encounterId': 'PB0vvGNb0h66rsIi'
}
url = f'{base_url}{path}'
response = requests.post(
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 = '/next-round';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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'
},
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
🔤/next-round🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤encounterId=PB0vvGNb0h66rsIi🔤 ➡️ encounterId
🔤?🧲clientId🧲&🧲encounterId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤POST /next-round🧲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": "next-round-result", "requestId": "next-round_1778896436575", "encounterId": "PB0vvGNb0h66rsIi", "action": "nextRound", "currentTurn": 0, "currentRound": 3, "actorTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG.Actor.S6Nh5SfYPcyyUhRg", "tokenTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG", "encounter": { "id": "PB0vvGNb0h66rsIi", "round": 3, "turn": 0 }}
POST /last-turn
Go back to the last turn in the encounter
Moves the encounter back to the last turn.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| encounter | string | body, query | The ID of the encounter (optional, defaults to current encounter) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the last turn
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/last-turn';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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);
curl -X POST 'http://localhost:3010/last-turn?clientId=fvtt_099ad17ea199e7e3&encounterId=PB0vvGNb0h66rsIi' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/last-turn'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'encounterId': 'PB0vvGNb0h66rsIi'
}
url = f'{base_url}{path}'
response = requests.post(
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 = '/last-turn';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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'
},
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
🔤/last-turn🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤encounterId=PB0vvGNb0h66rsIi🔤 ➡️ encounterId
🔤?🧲clientId🧲&🧲encounterId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤POST /last-turn🧲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": "last-turn-result", "requestId": "last-turn_1778896436584", "encounterId": "PB0vvGNb0h66rsIi", "action": "previousTurn", "currentTurn": 0, "currentRound": 2, "actorTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG.Actor.S6Nh5SfYPcyyUhRg", "tokenTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG", "encounter": { "id": "PB0vvGNb0h66rsIi", "round": 2, "turn": 0 }}
POST /last-round
Go back to the last round in the encounter
Moves the encounter back to the last round.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| encounter | string | body, query | The ID of the encounter (optional, defaults to current encounter) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the last round
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/last-round';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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);
curl -X POST 'http://localhost:3010/last-round?clientId=fvtt_099ad17ea199e7e3&encounterId=PB0vvGNb0h66rsIi' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/last-round'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'encounterId': 'PB0vvGNb0h66rsIi'
}
url = f'{base_url}{path}'
response = requests.post(
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 = '/last-round';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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'
},
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
🔤/last-round🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤encounterId=PB0vvGNb0h66rsIi🔤 ➡️ encounterId
🔤?🧲clientId🧲&🧲encounterId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤POST /last-round🧲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": "last-round-result", "requestId": "last-round_1778896436595", "encounterId": "PB0vvGNb0h66rsIi", "action": "previousRound", "currentTurn": 0, "currentRound": 1, "actorTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG.Actor.S6Nh5SfYPcyyUhRg", "tokenTurn": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG", "encounter": { "id": "PB0vvGNb0h66rsIi", "round": 1, "turn": 0 }}
POST /end-encounter
End an encounter
Ends the current encounter in the Foundry world.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| encounter | string | body, query | The ID of the encounter (optional, defaults to current encounter) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the ended encounter
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/end-encounter';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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);
curl -X POST 'http://localhost:3010/end-encounter?clientId=fvtt_099ad17ea199e7e3&encounterId=PB0vvGNb0h66rsIi' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/end-encounter'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'encounterId': 'PB0vvGNb0h66rsIi'
}
url = f'{base_url}{path}'
response = requests.post(
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 = '/end-encounter';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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'
},
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
🔤/end-encounter🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤encounterId=PB0vvGNb0h66rsIi🔤 ➡️ encounterId
🔤?🧲clientId🧲&🧲encounterId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤POST /end-encounter🧲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": "end-encounter-result", "requestId": "end-encounter_1778896436617", "encounterId": "PB0vvGNb0h66rsIi", "message": "Encounter successfully ended"}
POST /add-to-encounter
Add tokens to an encounter
Adds selected tokens or specified UUIDs to the current encounter.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| encounter | string | body, query | The ID of the encounter (optional, defaults to current encounter) | |
| selected | boolean | query, body | Whether to get the selected entity | |
| uuids | array | body | The UUIDs of the tokens to add | |
| rollInitiative | boolean | body | Whether to roll initiative for the added tokens | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the updated encounter
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/add-to-encounter';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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({
"selected": true,
"uuids": [],
"rollInitiative": true
})
});
const data = await response.json();
console.log(data);
curl -X POST 'http://localhost:3010/add-to-encounter?clientId=fvtt_099ad17ea199e7e3&encounterId=PB0vvGNb0h66rsIi' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"selected":true,"uuids":[],"rollInitiative":true}'
import requests
base_url = 'http://localhost:3010'
path = '/add-to-encounter'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'encounterId': 'PB0vvGNb0h66rsIi'
}
url = f'{base_url}{path}'
response = requests.post(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
},
json={
"selected": True,
"uuids": [],
"rollInitiative": True
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/add-to-encounter';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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: {
"selected": true,
"uuids": [],
"rollInitiative": true
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/add-to-encounter🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤encounterId=PB0vvGNb0h66rsIi🔤 ➡️ encounterId
🔤?🧲clientId🧲&🧲encounterId🧲🔤 ➡️ queryString
💭 Request body
🔤{"selected":true,"uuids":[],"rollInitiative":true}🔤 ➡️ body
💭 Build HTTP request
🔤POST /add-to-encounter🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 50❌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": "add-to-encounter-result", "requestId": "add-to-encounter_1778896436611", "encounterId": "PB0vvGNb0h66rsIi", "added": [ 0: "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG" ], "failed": []}
POST /remove-from-encounter
Remove tokens from an encounter
Removes selected tokens or specified UUIDs from the current encounter.
Required scope: encounter:manage
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| encounter | string | body, query | The ID of the encounter (optional, defaults to current encounter) | |
| selected | boolean | query, body | Whether to get the selected entity | |
| uuids | array | body | The UUIDs of the tokens to remove | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Details of the updated encounter
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/remove-from-encounter';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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({
"selected": true
})
});
const data = await response.json();
console.log(data);
curl -X POST 'http://localhost:3010/remove-from-encounter?clientId=fvtt_099ad17ea199e7e3&encounterId=PB0vvGNb0h66rsIi' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"selected":true}'
import requests
base_url = 'http://localhost:3010'
path = '/remove-from-encounter'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'encounterId': 'PB0vvGNb0h66rsIi'
}
url = f'{base_url}{path}'
response = requests.post(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
},
json={
"selected": True
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/remove-from-encounter';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
encounterId: 'PB0vvGNb0h66rsIi'
};
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: {
"selected": true
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/remove-from-encounter🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤encounterId=PB0vvGNb0h66rsIi🔤 ➡️ encounterId
🔤?🧲clientId🧲&🧲encounterId🧲🔤 ➡️ queryString
💭 Request body
🔤{"selected":true}🔤 ➡️ body
💭 Build HTTP request
🔤POST /remove-from-encounter🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 17❌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": "remove-from-encounter-result", "requestId": "remove-from-encounter_1778896436602", "encounterId": "PB0vvGNb0h66rsIi", "removed": [ 0: "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG" ], "failed": []}