---
title: "Create Sync Generation"
method: POST
path: "/generationssync"
tags: ["Generations"]
---

# Create Sync Generation

`POST /generationssync`

## Request

- Base URL: `https://cloud.leonardo.ai/api/rest/v2`
- URL: `https://cloud.leonardo.ai/api/rest/v2/generationssync`
- Auth: HTTP bearer

Run a generation and return the finished result in the same response. Only sync-capable models are accepted. The request may take up to ~27 seconds before the service times out.

## Request body

- RemoveBgSyncGenerationRequest
  - `model` 'remove-bg', required: Must be `remove-bg`.
  - `public` boolean: Whether the generated images should show in the community feed. Ignored when `ephemeral` is true.
  - `parameters` object: Architecture properties of the Remove Background model
    - `roi` string: Region of interest to search for the subject, given as two x/y coordinate pairs in pixels ('0px 0px 100px 100px') or percentages ('0% 0% 100% 100%'). Anything outside this rectangle is treated as background.
    - `crop` boolean: Crops the output image to the bounding box of the subject.
    - `size` union: Maximum output image resolution. 'preview' caps at 0.25 megapixels, 'full' and 'auto' cap at 25 megapixels, and '50MP' allows up to 50 megapixels. PNG output is capped at 10 megapixels regardless of this setting.
      - 'preview'
      - 'auto'
      - 'full'
      - '50MP'
    - `type` 'auto' | 'person' | 'product' | 'car' | 'animal' | 'graphic' | 'transportation' | 'other': Foreground type hint to improve cutout quality.
    - `scale` string: Scale of the subject relative to the output canvas, as 'original' or a percentage between '10%' and '100%'.
    - `format` 'png' | 'jpg' | 'webp': Output image format. PNG and WebP preserve transparency, JPG does not. PNG is capped at 10 megapixels by the provider, so pair larger 'size' values with WebP to keep transparency. remove.bg's 'auto' is deliberately not offered: it picks PNG or JPG from the finished pixels, and the output's storage key has to be named before the request is sent.
    - `bg_color` string: Adds a solid background color to the cutout (hex code or color name). Output is no longer transparent — pair with 'jpg' when possible.
    - `channels` 'rgba' | 'alpha': 'rgba' returns the cutout image; 'alpha' returns only the greyscale alpha mask.
    - `position` string: Position of the subject within the output canvas, as 'original', 'center', a single percentage, or two percentages for horizontal and vertical placement.
    - `quantity` integer: Number of outputs to generate (fixed at 1)
    - `guidances` object, required: The image guidance properties object that will be defined on a per-model basis.
      - `image_reference` object[], required: References images to guide your video generation.
        - `image` object, required: A reference to an image
          - `id` string, uuid
          - `url` string, uri: Image URL or a base64 data URL. Required when type is URL. The backend enriches resolved image URLs.
          - `data` string, byte: Base64-encoded image bytes. Required when type is BASE64.
          - `type` 'UPLOADED' | 'GENERATED' | 'VARIATION' | 'URL' | 'BASE64'
          - `width` integer
          - `height` integer
        - `order` integer: The order at which we want this guidance to be in a list of guidances
      - `background_image_reference` object[]: An image to composite behind the cutout. Accepts a Leonardo image id, a URL, or base64 image bytes. Omit this field to keep the background transparent, or set bg_color for a solid fill.
        - `image` unknown, required
    - `type_level` 'none' | '1' | '2' | 'latest': How specifically the subject should be classified. 'none' skips classification, '1' picks a coarse category, '2' picks a specific category, and 'latest' uses the most detailed classification available.
    - `crop_margin` string: Margin to add around the cropped subject, as an absolute value ('30px') or relative to the subject size ('10%'). Accepts one, two, or four values and only applies when 'crop' is enabled.
    - `shadow_type` 'none' | 'drop' | '3d' | 'car': Style of artificial shadow to render under the subject.
    - `shadow_opacity` integer: Opacity of the artificial shadow, from 0 to 100. Only applies when a shadow is enabled.
    - `semitransparency` boolean: Preserves semi-transparent regions such as glass, smoke, and veils.
  - `ephemeral` boolean: When true, the result is not persisted to the library and the response URL is a 30-minute presigned GET.
  - `base64` boolean: When true, return results[].dataB64 instead of results[].url. The request fails if the encoded payload would exceed the response size limit.

## Response `200`

Responses for POST /generationssync

- SyncGenerationResponse
  - `id` string, required: Generation identifier.
  - `cost` Cost
    - `amount` string, required: The cost amount (credits or dollars, depending on `unit`). Serialized from the Decimal scalar.
    - `unit` 'CREDITS' | 'DOLLARS', required: Whether `amount` is API credits or dollars.
  - `results` SyncGenerationResult[], required: One entry per output that passed moderation, in provider order.
    - `contentType` string, required: Media type of the generated image (for example `image/png`).
    - `url` string, uri: CDN URL of the stored image, or a 30-minute presigned URL when `ephemeral` is true. Omitted when `base64` is true.
    - `dataB64` string, byte: Base64-encoded image bytes. Present only when the request set `base64` to true.
    - `width` integer: Output width in pixels, when reported by the provider.
    - `height` integer: Output height in pixels, when reported by the provider.
  - `blockedCount` integer, required: Number of outputs withheld by content moderation.

## Changes

- **2026-11-03** `a24db37826e5`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/leonardo/apis/rest-endpoints-v2/changes/generationssync/post.md)

---

[API](https://skmtc.dev/leonardo/apis/rest-endpoints-v2.md) - [All operations](https://skmtc.dev/leonardo/apis/rest-endpoints-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/leonardo/apis/rest-endpoints-v2/revisions/a24db37826e5?raw)
