{
  "openapi": "3.0.1",
  "info": {
    "title": "Leonardo AI API - Image Generation, Upscaling & Custom Models",
    "description": "Generate stunning AI images with Leonardo AI's powerful image generation models. Create images from text prompts, upscale existing images, generate variations, and access custom-trained models through a simple interface.",
    "version": "1.0",
    "x-build-id": "m8fdWt0MJf8swlPft"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alizarin_refrigerator-owner~leonardo-ai-api---image-generation-upscaling-custom-models/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alizarin_refrigerator-owner-leonardo-ai-api---image-generation-upscaling-custom-models",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/alizarin_refrigerator-owner~leonardo-ai-api---image-generation-upscaling-custom-models/runs": {
      "post": {
        "operationId": "runs-sync-alizarin_refrigerator-owner-leonardo-ai-api---image-generation-upscaling-custom-models",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/alizarin_refrigerator-owner~leonardo-ai-api---image-generation-upscaling-custom-models/run-sync": {
      "post": {
        "operationId": "run-sync-alizarin_refrigerator-owner-leonardo-ai-api---image-generation-upscaling-custom-models",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "task"
        ],
        "properties": {
          "task": {
            "title": "Task",
            "enum": [
              "generate_image",
              "get_generation",
              "list_generations",
              "upscale_image",
              "generate_variations",
              "list_models",
              "get_model",
              "list_user_generations",
              "get_user_info",
              "calculate_cost"
            ],
            "type": "string",
            "description": "The operation to perform with Leonardo AI",
            "default": "generate_image"
          },
          "prompt": {
            "title": "Prompt",
            "type": "string",
            "description": "Text description of the image to generate"
          },
          "negativePrompt": {
            "title": "Negative Prompt",
            "type": "string",
            "description": "What to avoid in the generated image"
          },
          "modelId": {
            "title": "Model ID",
            "type": "string",
            "description": "Leonardo AI model ID to use for generation"
          },
          "presetStyle": {
            "title": "Preset Style",
            "enum": [
              "",
              "ANIME",
              "CINEMATIC",
              "CREATIVE",
              "DYNAMIC",
              "ENVIRONMENT",
              "FASHION",
              "FILM",
              "FOOD",
              "GENERAL",
              "HDR",
              "ILLUSTRATION",
              "LEONARDO",
              "LONG_EXPOSURE",
              "MACRO",
              "MINIMALISTIC",
              "MONOCHROME",
              "MOODY",
              "NONE",
              "NEUTRAL",
              "PHOTOGRAPHY",
              "PORTRAIT",
              "PRO",
              "RETRO",
              "SKETCH_BW",
              "SKETCH_COLOR",
              "STOCK_PHOTO",
              "VIBRANT"
            ],
            "type": "string",
            "description": "Preset style to apply"
          },
          "width": {
            "title": "Width",
            "minimum": 512,
            "maximum": 2048,
            "type": "integer",
            "description": "Image width in pixels (must be divisible by 8)",
            "default": 1024
          },
          "height": {
            "title": "Height",
            "minimum": 512,
            "maximum": 2048,
            "type": "integer",
            "description": "Image height in pixels (must be divisible by 8)",
            "default": 1024
          },
          "numImages": {
            "title": "Number of Images",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "Number of images to generate (1-8)",
            "default": 1
          },
          "guidanceScale": {
            "title": "Guidance Scale",
            "minimum": 1,
            "maximum": 20,
            "type": "number",
            "description": "How closely to follow the prompt (1-20, higher = more literal)",
            "default": 7
          },
          "seed": {
            "title": "Seed",
            "type": "integer",
            "description": "Random seed for reproducible results"
          },
          "public": {
            "title": "Public Generation",
            "type": "boolean",
            "description": "Make generation publicly visible",
            "default": false
          },
          "alchemy": {
            "title": "Alchemy (High Quality)",
            "type": "boolean",
            "description": "Enable Alchemy for higher quality output",
            "default": false
          },
          "photoReal": {
            "title": "PhotoReal Mode",
            "type": "boolean",
            "description": "Enable PhotoReal for photorealistic images",
            "default": false
          },
          "generationId": {
            "title": "Generation ID",
            "type": "string",
            "description": "Generation ID for get_generation, upscale, or variations"
          },
          "imageId": {
            "title": "Image ID",
            "type": "string",
            "description": "Image ID for upscale or variation operations"
          },
          "upscaleMultiplier": {
            "title": "Upscale Multiplier",
            "minimum": 1.5,
            "maximum": 2,
            "type": "number",
            "description": "Upscale factor (1.5 or 2)",
            "default": 2
          },
          "apiKey": {
            "title": "Leonardo AI API Key",
            "type": "string",
            "description": "Your Leonardo AI API key (from app.leonardo.ai/api-access)"
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "URL to receive results via webhook for automation platforms"
          },
          "demoMode": {
            "title": "Demo Mode",
            "type": "boolean",
            "description": "Run with sample data for testing (no API calls made)",
            "default": true
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}