# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. basePath: /api/v1 definitions: api.ErrorResponse: properties: details: example: Optional additional error details type: string error: example: A human-readable error message type: string type: object api.QueuePromptRequest: properties: prompt: additionalProperties: true type: object required: - prompt type: object comfyui.PromptResponse: properties: node_errors: additionalProperties: true description: Use omitempty if it can be absent type: object number: type: integer prompt_id: type: string type: object comfyui.UploadImageResponse: properties: name: type: string subfolder: type: string type: type: string type: object externalDocs: description: OpenAPI url: https://swagger.io/resources/open-api/ host: localhost:8080 info: contact: email: support@swagger.io name: API Support url: http://www.swagger.io/support description: Exposes ComfyUI client functions as a RESTful API secured by Google OAuth. license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html termsOfService: http://swagger.io/terms/ title: ComfyUI API Service via Gin version: "1.0" paths: /history/{prompt_id}: get: description: Retrieves the execution history and outputs for a specific prompt ID. parameters: - description: The ID of the prompt example: '"a1b2c3d4-e5f6-7890-1234-567890abcdef"' format: uuid in: path name: prompt_id required: true type: string produces: - application/json responses: "200": description: Prompt history details schema: additionalProperties: true type: object "400": description: Bad Request (e.g., missing prompt_id) schema: $ref: '#/definitions/api.ErrorResponse' "401": description: Unauthorized (Invalid or missing Bearer token) schema: $ref: '#/definitions/api.ErrorResponse' "404": description: Not Found (Prompt ID not found in ComfyUI) schema: $ref: '#/definitions/api.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/api.ErrorResponse' security: - BearerAuth: [] summary: Get prompt history tags: - ComfyUI /image: get: description: Downloads a specific image generated by ComfyUI. parameters: - description: Filename of the image example: '"ComfyUI_00001_.png"' in: query name: filename required: true type: string - description: Subfolder containing the image (if any) example: '"output"' in: query name: subfolder type: string - description: Type of image (e.g., 'output', 'input', 'temp') enum: - output - input - temp example: '"output"' in: query name: type required: true type: string produces: - image/png - image/jpeg - image/webp - application/octet-stream responses: "200": description: The requested image file schema: type: file "400": description: Bad Request (Missing required query parameters) schema: $ref: '#/definitions/api.ErrorResponse' "401": description: Unauthorized schema: $ref: '#/definitions/api.ErrorResponse' "404": description: Not Found (Image not found on ComfyUI server) schema: $ref: '#/definitions/api.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/api.ErrorResponse' security: - BearerAuth: [] summary: Get generated image tags: - ComfyUI /queue_prompt: post: consumes: - application/json description: 'Sends a workflow prompt to the ComfyUI backend for processing. The prompt field is a map where keys are node IDs (strings) and values are objects defining the node''s class_type and inputs. Example: `{"3": {"class_type": "KSampler", "inputs": {"seed": 123}}}`' parameters: - description: The prompt workflow JSON and client ID in: body name: prompt required: true schema: $ref: '#/definitions/api.QueuePromptRequest' produces: - application/json responses: "200": description: Successfully queued prompt schema: $ref: '#/definitions/comfyui.PromptResponse' "400": description: Bad Request (e.g., invalid JSON) schema: $ref: '#/definitions/api.ErrorResponse' "401": description: Unauthorized (Invalid or missing Bearer token) schema: $ref: '#/definitions/api.ErrorResponse' "500": description: Internal Server Error (e.g., ComfyUI unreachable) schema: $ref: '#/definitions/api.ErrorResponse' security: - BearerAuth: [] summary: Queue a generation prompt tags: - ComfyUI /upload_image: post: consumes: - multipart/form-data description: Uploads an image file to the ComfyUI input directory. parameters: - description: Image file to upload in: formData name: image required: true type: file - description: Type of upload (usually 'input') enum: - input - temp example: '"input"' in: formData name: type required: true type: string - description: 'Overwrite existing file (default: false)' example: false in: formData name: overwrite type: boolean produces: - application/json responses: "200": description: Image uploaded successfully schema: $ref: '#/definitions/comfyui.UploadImageResponse' "400": description: Bad Request (e.g., missing file or type) schema: $ref: '#/definitions/api.ErrorResponse' "401": description: Unauthorized schema: $ref: '#/definitions/api.ErrorResponse' "500": description: Internal Server Error (e.g., upload failed) schema: $ref: '#/definitions/api.ErrorResponse' security: - BearerAuth: [] summary: Upload an image tags: - ComfyUI securityDefinitions: BearerAuth: description: 'Type "Bearer" followed by a space and a valid Google OAuth access token. Example: "Bearer y29..."' in: header name: Authorization type: apiKey swagger: "2.0"