Skip to main content
POST
/
api
/
v1
/
image
curl -X POST https://suite.sundaypyjamas.com/api/v1/image \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A minimalist logo of a mountain, flat design, teal and white"
  }'
curl -X POST https://suite.sundaypyjamas.com/api/v1/image \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "edit",
    "prompt": "Add a sunset gradient in the background",
    "image_url": "https://example.com/logo.png"
  }'
{
  "model": "gemini-2.5-flash-image",
  "prompt": "A minimalist logo of a mountain, flat design, teal and white",
  "operation": "generate",
  "tokensUsed": 1290,
  "image": "iVBORw0KGgoAAAANSUhEUgAA..."
}
{
  "model": "gemini-2.5-flash-image",
  "prompt": "A minimalist logo of a mountain, flat design, teal and white",
  "operation": "generate",
  "raw_image_id": "9f21...",
  "processed_run_id": "af02...",
  "raw_url": "https://storage.../raw/9f21....png?sig=...",
  "processed_url": "https://storage.../processed/af02....png?sig=...",
  "request_id": "7c31..."
}

Request Body

prompt
string
Text description of the image to generate, or the edit instructions when operation is "edit". Required unless profile supplies a default prompt.
operation
string
default:"generate"
"generate" (text-to-image) or "edit" (image-to-image).
model
string
Gemini image model, e.g. "gemini-2.5-flash-image" or "gemini-3-pro-image-preview". Defaults to the first active image model in your workspace’s catalog, or the profile default.
profile
string
Named enhancement profile, e.g. "ultrasound". Applies profile defaults for prompt, operation, and model.
image
string
Base64-encoded source image (with or without a data:image/png;base64, prefix). Required for operation: "edit" unless image_url or raw_image_id is given.
image_url
string
URL to a source image (PNG, JPEG, WebP, or GIF). Alternative to image.
raw_image_id
string
UUID of a previously uploaded raw image (requires S3 storage) — re-runs enhancement on a stored upload instead of re-uploading.
provider
string
default:"gemini"
"gemini" or "aws-nova-canvas". AWS Nova Canvas is only available with profile: "ultrasound".
persist
boolean
Store raw/processed images in S3. Defaults to true if STORAGE_PROVIDER=s3 is configured for your workspace, otherwise false.

Response

model
string
Model used
prompt
string
Resolved prompt actually sent to the model
operation
string
"generate" or "edit"
tokensUsed
number
image
string
Base64-encoded PNG. Present when S3 storage isn’t enabled.
profile
string
Profile used, if any
raw_image_id
string
Present only with S3 storage enabled
processed_run_id
string
Present only with S3 storage enabled
raw_url
string
Signed URL to the raw image. Present only with S3 storage enabled
processed_url
string
Signed URL to the generated/edited image. Present only with S3 storage enabled
request_id
string
curl -X POST https://suite.sundaypyjamas.com/api/v1/image \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A minimalist logo of a mountain, flat design, teal and white"
  }'
curl -X POST https://suite.sundaypyjamas.com/api/v1/image \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "edit",
    "prompt": "Add a sunset gradient in the background",
    "image_url": "https://example.com/logo.png"
  }'
{
  "model": "gemini-2.5-flash-image",
  "prompt": "A minimalist logo of a mountain, flat design, teal and white",
  "operation": "generate",
  "tokensUsed": 1290,
  "image": "iVBORw0KGgoAAAANSUhEUgAA..."
}
{
  "model": "gemini-2.5-flash-image",
  "prompt": "A minimalist logo of a mountain, flat design, teal and white",
  "operation": "generate",
  "raw_image_id": "9f21...",
  "processed_run_id": "af02...",
  "raw_url": "https://storage.../raw/9f21....png?sig=...",
  "processed_url": "https://storage.../processed/af02....png?sig=...",
  "request_id": "7c31..."
}

Errors

StatusCodeMessage
400MISSING_IMAGE_INPUTImage input required for edit operation. Provide either "image" (base64) or "image_url"
400Prompt is required
400Invalid model
401Invalid API key
402INSUFFICIENT_CREDITSInsufficient credits. Please purchase additional credits to continue.
429Gemini quota exceeded
500Failed to generate image: {details}

GET /image

Returns endpoint metadata — useful for a quick connectivity check.
curl https://suite.sundaypyjamas.com/api/v1/image \
  -H "Authorization: Bearer spj_ai_your_api_key_here"
{
  "message": "Image API. POST with { prompt?, profile?: \"ultrasound\", model?, image?, operation? }. Auth: Bearer API key",
  "endpoint": "/api/v1/image",
  "methods": ["GET", "POST", "OPTIONS"],
  "profiles": ["ultrasound"]
}