Generate image
Creates an image given a prompt.Example
Output
Parameters
| Parameter | Type | Description | Compatibility |
|---|---|---|---|
| prompt (required) | string | A text description of the desired image(s). | Maximum prompt length depends on model, refer to Appendix |
| text_layout | Array of objects or null | Refer to Text Layout. | Recraft V3 only |
| n | integer or null, default is 1 | The number of images to generate, must be between 1 and 6. | All models |
| style_id | UUID or null | Use a style as visual reference, refer to Styles. | Described in Styles |
| style | string or null | The style of the generated images, refer to Styles. | Described in Styles |
| model | string or null, default is recraftv3 | The model to use for image generation. | Must be one of: recraftv2, recraftv3 |
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. | All models |
| size | string or null, default is 1024x1024 | The size of the generated images in WxH or w:h format. | Depends on model, supported values are published in Appendix |
| negative_prompt | string or null | A text description of undesired elements on an image. | Recraft V2 / V3 |
| controls | object or null | A set of custom parameters to tweak generation process, refer to Controls. | All models |
extra_body argument. For example:
Create style
Upload a set of images to create a style reference.Example
Output
Request body
Upload a set of images to create a style reference.| Parameter | Type | Description |
|---|---|---|
| style (required) | string | The base style of the generated images, should be one of: realistic_image, digital_illustration, vector_illustration, icon |
| files (required) | files | Images in PNG, JPG, or WEBP format for use as style references. The max number of images is 5. Total size of all images is limited to 5 MB. |
Image to image
Image-to-image operation tool allows you to create images similar to a given image, preserving certain aspects like composition, color, or subject identity while altering others based on the prompt. This can be used to create variations of the image or images that have similar composition to existing image. Use prompt to describe the new image and strength to define similarity level. Note: This operation is available with Recraft V3 model only.Example
Output
Parameters
| Parameter | Type | Description | Compatibility |
|---|---|---|---|
| image (required) | file | An image to modify, must be less than 5 MB in size, have resolution less than 16 MP, and max dimension less than 4096 pixels. | |
| prompt (required) | string | A text description of areas to change. | refer to Appendix |
| strength (required) | float | Defines the difference with the original image, should lie in [0, 1], where 0 means almost identical, and 1 means minimal similarity. | |
| n | integer or null, default is 1 | The number of images to generate, must be between 1 and 6. | |
| style_id | UUID or null | Use a style as visual reference, refer to Styles. | Recraft V3 styles only |
| style | string or null | The style of the generated images, refer to Styles. | Recraft V3 styles only |
| model | string or null, default is recraftv3 | The model to use for image generation. | Recraft V3 only |
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. | |
| negative_prompt | string or null | A text description of undesired elements on an image. | |
| controls | object or null | A set of custom parameters to tweak generation process, refer to Controls. | |
| text_layout | Array of objects or null | Refer to Text Layout. |
Image inpainting
Inpainting lets you regenerate specific parts of an image while keeping the rest intact. This is useful for correcting details, replacing elements, or making creative changes without starting from scratch. It uses a mask to identify the areas to be filled in, where white pixels represent the regions to inpaint, and black pixels indicate the areas to keep intact, i.e. the white pixels are filled based on the input provided in the prompt. Note: This operation is available with Recraft V3 model only.Example
Output
Parameters
Body of a request should contain an image file and a mask in PNG, JPG or WEBP format and parameters passed as content type'multipart/form-data'. The image must be no more than 5 MB in size, have resolution no more than 16 MP, max dimension no more than 4096 pixels and min dimension no less than 256 pixels.
| Parameter | Type | Description | Compatibility |
|---|---|---|---|
| image (required) | file | An image to modify, must be less than 5 MB in size, have resolution less than 16 MP, and max dimension less than 4096 pixels. | |
| mask (required) | file | An image encoded in grayscale color mode, used to define the specific regions of an image that need modification. The white pixels represent the parts of the image that will be inpainted, while black pixels indicate the parts of the image that will remain unchanged. Should have exactly the same size as the image. Each pixel of the image should be either pure black (value 0) or pure white (value 255). | |
| prompt (required) | string | A text description of areas to change. | refer to Appendix |
| n | integer or null, default is 1 | The number of images to generate, must be between 1 and 6. | |
| style_id | UUID or null | Use a style as visual reference, refer to Styles. | Recraft V3 styles only |
| style | string or null | The style of the generated images, refer to Styles. | Recraft V3 styles only |
| model | string or null, default is recraftv3 | The model to use for image generation. | Recraft V3 only |
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. | |
| negative_prompt | string or null | A text description of undesired elements on an image. | |
| controls | object or null | A set of custom parameters to tweak generation process, refer to Controls. | |
| text_layout | Array of objects or null | Refer to Text Layout. |
Replace background
Replace Background operation detects background of an image and modifies it according to given prompt. Note: This operation is available with Recraft V3 model only.Example
Output
Parameters
Body of a request should contain an image file in PNG, JPG or WEBP format and parameters passed as content type'multipart/form-data'. The image must be no more than 5 MB in size, have resolution no more than 16 MP, max dimension no more than 4096 pixels and min dimension no less than 256 pixels.
| Parameter | Type | Description | Compatibility |
|---|---|---|---|
| image (required) | file | An image to modify, must be less than 5 MB in size, have resolution less than 16 MP, and max dimension less than 4096 pixels. | |
| prompt (required) | string | A text description of areas to change. | refer to Appendix |
| n | integer or null, default is 1 | The number of images to generate, must be between 1 and 6. | |
| style_id | UUID or null | Use a style as visual reference, refer to Styles. | Recraft V3 styles only |
| style | string or null | The style of the generated images, refer to Styles. | Recraft V3 styles only |
| model | string or null, default is recraftv3 | The model to use for image generation. | Recraft V3 only |
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. | |
| negative_prompt | string or null | A text description of undesired elements on an image. | |
| controls | object or null | A set of custom parameters to tweak generation process, refer to Controls. | |
| text_layout | Array of objects or null | Refer to Text Layout. |
Generate background
Generate Background operation generates a background for a given image, based on a prompt and a mask that specifies the regions to fill. Note: This operation is available with Recraft V3 model only.Example
Output
Parameters
Body of a request should contain an image file and a mask file, both in PNG, JPG or WEBP format, and parameters passed as content type'multipart/form-data'. The image must be no more than 5 MB in size, have resolution no more than 16 MP, max dimension no more than 4096 pixels and min dimension no less than 256 pixels.
| Parameter | Type | Description | Compatibility |
|---|---|---|---|
| image (required) | file | An image to modify, must be less than 5 MB in size, have resolution less than 16 MP, and max dimension less than 4096 pixels. | |
| mask (required) | file | An image encoded in grayscale color mode, used to define the specific regions of an image that need modification. The white pixels represent the parts of the image that will be inpainted, while black pixels indicate the parts of the image that will remain unchanged. Should have exactly the same size as the image. Each pixel of the image should be either pure black (value 0) or pure white (value 255). | |
| prompt (required) | string | A text description of areas to change. | refer to Appendix |
| n | integer or null, default is 1 | The number of images to generate, must be between 1 and 6. | |
| style_id | UUID or null | Use a style as visual reference, refer to Styles. | Recraft V3 styles only |
| style | string or null | The style of the generated images, refer to Styles. | Recraft V3 styles only |
| model | string or null, default is recraftv3 | The model to use for image generation. | Recraft V3 only |
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. | |
| negative_prompt | string or null | A text description of undesired elements on an image. | |
| controls | object or null | A set of custom parameters to tweak generation process, refer to Controls. | |
| text_layout | Array of objects or null | Refer to Text Layout. |
Vectorize image
Converts a given raster image to SVG format.Example
Output
Parameters
Body of a request should be a file in PNG, JPG or WEBP format and parameters passed as content type'multipart/form-data'. The image must be no more than 5 MB in size, have resolution no more than 16 MP, max dimension no more than 4096 pixels and min dimension no less than 256 pixels.
| Parameter | Type | Description |
|---|---|---|
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. |
Remove background
Removes background of a given raster image.Example
Output
Parameters
Body of a request should be a file in PNG, JPG or WEBP format and parameters passed as content type'multipart/form-data'. The image must be no more than 5 MB in size, have resolution no more than 16 MP, max dimension no more than 4096 pixels and min dimension no less than 256 pixels.
| Parameter | Type | Description |
|---|---|---|
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. |
Crisp upscale
Enhances a given raster image using ‘crisp upscale’ tool, increasing image resolution, making the image sharper and cleaner.Example
Output
Request body
Body of a request should be a file in PNG, JPG or WEBP format and parameters passed as content typemultipart/form-data. The image must be no more than 5 MB in size, have resolution no more than 4 MP, max dimension no more than 4096 pixels and min dimension no less than 32 pixels.
| Parameter | Type | Description |
|---|---|---|
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. |
Creative upscale
Enhances a given raster image using ‘creative upscale’ tool, boosting resolution with a focus on refining small details and faces.Example
Output
Request body
Body of a request should be a file in PNG, JPG or WEBP format and parameters passed as content typemultipart/form-data. The image must be no more than 5 MB in size, have resolution no more than 16 MP, max dimension no more than 4096 pixels and min dimension no less than 256 pixels.
| Parameter | Type | Description |
|---|---|---|
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. |
Erase region
Erases a region of a given raster image following a given mask, where white pixels represent the regions to erase, and black pixels indicate the areas to keep intact.Example
Output
Request body
Body of a request should contain a file and a mask, both in PNG, JPG or WEBP format, and parameters passed as content typemultipart/form-data. The images must be no more than 5 MB in size, have resolution no more than 4 MP, max dimension no more than 4096 pixels and min dimension no less than 32 pixels. The mask and image must have the same dimensions.
| Parameter | Type | Description |
|---|---|---|
| image (required) | file | An image to modify, must be less than 5 MB in size, have resolution less than 16 MP, and max dimension less than 4096 pixels. |
| mask (required) | file | An image encoded in grayscale color mode, used to define the specific regions of the image to be erased. The white pixels represent the parts of the image that will be erased, while black pixels indicate the parts of the image that will remain unchanged. Should have exactly the same size as the image. Each pixel of the image should be either pure black (value 0) or pure white (value 255). |
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. |
Variate image
Variate generates new versions of an image while keeping the overall concept intact. Each variation introduces slight differences in elements like character appearance, object position, or scene composition. The Variate function does not use a prompt. Instead, it uses the visual content of the original image to generate alternatives in different aspect ratios.Example
Output
Get user information
Returns information of the current user including credits balance.Example
Output
Auxiliary
Styles
Styles define the visual appearance and aesthetic of generated images, including textures, visual effects, colors, composition, and overall artistic feel. Recraft offers both predefined curated styles and the ability to create custom styles. For detailed visual examples, refer to Getting Started: Styles. Thestyle parameter accepts the name of any curated style provided by Recraft. Examples include but not limited to:
- Recraft V3:
Recraft V3 Raw,Photorealism,Illustration,Vector art,Enterprise,Hand-drawn,Line art,Punk Graphic, etc - Recraft V2:
Photorealism,Illustration,Vector art,3D render,Kawaii,Icon,Doodle, etc
Photorealism is available in Recraft V2, and Recraft V3 models).
Use the model parameter to explicitly specify which model version to use.
The style_id parameter accepts:
- style IDs created via the API;
- style IDs from the Recraft web platform, accessible if :
- you own the style;
- the style is publicly available;
- the style was explicitly shared to your account.
style and style_id parameters cannot be used together. Specify one or the other, not both.
If neither parameter is provided, the default style for the selected model will be used:
- Recraft V3:
Recraft V3 Raw; - Recraft V2:
Photorealism.
- custom styles created on the web platform are compatible with the model specified during creation;
- custom styles created via the API are compatible with Recraft V3 and Recraft V3 models only.
Controls
The generation process can be adjusted with a number of tweaks.| Parameter | Type | Description |
|---|---|---|
| artistic_level | integer or null | Defines the artistic tone of your image. At a simple level, the person looks straight at the camera in a static and clean style. Dynamic and eccentric levels introduce movement and creativity. The value should be in the range [0..5]. |
| colors | array of color definitions | An array of preferable colors. |
| background_color | color definition | Use the given color as a desired background color. |
| no_text | bool | Do not embed text layouts. |
Colors
Color type is defined as an object with the following fields| Parameter | Description |
|---|---|
| rgb (required) | An array of 3 integer values in range of 0...255 defining RGB color model. |
Text Layout
Text layout is used to define spatial and textual attributes for individual text elements. Each text element consists of an individual word and its bounding box (bbox).| Parameter | Description |
|---|---|
| text (required) | A single word containing only supported characters. |
| bbox (required) | A bounding box representing a 4-angled polygon. Each point in the polygon is defined by relative coordinates. |
text field must contain a single word composed only of the following characters:
Parameters
The request body must be a file in PNG, JPG, or WEBP format, submitted with the content type ‘multipart/form-data’. The image must not exceed 5 MB in size, with a maximum resolution of 16 MP, a maximum dimension of 4096 px, and a minimum dimension of 256 px.| Parameter | Type | Description |
|---|---|---|
| image (required) | file | The input image in PNG, WEBP or JPEG format. |
| image_format | string or null | Format of the output image. Supported values: png, webp. |
| size (required) | string | The size of the generated images in WxH or w:h format, supported values are published in Appendix. |
| random_seed | string or null | Optional random seed for reproducibility. |
| n | integer or null, default is 1 | Number of variations to generate [1–6]. |
| response_format | string or null, default is url | The format in which the generated images are returned. Must be one of url or b64_json. |