API Documentation

Integrate AI image enhancement into your applications with our simple REST API. Upload images, apply transformations, and retrieve results programmatically.

Authentication

All API requests require authentication using an API key. Include your key in theAuthorization header.

Get Your API Key

  1. Sign in to your account (Pro tier or higher required)
  2. Go to Settings → API Keys
  3. Click "Create API Key" and save it securely

Important: Your API key is shown only once when created. Store it securely!

Authorization: Bearer sk_live_YOUR_API_KEY

Upload Image

Upload an image file to get a storage key for processing.

POST/api/v1/upload/api

Request

Send a multipart/form-data request with the image file.

Response

{
  "storage_key": "uploads/user-id/abc123.jpg",
  "filename": "image.jpg",
  "size": 1234567,
  "content_type": "image/jpeg"
}
curl -X POST "https://api.enhancecraft.com/api/v1/upload/api" \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -F "file=@/path/to/image.jpg"

Create Job

Create an image processing job with one or more operations.

POST/api/v1/jobs/api

Request Body

{
  "input_key": "uploads/user-id/image.jpg",
  "operations": [
    {
      "type": "enhance",
      "params": {
        "scale": 2
      }
    }
  ]
}

Available Operations

TypeDescriptionParameters
enhanceAI upscaling for photos (2x, 4x, 8x)scale (required: 2/4/8)
enhance-animeAI upscaling optimised for anime, manga, and illustrations (always 4x)none
enhance-faceRestore and sharpen faces in portraits and group photosenhancement_level (optional, 0.0–1.0)
denoiseRemove noise and JPEG artifactsenhancement_level (optional, 0.0–1.0)
deblurRemove motion/focus blur and sharpenstrength (optional, 0.5–1.5)
restore-old-photoRestore vintage photos — face repair, colorization, damage repairface_enhancement_level (0.0–1.0), auto_repair_damage (bool), color_boost (1.0–2.0), enable_colorization (bool), colorization_strength (0.0–1.0)
remove-backgroundRemove image background with AIoutput_format (optional: png/jpg)
replace-backgroundReplace background with a color, image, or AI-generated scenebackground_type (required: color/image/transparent/prompt); background_color (#RRGGBB), background_image_key, or background_prompt depending on type
blur-backgroundBlur background while keeping subject sharpblur_radius (optional, 1–100), output_format (optional: png/jpg)
smart-cropAI-powered intelligent cropping to aspect ratioaspect_ratio (optional: 1:1/4:3/16:9/9:16/3:2/2:3), padding_percent (optional, 0–30)
remove-objectInpaint/remove objects from a masked regionmask_data_url (required, base64 data URL)
remove-textRemove text and watermarks with AIauto_detect (optional bool, default true); mask_data_url (required when auto_detect is false)
compress-optimizeReduce file size via JPEG compression (free, no credits)quality (optional, 1–100, default 85)
crop-resizeCrop and/or resize image (free, no credits)crop {pixels: [x,y,w,h] or percentage: [x,y,w,h]}, resize {width, height, maintain_aspect}. At least one required.
convertConvert image to a different format (free, no credits)output_format (required: png/jpg/jpeg/webp), quality (optional, 1–100)
curl -X POST "https://api.enhancecraft.com/api/v1/jobs/api" \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_key": "uploads/user-id/image.jpg",
    "operations": [
      {"type": "enhance", "params": {"scale": 2}}
    ]
  }'

Get Job Status

Check the status of a processing job. Poll until status is completed or failed.

GET/api/v1/jobs/api/{job_id}

Response

{
  "id": "abc123-...",
  "status": "completed",  // queued, processing, completed, failed
  "input_url": "uploads/...",
  "output_url": "outputs/...",  // Available when completed
  "error_message": null,        // Error details if failed
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:15Z"
}
curl "https://api.enhancecraft.com/api/v1/jobs/api/JOB_ID" \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY"

Rate Limits

API requests are rate limited based on your subscription tier.

TierRequests/MinuteRequests/MonthMax Keys
Pro5050,00010
Business200200,00050
Enterprise10,000+UnlimitedUnlimited

Rate Limit Headers

Every API response includes headers showing your current rate limit status:

X-RateLimit-Limit: 50         # Max requests per minute
X-RateLimit-Remaining: 45     # Requests remaining
X-RateLimit-Reset: 1705312800 # Unix timestamp when limit resets
X-RateLimit-Limit-Month: 50000
X-RateLimit-Remaining-Month: 49955

Complete Example

Here's a complete example that uploads an image, creates a job, and waits for completion.

# 1. Upload image
UPLOAD=$(curl -s -X POST "https://api.enhancecraft.com/api/v1/upload/api" \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -F "file=@image.jpg")
STORAGE_KEY=$(echo $UPLOAD | jq -r '.storage_key')

# 2. Create job
JOB=$(curl -s -X POST "https://api.enhancecraft.com/api/v1/jobs/api" \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"input_key\": \"$STORAGE_KEY\",
    \"operations\": [{\"type\": \"enhance\", \"params\": {\"scale\": 2}}]
  }")
JOB_ID=$(echo $JOB | jq -r '.id')

# 3. Poll for completion
while true; do
  STATUS=$(curl -s "https://api.enhancecraft.com/api/v1/jobs/api/$JOB_ID" \
    -H "Authorization: Bearer sk_live_YOUR_API_KEY" | jq -r '.status')
  echo "Status: $STATUS"
  if [ "$STATUS" = "completed" ] || [ "$STATUS" = "failed" ]; then
    break
  fi
  sleep 2
done

Need Help?

Check our interactive API documentation for more details and try out endpoints directly.

Open Swagger UI