APIRoutes.BasicAPIFeatures - edtomb/SwarmUI GitHub Wiki
This is a subset of the API docs, see ../API for general info.
Basic general API routes, primarily for users and session handling.
- HTTP Route AddNewPreset
- HTTP Route ChangeUserSettings
- HTTP Route DeletePreset
- HTTP Route DuplicatePreset
- HTTP Route GetAPIKeyStatus
- HTTP Route GetCurrentStatus
- HTTP Route GetLanguage
- HTTP Route GetMyUserData
- HTTP Route GetNewSession
- HTTP Route GetUserSettings
- WebSocket Route InstallConfirmWS
- HTTP Route InterruptAll
- HTTP Route ServerDebugMessage
- HTTP Route SetAPIKey
- HTTP Route SetParamEdits
- HTTP Route SetStarredModels
User route to add a new parameter preset.
manage_presets
- Manage Presets
in group User
Name | Type | Description | Default |
---|---|---|---|
title | String | Name of the new preset. | (REQUIRED) |
description | String | User-facing description text. | (REQUIRED) |
raw | JObject | Use 'param_map' key to send the raw parameter mapping, equivalent to GenerateText2Image. | (REQUIRED) |
preview_image | String | Optional preview image data base64 string. | (null) |
is_edit | Boolean | If true, edit an existing preset. If false, do not override pre-existing presets of the same name. | False |
editing | String | If is_edit is set, include the original preset name here. | (null) |
"success": true
// or:
"preset_fail": "Some friendly error text here"
User route to change user settings data.
edit_user_settings
- Edit User Settings
in group User
Name | Type | Description | Default |
---|---|---|---|
rawData | JObject | Simple object map of key as setting ID to new setting value to apply. | (REQUIRED) |
"success": true
User route to delete a preset.
manage_presets
- Manage Presets
in group User
Name | Type | Description | Default |
---|---|---|---|
preset | String | Name of the preset to delete. | (REQUIRED) |
"success": true
User route to duplicate an existing preset.
manage_presets
- Manage Presets
in group User
Name | Type | Description | Default |
---|---|---|---|
preset | String | Name of the preset to duplicate. | (REQUIRED) |
"success": true
User route to get the current status of a given API key.
read_user_settings
- Read User Settings
in group User
Name | Type | Description | Default |
---|---|---|---|
keyType | String | The key type ID, eg 'stability_api'. | (REQUIRED) |
"status": "last updated 2025-01-01 01:01" // or "not set"
Get current waiting generation count, model loading count, etc.
fundamental_generate_tab_access
- Fundamental Generate Tab Access
in group User
Name | Type | Description | Default |
---|---|---|---|
do_debug | Boolean | If true, verbose log data about the status report gathering (internal usage). | False |
"status": {
"waiting_gens": 0,
"loading_models": 0,
"waiting_backends": 0,
"live_gens": 0
},
"backend_status": {
"status": "running", // "idle", "unknown", "disabled", "loading", "running", "some_loading", "errored", "all_disabled", "empty"
"class": "", // "error", "warn", "soft", ""
"message": "", // User-facing English text
"any_loading": false
},
"supported_features": ["feature_id1", "feature_id2"]
Get the details of a given language file.
fundamental_generate_tab_access
- Fundamental Generate Tab Access
in group User
Name | Type | Description | Default |
---|---|---|---|
language | String | The language ID, eg 'en'. | (REQUIRED) |
"language": {
"code": "en",
"name": "English",
"local_name": "English",
"keys": {
"key": "value"
}
}
User route to get the user's own base data.
fundamental_generate_tab_access
- Fundamental Generate Tab Access
in group User
None.
"user_name": "username",
"presets": [
{
"author": "username",
"title": "Preset Title",
"description": "Preset Description",
"param_map": {
"key": "value"
},
"preview_image": "data:base64 img"
}
],
"language": "en",
"permissions": ["permission1", "permission2"],
"starred_models": {
"LoRA": ["one", "two"]
},
"autocompletions": ["Word\nword\ntag\n3"]
Special route to create a new session ID. Must be called before any other API route. Also returns other fundamental user and server data.
(MISSING)
Name | Type | Description | Default |
---|---|---|---|
context | HttpContext | (PARAMETER DESCRIPTION NOT SET) | (REQUIRED) |
"session_id": "session_id",
"user_id": "username",
"output_append_user": true,
"version": "1.2.3",
"server_id": "abc123",
"permissions": ["permission1", "permission2"]
Gets the user's current settings.
read_user_settings
- Read User Settings
in group User
None.
"themes": {
"theme_id": {
"name": "Theme Name",
"is_dark": true,
"css_paths": ["path1", "path2"]
}
},
"settings": {
"setting_id": "value"
}
Websocket route for the initial installation from the UI.
install
- Install
in group Admin
Name | Type | Description | Default |
---|---|---|---|
theme | String | Selected user theme. | (REQUIRED) |
installed_for | String | Selected install_for (network mode choice) value. | (REQUIRED) |
backend | String | Selected backend (comfy/none). | (REQUIRED) |
models | String | Selected models to predownload. | (REQUIRED) |
install_amd | Boolean | If true, install with AMD GPU compatibility. | (REQUIRED) |
language | String | Selected user language. | (REQUIRED) |
// ... (do not automate calls to this)
Tell all waiting generations in this session or all sessions to interrupt.
basic_image_generation
- Basic Image Generation
in group User
Name | Type | Description | Default |
---|---|---|---|
other_sessions | Boolean | If true, generations from all this user's sessions will be closed (ie even from other web page tabs or API usages). If false, only the current session is interrupted. | False |
"success": true
Send a debug message to server logs.
server_debug_message
- Server Debug Message
in group Admin
Name | Type | Description | Default |
---|---|---|---|
message | String | The message to log. | (REQUIRED) |
"success": true
User route to set an API key.
edit_user_settings
- Edit User Settings
in group User
Name | Type | Description | Default |
---|---|---|---|
keyType | String | The key type ID, eg 'stability_api'. | (REQUIRED) |
key | String | The new value of the key, or 'none' to unset. | (REQUIRED) |
"success": true
UI internal helper for user customization of parameters.
edit_params
- Edit Params
in group User
Name | Type | Description | Default |
---|---|---|---|
rawData | JObject | Blob of parameter edit data. | (REQUIRED) |
"success": true
User route to update the user's starred models lists.
fundamental_model_access
- Fundamental Model Access
in group User
Name | Type | Description | Default |
---|---|---|---|
raw | JObject | Send the raw data as eg 'LoRA': ['one', 'two'], 'Stable-Diffusion': [ ... ] | (REQUIRED) |
"success": true