Leonardo.AI Image API

The Image API from Leonardo.AI — 3 operation(s) for image.

Operations 4

POST /generations Create a Generation of Images #
GET /generations/{id} Get a Single Generation #
DELETE /generations/{id} Delete a Single Generation #
GET /generations/user/{userId} Get generations by user ID #

Documentation

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/leonardo-ai-image-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

leonardo-ai-image-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Leonardo.AI 3D Model Assets Image API
  description: Upload, retrieve, and delete 3D model assets for use with Rodin and other 3D-capable workflows.
  version: v1.0.0
  contact:
    name: Leonardo.AI Support
    url: https://docs.leonardo.ai/docs/need-more-support
  license:
    name: Leonardo.AI Terms of Service
    url: https://leonardo.ai/terms-of-service/
servers:
- url: https://cloud.leonardo.ai/api/rest/v1
  description: Leonardo.AI Production API
security:
- bearerAuth: []
tags:
- name: Image
paths:
  /generations:
    post:
      tags:
      - Image
      summary: Create a Generation of Images
      description: This endpoint will generate images
      operationId: createGeneration
      requestBody:
        content:
          application/json:
            schema:
              properties:
                alchemy:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: 'Enable to use Alchemy. Note: The appropriate Alchemy version is selected for the specified model. For example, XL models will use Alchemy V2.'
                  default: true
                contrastRatio:
                  title: Float
                  type:
                  - number
                  - 'null'
                  description: Contrast Ratio to use with Alchemy. Must be a float between 0 and 1 inclusive.
                contrast:
                  type:
                  - number
                  - 'null'
                  description: Adjusts the contrast level of the generated image. Used in Phoenix and Flux models. Accepts values [1.0, 1.3, 1.8, 2.5, 3, 3.5, 4, 4.5]. For Phoenix, if alchemy is true, contrast needs to be 2.5 or higher.
                  minimum: 1
                  maximum: 4.5
                  example: 3.5
                  title: Float
                controlnets:
                  items:
                    $ref: '#/components/schemas/controlnet_input'
                  type:
                  - array
                  - 'null'
                elements:
                  items:
                    $ref: '#/components/schemas/element_input'
                  type:
                  - array
                  - 'null'
                userElements:
                  items:
                    $ref: '#/components/schemas/user_elements_input'
                  type:
                  - array
                  - 'null'
                expandedDomain:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: Enable to use the Expanded Domain feature of Alchemy.
                fantasyAvatar:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: Enable to use the Fantasy Avatar feature.
                guidance_scale:
                  title: Float
                  type:
                  - number
                  - 'null'
                  description: How strongly the generation should reflect the prompt. 7 is recommended. Must be between 1 and 20.
                height:
                  title: Int
                  type:
                  - integer
                  - 'null'
                  description: 'The input height of the images. Must be between 32 and 1536 and be a multiple of 8. Note: Input resolution is not always the same as output resolution due to upscaling from other features.'
                  default: 768
                highContrast:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: 'Enable to use the High Contrast feature of Prompt Magic. Note: Controls RAW mode. Set to false to enable RAW mode.'
                highResolution:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: Enable to use the High Resolution feature of Prompt Magic.
                imagePrompts:
                  items:
                    title: String
                    type:
                    - string
                    - 'null'
                  type:
                  - array
                  - 'null'
                imagePromptWeight:
                  title: Float
                  type:
                  - number
                  - 'null'
                init_generation_image_id:
                  title: String
                  type:
                  - string
                  - 'null'
                  description: The ID of an existing image to use in image2image.
                init_image_id:
                  title: String
                  type:
                  - string
                  - 'null'
                  description: The ID of an Init Image to use in image2image.
                init_strength:
                  title: Float
                  type:
                  - number
                  - 'null'
                  description: How strongly the generated images should reflect the original image in image2image. Must be a float between 0.1 and 0.9.
                modelId:
                  title: String
                  type:
                  - string
                  - 'null'
                  description: The model ID used for image generation. If not provided, uses sd_version to determine the version of Stable Diffusion to use. In-app, model IDs are under the Finetune Models menu. Click on the platform model or your custom model, then click View More. For platform models, you can also use the List Platform Models API.
                  default: b24e16ff-06e3-43eb-8d33-4416c2d75876
                negative_prompt:
                  title: String
                  type:
                  - string
                  - 'null'
                  description: The negative prompt used for the image generation
                num_images:
                  title: Int
                  type:
                  - integer
                  - 'null'
                  description: The number of images to generate. Must be between 1 and 8. If either width or height is over 768, must be between 1 and 4.
                  default: 4
                num_inference_steps:
                  title: Int
                  type:
                  - integer
                  - 'null'
                  description: The Step Count to use for the generation. Must be between 10 and 60. Default is 15.
                photoReal:
                  $ref: '#/components/schemas/photoRealArg'
                photoRealVersion:
                  $ref: '#/components/schemas/photoRealVersion'
                photoRealStrength:
                  $ref: '#/components/schemas/photoRealStrengthArg'
                presetStyle:
                  $ref: '#/components/schemas/sd_generation_style'
                prompt:
                  title: String
                  type: string
                  description: The prompt used to generate images
                  default: A majestic cat in the snow
                promptMagic:
                  $ref: '#/components/schemas/promptMagicArg'
                promptMagicStrength:
                  $ref: '#/components/schemas/promptMagicStrengthArg'
                promptMagicVersion:
                  $ref: '#/components/schemas/promptMagicVersionArg'
                public:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: Whether the generated images should show in the community feed.
                scheduler:
                  $ref: '#/components/schemas/sd_generation_schedulers'
                sd_version:
                  $ref: '#/components/schemas/sd_versions'
                seed:
                  $ref: '#/components/schemas/seed'
                tiling:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: Whether the generated images should tile on all axis.
                transparency:
                  title: TransparencyType
                  type:
                  - string
                  - 'null'
                  enum:
                  - disabled
                  - foreground_only
                  description: Which type of transparency this image should use
                ultra:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: 'Enable to use Ultra mode. Note: can not be used with Alchemy.'
                unzoom:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: Whether the generated images should be unzoomed (requires unzoomAmount and init_image_id to be set).
                unzoomAmount:
                  title: Float
                  type:
                  - number
                  - 'null'
                  description: How much the image should be unzoomed (requires an init_image_id and unzoom to be set to true).
                upscaleRatio:
                  title: Float
                  type:
                  - number
                  - 'null'
                  description: How much the image should be upscaled. (Enterprise Only)
                width:
                  title: Int
                  type:
                  - integer
                  - 'null'
                  description: 'The input width of the images. Must be between 32 and 1536 and be a multiple of 8. Note: Input resolution is not always the same as output resolution due to upscaling from other features.'
                  default: 1024
                controlNet:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: This parameter will be deprecated in September 2024. Please use the controlnets array instead.
                  deprecated: true
                controlNetType:
                  $ref: '#/components/schemas/controlnet_type'
                  deprecated: true
                weighting:
                  title: Float
                  type:
                  - number
                  - 'null'
                  description: This parameter will be deprecated in September 2024. Please use the controlnets array instead.
                  deprecated: true
                canvasRequest:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: Whether the generation is for the Canvas Editor feature.
                canvasRequestType:
                  $ref: '#/components/schemas/canvasRequestType'
                canvasInitId:
                  title: String
                  type:
                  - string
                  - 'null'
                  description: The ID of an initial image to use in Canvas Editor request.
                canvasMaskId:
                  title: String
                  type:
                  - string
                  - 'null'
                  description: The ID of a mask image to use in Canvas Editor request.
                enhancePrompt:
                  title: Boolean
                  type:
                  - boolean
                  - 'null'
                  description: When enabled, your prompt is expanded to include more detail.
                enhancePromptInstruction:
                  title: String
                  type:
                  - string
                  - 'null'
                  description: When enhancePrompt is enabled, the prompt is enhanced based on the given instructions.
              type: object
              required:
              - prompt
        description: Query parameters to be provided in the request body as a JSON object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  sdGenerationJob:
                    properties:
                      generationId:
                        title: String
                        type: string
                      apiCreditCost:
                        type:
                        - integer
                        - 'null'
                        description: 'API Credits Cost for Image Generation. Available for Production API Users. Note: it will be deprecated. Please use the cost instead.'
                        deprecated: true
                      cost:
                        $ref: '#/components/schemas/cost'
                    title: SDGenerationOutput
                    type:
                    - object
                    - 'null'
              example:
                sdGenerationJob:
                  generationId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                  apiCreditCost: null
                  cost:
                    amount: '0.0147'
                    unit: DOLLARS
          description: Responses for POST /generations
  /generations/{id}:
    get:
      tags:
      - Image
      summary: Get a Single Generation
      description: This endpoint will provide information about a specific generation
      operationId: getGenerationById
      parameters:
      - required: true
        description: The ID of the generation to return.
        in: path
        name: id
        schema:
          pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  generations_by_pk:
                    description: columns and relationships of "generations"
                    properties:
                      createdAt:
                        $ref: '#/components/schemas/timestamp'
                      generated_images:
                        items:
                          description: columns and relationships of "generated_images"
                          properties:
                            generated_image_variation_generics:
                              items:
                                description: columns and relationships of "generated_image_variation_generic"
                                properties:
                                  id:
                                    $ref: '#/components/schemas/uuid'
                                  status:
                                    $ref: '#/components/schemas/job_status'
                                  transformType:
                                    $ref: '#/components/schemas/VARIATION_TYPE'
                                  url:
                                    title: String
                                    type:
                                    - string
                                    - 'null'
                                title: generated_image_variation_generic
                                type: object
                              type: array
                            fantasyAvatar:
                              title: Boolean
                              type:
                              - boolean
                              - 'null'
                              description: If fantasyAvatar feature was used.
                            id:
                              $ref: '#/components/schemas/uuid'
                            imageToVideo:
                              $ref: '#/components/schemas/imageToVideo'
                            likeCount:
                              title: Int
                              type: integer
                            motion:
                              $ref: '#/components/schemas/motion'
                            motionModel:
                              $ref: '#/components/schemas/motionModel'
                            motionMP4URL:
                              $ref: '#/components/schemas/motionMP4URL'
                            motionStrength:
                              $ref: '#/components/schemas/motionStrength'
                            nsfw:
                              title: Boolean
                              type: boolean
                            url:
                              title: String
                              type: string
                          title: generated_images
                          type: object
                        type: array
                      generation_elements:
                        items:
                          description: This table captures the elements that are applied to Generations.
                          properties:
                            id:
                              $ref: '#/components/schemas/bigint'
                            lora:
                              description: Element used for the generation.
                              properties:
                                akUUID:
                                  $ref: '#/components/schemas/lora/properties/akUUID'
                                baseModel:
                                  $ref: '#/components/schemas/sd_versions'
                                description:
                                  $ref: '#/components/schemas/lora/properties/description'
                                name:
                                  $ref: '#/components/schemas/lora/properties/name'
                                urlImage:
                                  $ref: '#/components/schemas/lora/properties/urlImage'
                                weightDefault:
                                  $ref: '#/components/schemas/lora/properties/weightDefault'
                                weightMax:
                                  $ref: '#/components/schemas/lora/properties/weightMax'
                                weightMin:
                                  $ref: '#/components/schemas/lora/properties/weightMin'
                              title: loras
                              type:
                              - object
                              - 'null'
                            weightApplied:
                              $ref: '#/components/schemas/numeric'
                          title: generation_elements
                          type: object
                        type: array
                      guidanceScale:
                        $ref: '#/components/schemas/float8'
                      id:
                        $ref: '#/components/schemas/uuid'
                      imageHeight:
                        title: Int
                        type: integer
                      imageWidth:
                        title: Int
                        type: integer
                      inferenceSteps:
                        title: Int
                        type:
                        - integer
                        - 'null'
                      initStrength:
                        $ref: '#/components/schemas/float8'
                      modelId:
                        $ref: '#/components/schemas/uuid'
                      negativePrompt:
                        title: String
                        type:
                        - string
                        - 'null'
                      photoReal:
                        $ref: '#/components/schemas/photoRealRes'
                      photoRealStrength:
                        $ref: '#/components/schemas/photoRealStrengthRes'
                      presetStyle:
                        $ref: '#/components/schemas/sd_generation_style'
                      prompt:
                        title: String
                        type: string
                      promptMagic:
                        $ref: '#/components/schemas/promptMagicRes'
                      promptMagicStrength:
                        $ref: '#/components/schemas/promptMagicStrengthRes'
                      promptMagicVersion:
                        $ref: '#/components/schemas/promptMagicVersionRes'
                      public:
                        title: Boolean
                        type: boolean
                      scheduler:
                        $ref: '#/components/schemas/sd_generation_schedulers'
                      sdVersion:
                        $ref: '#/components/schemas/sd_versions'
                      seed:
                        $ref: '#/components/schemas/seed'
                      status:
                        $ref: '#/components/schemas/job_status'
                      ultra:
                        $ref: '#/components/schemas/sd_generation_ultra'
                    title: generations
                    type:
                    - object
                    - 'null'
          description: Responses for GET /generations/{id}
    delete:
      tags:
      - Image
      summary: Delete a Single Generation
      description: This endpoint deletes a specific generation
      operationId: deleteGenerationById
      parameters:
      - required: true
        description: The ID of the generation to delete.
        in: path
        name: id
        schema:
          pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  delete_generations_by_pk:
                    description: columns and relationships of "generations"
                    properties:
                      id:
                        $ref: '#/components/schemas/uuid'
                    title: generations
                    type:
                    - object
                    - 'null'
          description: Responses for DELETE /generations/{id}
  /generations/user/{userId}:
    get:
      tags:
      - Image
      summary: Get generations by user ID
      description: This endpoint returns all generations by a specific user
      operationId: getGenerationsByUserId
      parameters:
      - in: query
        name: offset
        schema:
          default: 0
          type: integer
      - in: query
        name: limit
        schema:
          default: 10
          type: integer
      - required: true
        in: path
        name: userId
        schema:
          pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  generations:
                    items:
                      description: columns and relationships of "generations"
                      properties:
                        createdAt:
                          $ref: '#/components/schemas/timestamp'
                        generated_images:
                          items:
                            description: columns and relationships of "generated_images"
                            properties:
                              generated_image_variation_generics:
                                items:
                                  description: columns and relationships of "generated_image_variation_generic"
                                  properties:
                                    id:
                                      $ref: '#/components/schemas/uuid'
                                    status:
                                      $ref: '#/components/schemas/job_status'
                                    transformType:
                                      $ref: '#/components/schemas/VARIATION_TYPE'
                                    url:
                                      title: String
                                      type:
                                      - string
                                      - 'null'
                                  title: generated_image_variation_generic
                                  type: object
                                type: array
                              id:
                                $ref: '#/components/schemas/uuid'
                              imageToVideo:
                                $ref: '#/components/schemas/imageToVideo'
                              likeCount:
                                title: Int
                                type: integer
                              motion:
                                $ref: '#/components/schemas/motion'
                              motionModel:
                                $ref: '#/components/schemas/motionModel'
                              motionMP4URL:
                                $ref: '#/components/schemas/motionMP4URL'
                              motionStrength:
                                $ref: '#/components/schemas/motionStrength'
                              nsfw:
                                title: Boolean
                                type: boolean
                              url:
                                title: String
                                type: string
                            title: generated_images
                            type: object
                          type: array
                        generation_elements:
                          items:
                            description: This table captures the elements that are applied to a Generations, also the order and weightings used when applied.
                            properties:
                              id:
                                $ref: '#/components/schemas/bigint'
                              lora:
                                description: Element used for the generation.
                                properties:
                                  akUUID:
                                    $ref: '#/components/schemas/lora/properties/akUUID'
                                  baseModel:
                                    $ref: '#/components/schemas/sd_versions'
                                  description:
                                    $ref: '#/components/schemas/lora/properties/description'
                                  name:
                                    $ref: '#/components/schemas/lora/properties/name'
                                  urlImage:
                                    $ref: '#/components/schemas/lora/properties/urlImage'
                                  weightDefault:
                                    $ref: '#/components/schemas/lora/properties/weightDefault'
                                  weightMax:
                                    $ref: '#/components/schemas/lora/properties/weightMax'
                                  weightMin:
                                    $ref: '#/components/schemas/lora/properties/weightMin'
                                title: elements
                                type:
                                - object
                                - 'null'
                              weightApplied:
                                $ref: '#/components/schemas/numeric'
                            title: generation_elements
                            type: object
                          type: array
                        guidanceScale:
                          $ref: '#/components/schemas/float8'
                        id:
                          $ref: '#/components/schemas/uuid'
                        imageHeight:
                          title: Int
                          type: integer
                        imageWidth:
                          title: Int
                          type: integer
                        inferenceSteps:
                          title: Int
                          type:
                          - integer
                          - 'null'
                        initStrength:
                          $ref: '#/components/schemas/float8'
                        modelId:
                          $ref: '#/components/schemas/uuid'
                        negativePrompt:
                          title: String
                          type:
                          - string
                          - 'null'
                        photoReal:
                          $ref: '#/components/schemas/photoRealRes'
                        photoRealStrength:
                          $ref: '#/components/schemas/photoRealStrengthRes'
                        presetStyle:
                          $ref: '#/components/schemas/sd_generation_style'
                        prompt:
                          title: String
                          type: string
                        promptMagic:
                          $ref: '#/components/schemas/promptMagicRes'
                        promptMagicStrength:
                          $ref: '#/components/schemas/promptMagicStrengthRes'
                        promptMagicVersion:
                          $ref: '#/components/schemas/promptMagicVersionRes'
                        public:
                          title: Boolean
                          type: boolean
                        scheduler:
                          $ref: '#/components/schemas/sd_generation_schedulers'
                        sdVersion:
                          $ref: '#/components/schemas/sd_versions'
                        seed:
                          $ref: '#/components/schemas/seed'
                        status:
                          $ref: '#/components/schemas/job_status'
                        ultra:
                          $ref: '#/components/schemas/sd_generation_ultra'
                      title: generations
                      type: object
                    type: array
          description: Responses for GET /generations/user/{userId}
