API Documentation

Complete reference for the APIFrame image generation API.

Introduction

The APIFrame API provides programmatic access to AI-powered image generation, description, upscaling, and blending capabilities. All API endpoints are RESTful and return JSON responses.

Base URL: Configured via your environment. The default is http://localhost:4100.

All endpoints under /v1/ require API key authentication via the X-API-Key header.

Authentication

To authenticate, include your API key in the X-API-Key request header. You can obtain an API key by signing up at /signup or from the console dashboard after logging in.

API keys follow the format ak_live_xxxxx. Keep your API key secret and never expose it in client-side code.

# Include in every request
curl -H "X-API-Key: ak_live_xxxxx" \
  https://api.example.com/v1/account

Endpoints

POST/v1/imagine

Generate an image from a text prompt. Returns a job object that can be polled for status. Costs 16 credits per request.

Request Body

ParameterTypeRequiredDescription
promptstringYesThe text prompt to generate an image from.
aspectRatiostringNoAspect ratio. One of: 1:1, 16:9, 9:16, 4:3, 3:4. Default: 1:1.
versionstringNoModel version. One of: 5.2, 6.0, 6.1. Default: 6.1.
qualitynumberNoQuality level. One of: 0.25, 0.5, 1. Default: 1.
stylestringNoStyle preset. One of: raw, cute, expressive, scenic.
chaosnumberNoRandomness factor, 0-100. Default: 0.
stylizenumberNoStylization strength, 0-1000. Default: 100.
webhookUrlstringNoURL to receive a webhook when the job completes.

Example Request

curl -X POST https://apiframe-api.161.153.32.214.sslip.io/v1/imagine \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "prompt": "a futuristic city at sunset",
    "aspectRatio": "16:9"
  }'

Example Response (202 Accepted)

{
  "success": true,
  "job": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "imagine",
    "status": "pending",
    "prompt": "A serene mountain landscape at sunset, photorealistic",
    "progress": 0,
    "imageUrl": null,
    "imageUrls": null,
    "error": null,
    "createdAt": "2026-05-14T10:30:00.000Z",
    "completedAt": null
  }
}

POST/v1/describe

Describe an image from a URL. The API will analyze the image and return text descriptions. Costs 4 credits.

Request Body

ParameterTypeRequiredDescription
imageUrlstring (url)YesURL of the image to describe.
webhookUrlstring (url)NoURL to receive a webhook when the job completes.

Example Request

curl -X POST https://apiframe-api.161.153.32.214.sslip.io/v1/describe \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "imageUrl": "https://example.com/photo.jpg"
  }'

Example Response (202 Accepted)

{
  "success": true,
  "job": {
    "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "type": "describe",
    "status": "pending",
    "prompt": null,
    "progress": 0,
    "imageUrl": null,
    "imageUrls": null,
    "error": null,
    "createdAt": "2026-05-14T10:32:00.000Z",
    "completedAt": null
  }
}

POST/v1/upscale

Upscale a specific image from a completed imagine job. The parent job must be in the succeeded state. Costs 4 credits.

Request Body

ParameterTypeRequiredDescription
jobIdstring (uuid)YesThe ID of the completed imagine job to upscale from.
indexnumberYesWhich image to upscale. One of: 1, 2, 3, 4.
webhookUrlstring (url)NoURL to receive a webhook when the job completes.

Example Request

curl -X POST https://apiframe-api.161.153.32.214.sslip.io/v1/upscale \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "index": 2
  }'

Example Response (202 Accepted)

{
  "success": true,
  "job": {
    "id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "type": "upscale",
    "status": "pending",
    "prompt": null,
    "progress": 0,
    "imageUrl": null,
    "imageUrls": null,
    "error": null,
    "createdAt": "2026-05-14T10:35:00.000Z",
    "completedAt": null
  }
}

POST/v1/blend

Blend 2 to 5 images together into a new image. Costs 16 credits.

Request Body

