Skip to main content

Documentation Index

Fetch the complete documentation index at: https://dripart-docs-recommend-jobs-api.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Routes

The server defines a series of get and post methods which can be found by searching for @routes in server.py. When you submit a workflow in the web client, it is posted to /prompt which validates the prompt and adds it to an execution queue, returning either a prompt_id and number (the position in the queue), or error and node_errors if validation fails. The prompt queue is defined in execution.py, which also defines the PromptExecutor class.

Built in routes

server.py defines the following routes:

Core API Routes

pathget/post/wspurpose
/getload the comfy webpage
/wswebsocketWebSocket endpoint for real-time communication with the server
/embeddingsgetretrieve a list of the names of embeddings available
/extensionsgetretrieve a list of the extensions registering a WEB_DIRECTORY
/featuresgetretrieve server features and capabilities
/modelsgetretrieve a list of available model types
/models/{folder}getretrieve models in a specific folder
/workflow_templatesgetretrieve a map of custom node modules and associated template workflows
/upload/imagepostupload an image
/upload/maskpostupload a mask
/viewgetview an image. Lots of options, see @routes.get("/view") in server.py
/view_metadata/getretrieve metadata for a model
/system_statsgetretrieve information about the system (python version, devices, vram etc)
/promptgetretrieve current queue status and execution information
/promptpostsubmit a prompt to the queue
/object_infogetretrieve details of all node types
/object_info/{node_class}getretrieve details of one node type
/jobsgetlist jobs with filtering, sorting, and pagination (recommended)
/jobs/{job_id}getget full details for a specific job (recommended)
/historygetretrieve the queue history (legacy)
/history/{prompt_id}getretrieve the queue history for a specific prompt (legacy)
/historypostclear history or delete history item
/queuegetretrieve the current state of the execution queue (legacy)
/queuepostmanage queue operations (clear pending/running)
/interruptpoststop the current workflow execution
/freepostfree memory by unloading specified models
/userdatagetlist user data files in a specified directory
/v2/userdatagetenhanced version that lists files and directories in structured format
/userdata/{file}getretrieve a specific user data file
/userdata/{file}postupload or update a user data file
/userdata/{file}deletedelete a specific user data file
/userdata/{file}/move/{dest}postmove or rename a user data file
/usersgetget user information
/userspostcreate a new user (multi-user mode only)

Jobs API

The Jobs API (/jobs) provides a unified interface for listing and retrieving job information with filtering, sorting, and pagination. It is the recommended way to query job status and history.

List Jobs

GET /jobs returns a paginated list of jobs with optional filtering:
ParameterTypeDescription
statusstringFilter by status (comma-separated): pending, in_progress, completed, failed, cancelled
workflow_idstringFilter by workflow ID
sort_bystringSort field: created_at (default), execution_duration
sort_orderstringSort direction: asc, desc (default)
limitintegerMaximum items to return
offsetintegerItems to skip (default: 0)
Response:
{
  "jobs": [
    {
      "id": "prompt-uuid",
      "status": "completed",
      "create_time": 1706540000,
      "workflow_id": "workflow-uuid",
      "outputs_count": 2,
      "preview_output": {"filename": "output.png", "type": "output"},
      "execution_start_time": 1706540001000,
      "execution_end_time": 1706540005000
    }
  ],
  "pagination": {
    "offset": 0,
    "limit": 100,
    "total": 42,
    "has_more": false
  }
}

Get Job Details

GET /jobs/{job_id} returns full details for a specific job including outputs and workflow:
{
  "id": "prompt-uuid",
  "status": "completed",
  "create_time": 1706540000,
  "outputs": {
    "9": {"images": [{"filename": "output.png", "type": "output"}]}
  },
  "workflow": {
    "prompt": {...},
    "extra_data": {...}
  },
  "execution_status": {...}
}
The Jobs API consolidates data from the queue and history into a single unified format. Use /jobs instead of separately querying /queue and /history endpoints.

WebSocket Communication

The /ws endpoint provides real-time bidirectional communication between the client and server. This is used for:
  • Receiving execution progress updates
  • Getting node execution status in real-time
  • Receiving error messages and debugging information
  • Live updates when queue status changes
The WebSocket connection sends JSON messages with different types such as:
  • status - Overall system status updates
  • execution_start - When a prompt execution begins
  • execution_cached - When cached results are used
  • executing - Updates during node execution
  • progress - Progress updates for long-running operations
  • executed - When a node completes execution

Custom routes

If you want to send a message from the client to the server during execution, you will need to add a custom route to the server. For anything complicated, you will need to dive into the aiohttp framework docs, but most cases can be handled as follows:
from server import PromptServer
from aiohttp import web
routes = PromptServer.instance.routes
@routes.post('/my_new_path')
async def my_function(request):
    the_data = await request.post()
    # the_data now holds a dictionary of the values sent
    MyClass.handle_my_message(the_data)
    return web.json_response({})
Unless you know what you are doing, don’t try to define my_function within a class. The @routes.post decorator does a lot of work! Instead, define the function as above and then call a classmethod.
You can also define a @routes.get if you aren’t changing anything.
The client can use this new route by sending a FormData object with code something like this, which would result in the_data, in the above code, containing message and node_id keys:
import { api } from "../../scripts/api.js";
function send_message(node_id, message) {
    const body = new FormData();
    body.append('message',message);
    body.append('node_id', node_id);
    api.fetchApi("/my_new_path", { method: "POST", body, });
}