Skip to main content

Step 1: Upload or Reference an Image

First, you need to provide the source image. You can either:
  • Upload an image file as base64
  • Provide a publicly accessible image URL
import requests
import base64

API_BASE = "https://api.krea.ai"
API_TOKEN = "YOUR_API_TOKEN"

# Option 1: Using base64 encoded image
with open("input_image.jpg", "rb") as image_file:
    encoded_image = base64.b64encode(image_file.read()).decode('utf-8')

# Option 2: Using image URL
image_url = "https://s.krea.ai/logo-icon-black.jpg"
Replace with your API TokenTo replace the YOUR_API_TOKEN placeholder in the above examples, you’ll need to generate an API token in krea.ai/settings/api-tokens. Follow the instructions on the API Keys & Billing page if you need help.

Step 2: Generate Image

Make a POST request to the appropriate endpoint with your image and parameters.
curl -X POST https://api.krea.ai/generate/image/google/nano-banana-pro\
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "imageUrls": ["https://s.krea.ai/logo-icon-black.jpg"],
    "prompt": "Turn this logo into an aesthetic rug. Product Photography style, with an aura that would make me want it in my own living room."
  }'
Example Response
{
  "created_at":"2026-02-13T02:20:58.265Z",
  "completed_at":null,
  "job_id":"757a315b-b3ed-457b-b1ba-cff5e140cfd4",
  "status":"processing",
  "type":"externalImage",
  "result":{}
}

Step 3: Poll for Results

Image generation is asynchronous. You’ll receive a job ID immediately, then poll for results until the image is ready. Poll /jobs/{job_id} every 2 seconds until the job completes.
curl -X GET https://api.krea.ai/jobs/YOUR_JOB_ID \
  -H "Authorization: Bearer YOUR_API_TOKEN"
Example Completed Response

{
  "created_at":"2026-02-13T02:20:58.265Z",
  "completed_at":"2026-02-13T02:21:21.948Z",
  "job_id":"757a315b-b3ed-457b-b1ba-cff5e140cfd4",
  "status":"completed",
  "type":"externalImage",
  "result": {
    "urls": [
      "https://app-uploads.krea.ai/public/757a315b-b3ed-457b-b1ba-cff5e140cfd4-image.png"
    ]
  }
}
Webhooks available!Set up webhooks to receive notifications when jobs complete. See the Webhooks guide to get started.