Skip to main content

Quickstart

This guide gets you from zero to your first successful API call in under 5 minutes.

Prerequisites

Before you begin, you'll need:

  • An API key from cmfy.cloud
  • A tool to make HTTP requests (cURL, Postman, or your language's HTTP library)

Step 1: Get Your API Key

  1. Log in to the cmfy.cloud portal
  2. Navigate to API Keys in the sidebar
  3. Click Create New Key
  4. Copy your key (it starts with sk_live_ or sk_test_)
Store Your Key Securely

Your API key is shown only once. Store it in a secure location like a password manager or environment variable. Never commit it to version control.

Step 2: Submit a Workflow

Here's a minimal text-to-image workflow:

curl -X POST https://api.cmfy.cloud/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": {
"1": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
}
},
"2": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "a beautiful sunset over mountains, digital art",
"clip": ["1", 1]
}
},
"3": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "blurry, low quality, watermark",
"clip": ["1", 1]
}
},
"4": {
"class_type": "EmptyLatentImage",
"inputs": {
"width": 1024,
"height": 1024,
"batch_size": 1
}
},
"5": {
"class_type": "KSampler",
"inputs": {
"seed": 42,
"steps": 25,
"cfg": 7.0,
"sampler_name": "euler_ancestral",
"scheduler": "normal",
"denoise": 1.0,
"model": ["1", 0],
"positive": ["2", 0],
"negative": ["3", 0],
"latent_image": ["4", 0]
}
},
"6": {
"class_type": "VAEDecode",
"inputs": {
"samples": ["5", 0],
"vae": ["1", 2]
}
},
"7": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "output",
"images": ["6", 0]
}
}
}
}'

Step 3: Understand the Response

A successful submission returns 202 Accepted:

{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued",
"queue_position": 3,
"estimated_wait_seconds": 45
}
FieldDescription
job_idUnique identifier for your job
statusCurrent state: queued, running, completed, or failed
queue_positionYour position in the queue
estimated_wait_secondsApproximate wait time

Step 4: Get Your Results

Option A: Poll for Status

Check the job status using the job ID:

curl https://api.cmfy.cloud/v1/jobs/YOUR_JOB_ID \
-H "Authorization: Bearer YOUR_API_KEY"

When complete:

{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"created_at": "2024-01-15T10:30:00Z",
"started_at": "2024-01-15T10:30:05Z",
"completed_at": "2024-01-15T10:30:20Z",
"execution_time_ms": 12450,
"outputs": {
"images": ["https://cdn.cmfy.cloud/outputs/image_0.png"]
}
}

Instead of polling, add a webhook_url to receive results automatically:

curl -X POST https://api.cmfy.cloud/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": { ... },
"webhook_url": "https://your-server.com/webhook"
}'

Your endpoint will receive a POST with the completed job data.

Common Errors

ErrorCauseSolution
401 UnauthorizedInvalid or missing API keyCheck your Authorization header
400 Bad RequestMalformed workflowValidate your JSON and node structure
429 Too Many RequestsRate limit exceededWait and retry, or upgrade your plan

What's Next?

You've submitted your first job! Here's what to explore next:

Was this page helpful?