> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowscale.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Comprehensive overview of the FlowScale's ComfyUI API

# FlowScale AI API Reference

**You've deployed ComfyUI workflows as production APIs—now harness their full power.** This comprehensive reference shows you how to integrate FlowScale AI's enterprise-grade infrastructure into your applications, automation systems, and business processes.

**Why this API matters for your business:** Instead of managing local ComfyUI installations, dependency conflicts, and scaling challenges, you now have access to production-ready AI infrastructure that scales from prototype to enterprise workloads seamlessly.

## From Creative Workflow to Business Infrastructure

**The FlowScale AI API transforms your ComfyUI workflows into scalable business infrastructure.** What started as creative experiments in ComfyUI now becomes reliable, governed services that can power applications, automate business processes, and serve customers at global scale.

**This isn't just another API—it's your AI workflows as enterprise infrastructure:** Programmatically trigger complex AI processes, monitor their execution in real-time, and integrate sophisticated AI capabilities into any application or automation system without managing the underlying complexity.

## Key Features

* **Health Monitoring:** Continuously check the status of all ComfyUI instances to ensure optimal performance and uptime.
* **Queue Management:** Retrieve and manage queue data for running and pending tasks across ComfyUI instances.
* **Workflow Execution:** Execute complex workflows with dynamic form data, including support for file uploads and text inputs.
* **Run Tracking:** Monitor the status and details of each workflow execution, ensuring transparency and traceability.
* **Output Retrieval:** Access the results of your workflows, whether they are images, videos, audio files, or text data, with secure download links.
* **Scalable Architecture:** Automatically balances load across available ComfyUI instances based on real-time queue sizes.
* **Secure Access:** Implements robust API key authentication to safeguard your workflows and data.

## Security and Authentication

Security is paramount in the FlowScale's ComfyUI API. All endpoints are protected using **API Key Authentication**, ensuring that only authorized users can access and interact with the API. The API key must be included in the request headers as follows:

* **Header Name:** `X-API-KEY`
* **Header Value:** Your unique API key (string)

### Authentication Flow

1. **API Key Validation:** Each request must include a valid API key. The API validates this key and then allows access to the relevant data on successful authentication.
2. **Access Control:** If the API key is missing, invalid, or does not match the expected value, the API will respond with appropriate error messages (`401 Unauthorized` or `403 Forbidden`).

## From Deployment to Integration

**Ready to integrate your deployed workflows into real applications?** This API reference assumes you've already completed the deployment process and are ready to build production integrations.

### Prerequisites for Success

<Note>
  **New to FlowScale AI?** Complete the [Getting Started guides](/getting-started/introduction) first to deploy your workflows, then return here to learn integration patterns.
</Note>

To successfully integrate FlowScale AI APIs:

* **Deployed Workflow:** Your ComfyUI workflow must be successfully deployed via the FlowScale AI platform
* **API Authentication:** Secure your API key from your project's deployment dashboard
* **Production Mindset:** Understanding of how your workflow integrations will handle errors, scaling, and user demands

## Comprehensive API Capabilities

The FlowScale's ComfyUI API encompasses a wide range of functionalities to cater to diverse workflow management needs:

### 1. **Homepage**

* **Endpoint:** `/`
* **Method:** `GET`
* **Description:**\
  Serves a welcoming HTML page that provides a brief overview of the FlowScale APIs and a link to the interactive API documentation.

### 2. **ComfyUI Health Check**

* **Endpoint:** `/api/v1/comfy/health`
* **Method:** `GET`
* **Description:**\
  Monitors the health status of all ComfyUI instances within the cluster, indicating whether each instance is running or stopped.

### 3. **ComfyUI Queue Data**

* **Endpoint:** `/api/v1/comfy/queue`
* **Method:** `GET`
* **Description:**\
  Retrieves detailed queue information for each ComfyUI instance, including running and pending tasks, to facilitate effective load management.

### 4. **Execute Workflow**

* **Endpoint:** `/api/v1/runs`
* **Method:** `POST`
* **Description:**\
  Executes a specified workflow by processing dynamic form data, which may include text inputs and file uploads. The workflow is dispatched to an available ComfyUI instance based on current queue sizes.

### 5. **Get Run Output**

* **Endpoint:** `/api/v1/runs/output`
* **Method:** `GET`
* **Description:**\
  Fetches the output of a specific run by filename, providing a secure download URL if the output is available.

### 6. **Get Run Details**

* **Endpoint:** `/api/v1/runs/{run_id}`
* **Method:** `GET`
* **Description:**\
  Retrieves comprehensive details about a specific run using its unique run ID, excluding sensitive internal information.

### 7. **List Runs by Group ID**

* **Endpoint:** `/api/v1/runs`
* **Method:** `GET`
* **Description:**\
  Lists all runs associated with a particular group ID, enabling aggregation and management of related runs.

## Robust Error Handling and Logging

Ensuring reliability and ease of troubleshooting, the FlowScale's ComfyUI API incorporates comprehensive error handling and logging mechanisms:

* **Error Responses:**\
  The API returns meaningful HTTP status codes and error messages for various failure scenarios, including authentication issues, missing resources, and internal server errors.

## Scalability and Load Balancing

The FlowScale's ComfyUI API is designed to scale effortlessly with your application's demands:

* **Dynamic ComfyUI Selection:**\
  Implements intelligent selection of ComfyUI instances based on real-time queue sizes, ensuring optimal resource utilization and preventing overloading of any single instance.

* **Asynchronous Operations:**\
  Utilizes asynchronous capabilities to handle multiple requests concurrently, enhancing performance and responsiveness.

## Your AI Workflows as Business Infrastructure

**You now have access to enterprise-grade AI infrastructure that scales with your ambitions.** The FlowScale AI API transforms your creative ComfyUI work into reliable, governed services that can power everything from simple automations to complex enterprise applications.

**This is what you've built:** Production-ready AI infrastructure with automatic scaling, comprehensive monitoring, and enterprise-grade reliability. Your workflows aren't just tools anymore—they're business assets that can serve users, power applications, and drive innovation across your organization.

### Ready to Build?

<CardGroup cols={2}>
  <Card title="Start with SDKs" icon="code" href="/deploy-api/sdk/sdk-js">
    Get building quickly with our JavaScript/TypeScript and Python SDKs
  </Card>
</CardGroup>

***

*Your ComfyUI workflows are now production infrastructure. Build something amazing.* 🚀

***
