ApiframeApiframe Docs
Getting Started

Quickstart

Generate your first image in under a minute.

This guide walks you through generating an image with the Apiframe API. The same pattern applies to video and music generation.

1. Get your API key

Sign up at console.apiframe.ai and create an API key from the dashboard.

2. Submit a generation request

curl -X POST https://api.apiframe.ai/v2/images/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a futuristic city skyline at sunset, cyberpunk style",
    "model": "midjourney"
  }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/images/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "a futuristic city skyline at sunset, cyberpunk style",
        "model": "midjourney",
    },
)
data = response.json()
print(data)  # {"jobId": "abc-123", "status": "QUEUED"}
const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "a futuristic city skyline at sunset, cyberpunk style",
    model: "midjourney",
  }),
});
const data = await response.json();
console.log(data); // {jobId: "abc-123", status: "QUEUED"}
body := `{"prompt":"a futuristic city skyline at sunset, cyberpunk style","model":"midjourney"}`
req, _ := http.NewRequest("POST", "https://api.apiframe.ai/v2/images/generate",
    strings.NewReader(body))
req.Header.Set("X-API-Key", "afk_your_api_key_here")
req.Header.Set("Content-Type", "application/json")

resp, err := http.DefaultClient.Do(req)

The response returns immediately with a job ID:

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "QUEUED"
}

3. Poll for the result

Use the job ID to check the status:

curl -H "X-API-Key: afk_your_api_key_here" \
  https://api.apiframe.ai/v2/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890

While processing:

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "PROCESSING",
  "progress": 45,
  "model": "midjourney"
}

When complete:

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "COMPLETED",
  "progress": 100,
  "model": "midjourney",
  "result": "https://cdn.apiframe.ai/results/a1b2c3d4.png",
  "creditCost": 10,
  "createdAt": "2026-03-15T10:00:00.000Z",
  "completedAt": "2026-03-15T10:00:32.000Z"
}

4. Alternative: use webhooks

Instead of polling, you can receive a webhook when the job completes:

{
  "prompt": "a futuristic city skyline at sunset",
  "model": "midjourney",
  "webhookUrl": "https://your-server.com/webhook",
  "webhookEvents": ["completed", "failed"]
}

See the Webhooks guide for details.

Job status flow

Jobs progress through these states:

QUEUED → PROCESSING → COMPLETED
                    → FAILED
StatusMeaning
QUEUEDJob is waiting to be picked up by a worker
PROCESSINGJob is actively being processed (check progress for %)
COMPLETEDResult is ready — check the result field for the CDN URL
FAILEDSomething went wrong — check the error field

On this page