ParameterTypeRequiredDescription
imageUrlsstring[]YesArray of 2 to 5 image URLs to blend together.
webhookUrlstring (url)NoURL to receive a webhook when the job completes.

Example Request

curl -X POST https://apiframe-api.161.153.32.214.sslip.io/v1/blend \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "imageUrls": [
      "https://example.com/image1.jpg",
      "https://example.com/image2.jpg",
      "https://example.com/image3.jpg"
    ]
  }'

Example Response (202 Accepted)

{
  "success": true,
  "job": {
    "id": "d4e5f6a7-b8c9-0123-defa-234567890123",
    "type": "blend",
    "status": "pending",
    "prompt": null,
    "progress": 0,
    "imageUrl": null,
    "imageUrls": null,
    "error": null,
    "createdAt": "2026-05-14T10:37:00.000Z",
    "completedAt": null
  }
}

POST/v1/variation

Create a variation of a specific image from a completed imagine job. The parent job must be in the succeeded state. Costs 16 credits.

Request Body

ParameterTypeRequiredDescription
jobIdstring (uuid)YesThe ID of the completed imagine job to create a variation from.
indexnumberYesWhich image to create a variation of. One of: 1, 2, 3, 4.
webhookUrlstring (url)NoURL to receive a webhook when the job completes.

Example Request

curl -X POST https://apiframe-api.161.153.32.214.sslip.io/v1/variation \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "index": 3
  }'

Example Response (202 Accepted)

{
  "success": true,
  "job": {
    "id": "e5f6a7b8-c9d0-1234-efab-345678901234",
    "type": "variation",
    "status": "pending",
    "prompt": null,
    "progress": 0,
    "imageUrl": null,
    "imageUrls": null,
    "error": null,
    "createdAt": "2026-05-14T10:38:00.000Z",
    "completedAt": null
  }
}

GET/v1/jobs/:id

Get the status and result of a specific job. Use this to poll for job completion.

Path Parameters

ParameterTypeRequiredDescription
idstring (uuid)YesThe job ID returned when the job was created.

Example Request

curl https://apiframe-api.161.153.32.214.sslip.io/v1/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "X-API-Key: YOUR_API_KEY"

Example Response (200 OK)

{
  "success": true,
  "job": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "imagine",
    "status": "succeeded",
    "prompt": "A serene mountain landscape at sunset, photorealistic",
    "progress": 100,
    "imageUrl": "https://cdn.example.com/images/result.png",
    "imageUrls": [
      "https://cdn.example.com/images/result-1.png",
      "https://cdn.example.com/images/result-2.png",
      "https://cdn.example.com/images/result-3.png",
      "https://cdn.example.com/images/result-4.png"
    ],
    "error": null,
    "createdAt": "2026-05-14T10:30:00.000Z",
    "completedAt": "2026-05-14T10:30:45.000Z"
  }
}

Job Status Values

StatusDescription
pendingJob has been created and is waiting to be processed.
queuedJob is in the processing queue.
processingJob is actively being processed.
succeededJob completed successfully. Results are available.
failedJob encountered an error. Check the error field.
timed_outJob exceeded the maximum processing time.
cancelledJob was cancelled by the user.

GET/v1/jobs

List all jobs for the authenticated user. Results are paginated.

Query Parameters

ParameterTypeRequiredDescription
limitnumberNoNumber of jobs to return. Default: 20, max: 100.
offsetnumberNoNumber of jobs to skip. Default: 0.

Example Request

curl "https://apiframe-api.161.153.32.214.sslip.io/v1/jobs?limit=10&offset=0" \
  -H "X-API-Key: YOUR_API_KEY"

Example Response (200 OK)

{
  "success": true,
  "jobs": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "type": "imagine",
      "status": "succeeded",
      "prompt": "A serene mountain landscape at sunset",
      "progress": 100,
      "imageUrl": "https://cdn.example.com/images/result.png",
      "imageUrls": [...],
      "error": null,
      "createdAt": "2026-05-14T10:30:00.000Z",
      "completedAt": "2026-05-14T10:30:45.000Z"
    }
  ]
}