components:
  schemas:
    motionStrength:
      title: Int
      type:
      - integer
      - 'null'
      description: The motion strength.
    VARIATION_TYPE:
      type: string
      title: VARIATION_TYPE
      enum:
      - OUTPAINT
      - INPAINT
      - UPSCALE
      - UNZOOM
      - NOBG
      description: The type of variation.
    photoRealStrengthArg:
      title: Float
      type:
      - number
      - 'null'
      description: Depth of field of photoReal. Must be 0.55 for low, 0.5 for medium, or 0.45 for high. Defaults to 0.55 if not specified.
    canvasRequestType:
      type:
      - string
      - 'null'
      title: canvasRequestType
      enum:
      - INPAINT
      - OUTPAINT
      - SKETCH2IMG
      - IMG2IMG
      description: The type of request for the Canvas Editor.
    photoRealRes:
      title: Boolean
      type:
      - boolean
      - 'null'
      description: If photoReal feature was used.
    photoRealVersion:
      title: String
      type:
      - string
      - 'null'
      description: The version of photoReal to use. Must be v1 or v2.
    lora:
      properties:
        description:
          type:
          - string
          - 'null'
          description: Description for the element
        name:
          type:
          - string
          - 'null'
          description: Name of the element
        urlImage:
          type:
          - string
          - 'null'
          description: URL of the element image
        weightMin:
          type:
          - integer
          - 'null'
          description: Minimum weight for the element
        akUUID:
          type:
          - string
          - 'null'
          description: Unique identifier for the element. Elements can be found from the List Elements endpoint.
        weightDefault:
          type:
          - integer
          - 'null'
          description: Default weight for the element
        weightMax:
          type:
          - integer
          - 'null'
          description: Maximum weight for the element
    cost:
      type:
      - object
      - 'null'
      title: Cost
      description: The cost of the operation.
      properties:
        amount:
          type: string
          description: The amount of the cost.
        unit:
          type: string
          enum:
          - CREDITS
          - DOLLARS
          description: 'The unit of the cost. Can be CREDITS or DOLLARS. Note: DOLLARS unit only supports PAYG pla

# --- truncated at 32 KB (38 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/leonardo-ai/refs/heads/main/openapi/leonardo-ai-image-api-openapi.yml