--- id: routes---comfyui title: "Routes - ComfyUI" category: "10_Wiki/Topics" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: [] duplicate_of: "" source_trust_level: "B" confidence_score: 1.0 created_at: 2026-05-20 updated_at: 2026-05-20 review_reason: "" merge_history: [] tags: ["web", "wikify"] raw_sources: ["https://docs.comfy.org/development/comfyui-server/comms_routes"] applied_in: [] github_commit: "" --- # [[Routes - ComfyUI]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) [[ComfyUI]] μ„œλ²„μ˜ [[Routes]]λŠ” ν΄λΌμ΄μ–ΈνŠΈμ™€ μ„œλ²„ κ°„μ˜ 데이터 κ΅ν™˜, μž‘μ—… 큐 관리, μ‹€μ‹œκ°„ μƒνƒœ μ—…λ°μ΄νŠΈλ₯Ό μœ„ν•œ HTTP λ©”μ„œλ“œ 및 [[WebSocket]] μ—”λ“œν¬μΈνŠΈμ˜ 집합체이닀. ## 🧠 핡심 κ°œλ… (Core concepts) - **Core API Routes**: μ„œλ²„μ˜ κΈ°λŠ₯을 μˆ˜ν–‰ν•˜κΈ° μœ„ν•΄ μ •μ˜λœ λ‹€μ–‘ν•œ [[GET]], [[POST]] λ©”μ„œλ“œλ“€μ˜ λͺ¨μŒμœΌλ‘œ, λͺ¨λΈ 관리, 이미지 μ—…λ‘œλ“œ, μ‹œμŠ€ν…œ 정보 쑰회 등을 ν¬ν•¨ν•œλ‹€. - **WebSocket Communication**: ν΄λΌμ΄μ–ΈνŠΈμ™€ μ„œλ²„ κ°„μ˜ μ–‘λ°©ν–₯ 싀동기화λ₯Ό μ§€μ›ν•˜λ©°, μ‹€ν–‰ μ§„ν–‰ 상황 및 λ…Έλ“œ μƒνƒœλ₯Ό μ‹€μ‹œκ°„μœΌλ‘œ μ „λ‹¬ν•˜λŠ” ν†΅λ‘œμ΄λ‹€. - **Custom Routes**: κ°œλ°œμžκ°€ [[aiohttp]] ν”„λ ˆμž„μ›Œν¬λ₯Ό μ‚¬μš©ν•˜μ—¬ μ„œλ²„μ— μƒˆλ‘œμš΄ 경둜λ₯Ό μΆ”κ°€ν•˜κ³  ν΄λΌμ΄μ–ΈνŠΈμ™€μ˜ λ©”μ‹œμ§€ μ†‘μˆ˜μ‹  κΈ°λŠ₯을 ν™•μž₯ν•  수 μžˆλŠ” λ©”μ»€λ‹ˆμ¦˜μ΄λ‹€. - **Execution Queue Management**: [[prompt]] 제좜, 큐 μƒνƒœ 쑰회, μ‹€ν–‰ 쀑단 및 νžˆμŠ€ν† λ¦¬ 관리 λ“± μž‘μ—… νλ¦„μ˜ μ œμ–΄λ₯Ό λ‹΄λ‹Ήν•œλ‹€. ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Request/Response Pattern**: νŠΉμ • 경둜(예: `/prompt`)둜 데이터λ₯Ό μ œμΆœν•˜λ©΄ μ„œλ²„κ°€ 검증 ν›„ μ‹€ν–‰ 큐에 μΆ”κ°€ν•˜κ³  κ²°κ³Όλ₯Ό λ°˜ν™˜ν•˜λŠ” ꡬ쑰λ₯Ό κ°€μ§„λ‹€. - **Real-time Update Pattern**: [[WebSocket]]을 톡해 `status`, `progress`, `executed` λ“± λ‹€μ–‘ν•œ νƒ€μž…μ˜ JSON λ©”μ‹œμ§€λ₯Ό ν΄λΌμ΄μ–ΈνŠΈμ— λΈŒλ¦¬μΊμŠ€νŒ…ν•œλ‹€. - **Extensibility Pattern**: `@routes.post`와 같은 λ°μ½”λ ˆμ΄ν„°λ₯Ό ν™œμš©ν•˜μ—¬ κΈ°μ‘΄ μ„œλ²„ ꡬ쑰λ₯Ό λ³€κ²½ν•˜μ§€ μ•Šκ³  μƒˆλ‘œμš΄ κΈ°λŠ₯을 μΆ”κ°€ν•  수 μžˆλŠ” ν™•μž₯성을 μ œκ³΅ν•œλ‹€. ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) ### 1. Core API Routes (Built-in routes) [[server.py]]에 μ •μ˜λœ μ£Όμš” κ²½λ‘œλ“€μ˜ κΈ°λŠ₯은 λ‹€μŒκ³Ό κ°™λ‹€. | path | method | purpose | | :--- | :--- | :--- | | `/` | get | load the comfy webpage | | `/ws` | websocket | WebSocket endpoint for real-time communication with the server | | `/embeddings` | get | retrieve a list of the names of embeddings available | | `/extensions` | get | retrieve a list of the extensions registering a WEB_DIRECTORY | | `/features` | get | retrieve server features and capabilities | | `/models` | get | retrieve a list of available model types | | `/models/{folder}` | get | retrieve models in a specific folder | | `/workflow_templates` | get | retrieve a map of custom node modules and associated template workflows | | `/upload/image` | post | upload an image | | `/upload/mask` | post | upload a mask | | `/view` | get | view an image (includes various options) | | `/view_metadata/` | get | retrieve metadata for a model | | `/system_stats` | get | retrieve information about the system (python version, devices, vram etc) | | `/prompt` | get | retrieve current queue status and execution information | | `/prompt` | post | submit a prompt to the queue | | `/object_info` | get | retrieve details of all node types | | `/object_info/{node_class}` | get | retrieve details of one node type | | `/history` | get | retrieve the queue history | | `/history/{prompt_id}` | get | retrieve the queue history for a specific prompt | | `/history` | post | clear history or delete history item | | `/queue` | get | retrieve the current state of the execution queue | | `/queue` | post | manage queue operations (clear pending/running) | | `/interrupt` | post | stop the current workflow execution | | `/free` | post | free memory by unloading specified models | | `/userdata` | get | list user data files in a specified directory | | `/v2/userdata` | get | enhanced version that lists files and directories in structured format | | `/userdata/{file}` | get | retrieve a specific user data file | | `/userdata/{file}` | post | upload or update a user data file | | `/userdata/{file}` | delete | delete a specific user data file | | `/userdata/{file}/move/{dest}` | post | move or rename a user data file | | `/users` | get | get user information | | `/users` | post | create a new user (multi-user mode only) | ### 2. WebSocket Communication [[WebSocket]] μ—”λ“œν¬μΈνŠΈμΈ `/ws`λŠ” μ‹€μ‹œκ°„ μ–‘λ°©ν–₯ 톡신을 μœ„ν•΄ μ‚¬μš©λ˜λ©°, λ‹€μŒκ³Ό 같은 정보λ₯Ό μ „λ‹¬ν•œλ‹€. - **μ£Όμš” μš©λ„**: μ‹€ν–‰ μ§„ν–‰ 상황 μ—…λ°μ΄νŠΈ μˆ˜μ‹ , λ…Έλ“œ μ‹€ν–‰ μƒνƒœ μ‹€μ‹œκ°„ 확인, μ—λŸ¬ λ©”μ‹œμ§€ 및 디버깅 정보 μˆ˜μ‹ , 큐 μƒνƒœ λ³€κ²½ μ‹œ 라이브 μ—…λ°μ΄νŠΈ. - **JSON λ©”μ‹œμ§€ νƒ€μž…**: - `status`: 전체 μ‹œμŠ€ν…œ μƒνƒœ μ—…λ°μ΄νŠΈ - `execution_start`: ν”„λ‘¬ν”„νŠΈ μ‹€ν–‰ μ‹œμž‘ μ‹œμ  - `execution_cached`: μΊμ‹œλœ κ²°κ³Ό μ‚¬μš© μ‹œ - `executing`: λ…Έλ“œ μ‹€ν–‰ 쀑 μ—…λ°μ΄νŠΈ - `progress`: μž₯κΈ° μ‹€ν–‰ μž‘μ—…μ˜ μ§„ν–‰λ₯  μ—…λ°μ΄νŠΈ - `executed`: λ…Έλ“œ μ‹€ν–‰ μ™„λ£Œ μ‹œ ### 3. Custom Routes Implementation ν΄λΌμ΄μ–ΈνŠΈμ—μ„œ μ„œλ²„λ‘œ λ©”μ‹œμ§€λ₯Ό 보내기 μœ„ν•΄ μƒˆλ‘œμš΄ 경둜λ₯Ό μ •μ˜ν•˜λŠ” 방법이닀. - **μ„œλ²„ μΈ‘ κ΅¬ν˜„**: `aiohttp` ν”„λ ˆμž„μ›Œν¬λ₯Ό ν™œμš©ν•˜λ©°, `@routes.post('/path')` λ°μ½”λ ˆμ΄ν„°λ₯Ό μ‚¬μš©ν•œλ‹€. ν•¨μˆ˜ λ‚΄λΆ€μ—μ„œλŠ” `request.post()`λ₯Ό 톡해 데이터λ₯Ό μˆ˜μ‹ ν•  수 μžˆλ‹€. - **ν΄λΌμ΄μ–ΈνŠΈ μΈ‘ 호좜**: `FormData` 객체λ₯Ό μ‚¬μš©ν•˜μ—¬ `api.fetchApi`λ₯Ό 톡해 μƒˆλ‘œμš΄ κ²½λ‘œμ— μš”μ²­μ„ 보낼 수 μžˆλ‹€. ## βš–οΈ λͺ¨μ˜ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) λ³Έλ¬Έ λ‚΄μ—μ„œ μƒμΆ©λ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. ## πŸ› οΈ 적용 사둀 (Applied in summary) - **Custom Node 개발**: μ„œλ²„μ˜ κΈ°λŠ₯을 ν™•μž₯ν•˜κΈ° μœ„ν•΄ `@routes.post`λ₯Ό μ‚¬μš©ν•˜μ—¬ μƒˆλ‘œμš΄ 경둜λ₯Ό μƒμ„±ν•˜κ³ , `FormData`λ₯Ό 톡해 데이터λ₯Ό μ „μ†‘ν•˜λŠ” μ˜ˆμ‹œκ°€ μ œμ‹œλ¨. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (Primary Source β€” μ›Ήμ‚¬μ΄νŠΈ λ³Έλ¬Έ 직접 μΆ”μΆœ) - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— κ΄€λ ¨ λ¬Έμ„œ 링크 (Related document links) - [[ComfyUI Server]]: μ„œλ²„μ˜ μ „λ°˜μ μΈ ꡬ쑰와 역할을 μ΄ν•΄ν•˜κΈ° μœ„ν•œ 핡심 κ°œλ…μž…λ‹ˆλ‹€. - [[WebSocket]]: μ‹€μ‹œκ°„ 데이터 슀트리밍 및 μ–‘λ°©ν–₯ ν†΅μ‹ μ˜ 기술적 κΈ°λ°˜μž…λ‹ˆλ‹€. - [[aiohttp]]: μ»€μŠ€ν…€ 라우트λ₯Ό κ΅¬ν˜„ν•  λ•Œ μ‚¬μš©ν•˜λŠ” ν”„λ ˆμž„μ›Œν¬μž…λ‹ˆλ‹€. - [[PromptExecutor]]: μ‹€ν–‰ 큐λ₯Ό μ •μ˜ν•˜κ³  κ΄€λ¦¬ν•˜λŠ” ν΄λž˜μŠ€μž…λ‹ˆλ‹€. ## πŸ“ λ³€κ²½ 이ε±₯ζ­΄ (Change history) - 2026-05-20: Astra /wikify 둜 https://docs.comfy.org/development/comfyui-server/comms_routes λ³Έλ¬Έμ—μ„œ μ΄ˆμ•ˆ 생성.