Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5353c5c
Add Cloud API documentation with examples and OpenAPI spec
huntcsg Dec 31, 2025
0d9dbfc
Add Chinese translations for Cloud API documentation
huntcsg Jan 1, 2026
dfcfb7a
Address review feedback
huntcsg Jan 1, 2026
bdb505c
Remove broken /api-reference/cloud links
huntcsg Jan 1, 2026
b808ccc
Revert "Remove broken /api-reference/cloud links"
huntcsg Jan 1, 2026
41d56af
Add Cloud API reference overview page to fix broken links
huntcsg Jan 1, 2026
52e0fc2
Add Chinese translation for api-reference/cloud/overview.mdx
huntcsg Jan 1, 2026
277d700
Add Cloud API Reference tab to Chinese navigation
huntcsg Jan 1, 2026
e8c3370
Add Cloud API sidebar group to Chinese development navigation
huntcsg Jan 1, 2026
21529da
fix: align zh-CN navigation with English version
huntcsg Jan 2, 2026
a03e3d9
docs: add extra_data documentation for Partner Nodes API key
huntcsg Jan 5, 2026
66bdf52
docs: fix API key info - same key for Cloud API and Partner Nodes
huntcsg Jan 5, 2026
52a61a5
docs: use same API_KEY env var for Partner Nodes examples
huntcsg Jan 5, 2026
e4b99e5
docs: clarify /api/view returns temporary signed URL redirect
huntcsg Jan 6, 2026
f63a014
docs: add utm_campaign=cloud-api to pricing links
huntcsg Jan 6, 2026
9410053
docs: fix Python f-string syntax in object_info example
huntcsg Jan 6, 2026
250f47b
docs: fix download outputs examples to handle 302 redirect
huntcsg Jan 6, 2026
9c151c1
docs: fix job status endpoint and polling logic
huntcsg Jan 6, 2026
681fa07
docs: document two job status endpoints and their different status va…
huntcsg Jan 6, 2026
cee0d07
docs: add recommendations for cloud team re: API discrepancies
huntcsg Jan 6, 2026
8232a12
Remove untested from-hash API, fix download redirect handling
huntcsg Jan 6, 2026
a2796f5
Add notification message type to WebSocket docs
huntcsg Jan 6, 2026
2f17f6f
refactor: simplify save_outputs to loop over output types
huntcsg Jan 6, 2026
62b346e
docs: use /api/job/{id}/status for polling, check for success status
huntcsg Jan 6, 2026
12b13ea
docs: separate HTTP errors from WebSocket execution errors
huntcsg Jan 6, 2026
a30c063
docs: note that clientId is currently ignored but recommended for for…
huntcsg Jan 6, 2026
1323f0c
docs: note that some endpoints have different semantics for local com…
huntcsg Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions CLOUD_API_RECOMMENDATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Cloud API Recommendations

This document summarizes issues discovered during API documentation testing that should be addressed in the cloud repo.

## 1. OpenAPI Spec: JobStatusResponse Status Enum Mismatch

**Location:** `cloud/services/ingest/openapi.yaml` line 3393-3396

**Issue:** The `JobStatusResponse` schema defines status enum as:
```yaml
enum: [waiting_to_dispatch, pending, in_progress, completed, error, cancelled]
```

But the actual `GetJobStatus` implementation (line 369 in `job.go`) directly casts the internal state:
```go
Status: ingest.JobStatusResponseStatus(jobEntity.Status)
```

This means the API returns raw internal states like `success`, `queued_limited`, `executing`, etc. — none of which are in the OpenAPI enum.

**Recommendation:** Either:
1. Update OpenAPI to list all actual internal states returned, OR
2. Transform the status in `GetJobStatus` using `toFilterStatus()` like `GetJobDetail` does

The latter would make both endpoints consistent, but would be a breaking change for any clients relying on the current behavior.

---

## 2. Different Status Values Between Endpoints

| Endpoint | Status for successful job | Includes outputs? |
|----------|---------------------------|-------------------|
| `GET /api/jobs/{id}` | `completed` | ✅ Yes |
| `GET /api/job/{id}/status` | `success` | ❌ No |

**Current behavior:**
- `/api/jobs/{id}` uses `toFilterStatus()` which maps `StateSuccess` → `completed`
- `/api/job/{id}/status` returns raw `jobEntity.Status` directly

The API docs use `/api/job/{id}/status` for polling (lighter weight) and check for `success` status.

---

## 3. Internal State Mapping Reference

For documentation purposes, here's how internal states map to user-friendly statuses:

### Pending States → `pending`
- `submitted`
- `queued_limited`
- `queued_waiting`
- `allocated`
- `preparing`
- `pending_execution`

### In Progress States → `in_progress`
- `executing`
- `executed`

### Success State → `completed`
- `success`

### Failed States → `failed`
- `error`
- `non_retryable_error`
- `erroring`
- `lost`

### Cancelled States → `cancelled`
- `cancelled`
- `cancel_requested`
- `cancel_pending`
- `cancelling_preparing`

---

## 4. Suggested OpenAPI Fix

If choosing to document actual behavior (option 1), update `JobStatusResponse.status` enum to:

```yaml
status:
type: string
enum:
# Pending states
- submitted
- queued_limited
- queued_waiting
- allocated
- preparing
- pending_execution
# In progress states
- executing
- executed
# Terminal states
- success
- error
- non_retryable_error
- erroring
- lost
- cancelled
- cancel_requested
- cancel_pending
- cancelling_preparing
description: |
Raw internal job state. For user-friendly status values, use GET /api/jobs/{id} instead
which returns: pending, in_progress, completed, failed, cancelled.
```

---

## 5. Related Files

- `cloud/services/ingest/openapi.yaml` - OpenAPI spec
- `cloud/services/ingest/server/implementation/job.go` - GetJobStatus, GetJobDetail implementations
- `cloud/common/jobstate/state.go` - State definitions and groupings
31 changes: 31 additions & 0 deletions api-reference/cloud/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "Cloud API Overview"
---

<Warning>
**Experimental API:** This API is experimental and subject to change. Endpoints, request/response formats, and behavior may be modified without notice.
</Warning>

The Comfy Cloud API provides programmatic access to run workflows on Comfy Cloud infrastructure.

<Note>
**Subscription Required:** Running workflows via the API requires an active Comfy Cloud subscription. See [pricing plans](https://www.comfy.org/cloud/pricing?utm_source=docs) for details.
</Note>

## Getting Started

- [Cloud API Overview](/development/cloud/overview) - Introduction, authentication, and quick start guide
- [API Reference](/development/cloud/api-reference) - Complete endpoint documentation with code examples
- [OpenAPI Specification](/development/cloud/openapi) - Machine-readable API specification

## Endpoint Categories

| Category | Description |
|----------|-------------|
| Workflow | Submit workflows for execution |
| Job | Monitor job status and manage the queue |
| Asset | Upload and download files |
| Model | Browse available AI models |
| Node | Get information about available nodes |
| User | Account information and personal data |
| System | Server status and health checks |
Loading