POST/v1/jobs/:id/cancel

Cancel a job that is currently in progress. Returns 400 if the job is already in a terminal state (succeeded, failed, timed_out, or cancelled).

Path Parameters

ParameterTypeRequiredDescription
idstring (uuid)YesThe job ID to cancel.

Example Request

curl -X POST https://apiframe-api.161.153.32.214.sslip.io/v1/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel \
  -H "X-API-Key: YOUR_API_KEY"

Example Response (200 OK)

{
  "success": true,
  "job": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "imagine",
    "status": "cancelled",
    "prompt": "A serene mountain landscape at sunset",
    "progress": 30,
    "imageUrl": null,
    "imageUrls": null,
    "error": null,
    "createdAt": "2026-05-14T10:30:00.000Z",
    "completedAt": "2026-05-14T10:31:10.000Z"
  }
}

GET/v1/account

Get account information including name, email, current plan, and credit balance.

Example Request

curl https://apiframe-api.161.153.32.214.sslip.io/v1/account \
  -H "X-API-Key: YOUR_API_KEY"

Example Response (200 OK)

{
  "success": true,
  "account": {
    "name": "Jane Doe",
    "email": "jane@example.com",
    "plan": "standard",
    "credits": {
      "remaining": 450,
      "total": 500
    }
  }
}

Error Handling

All errors follow a standard format. The response will include a success: false flag and an error object with a machine-readable code and a human-readable message.

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The 'prompt' field is required."
  }
}

Error Codes

HTTP StatusCodeDescription
400VALIDATION_ERRORThe request body is invalid or missing required fields.
401UNAUTHORIZEDMissing or invalid API key.
402INSUFFICIENT_CREDITSNot enough credits to perform this operation.
404NOT_FOUNDThe requested resource was not found.
429RATE_LIMITEDToo many requests. Slow down and retry after the indicated time.
500PROVIDER_ERRORAn internal error occurred with the image generation provider.

Rate Limiting

Rate limits are applied per API key, per minute. The limits vary by plan.

PlanRequests / Minute
Free10
Hobby30
Standard60
Growth120
Scale300

Rate limit information is included in the response headers of every API call:

HeaderDescription
X-RateLimit-LimitThe maximum number of requests allowed per minute.
X-RateLimit-RemainingThe number of requests remaining in the current window.
X-RateLimit-ResetUnix timestamp (seconds) when the rate limit window resets.

When rate limited, you will receive a 429 status code with a Retry-After header indicating how many seconds to wait before retrying.

Credits

Different operations consume different amounts of credits. The Free plan includes 50 credits to get you started (enough for 3 Midjourney generations).

OperationCreditsUSD equivalent
Imagine16$0.16
Blend16$0.16
Variation16$0.16
Describe4$0.04
Upscale4$0.04

You can check your remaining credits at any time using the GET /v1/account endpoint. If you run out of credits, requests will return a 402 INSUFFICIENT_CREDITS error.

Upgrade your plan from the console dashboard to get more credits and higher rate limits.

Compatibility Aliases

For compatibility with the original apiframe.ai API, the following path aliases are supported. They behave identically to their /v1/ counterparts and require the same authentication.

AliasEquivalent
POST /imaginePOST /v1/imagine
POST /describePOST /v1/describe
POST /upscalePOST /v1/upscale
POST /blendPOST /v1/blend
POST /variationPOST /v1/variation
GET /fetch/:idGET /v1/jobs/:id
POST /api/v1/imaginePOST /v1/imagine
POST /api/v1/describePOST /v1/describe
POST /api/v1/upscalePOST /v1/upscale
POST /api/v1/blendPOST /v1/blend
POST /api/v1/variationPOST /v1/variation
GET /api/v1/fetch/:idGET /v1/jobs/:id

Note: The /fetch/:id alias returns the same data as GET /v1/jobs/:id but uses the data key instead of job in the response object.