Recraft API
Recraft API, including raster and vector image generation, style creation, image generation in your brand style and colors, image vectorization and background removal.
Generate Image
POST
https://api.ttapi.io/recraft/images/generations
Creates an image given a prompt.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
prompt | String | true | A text description of the desired image(s). The maximum length is 1000 characters |
text_layout | objects | false | Available in recraftv3 model only. This topic is covered below |
n | integer | false | The number of images to generate, must be between 1 and 6. |
style | String | false | The style of the generated images, for detail (opens in a new tab) |
substyle | String | false | The substyle of the generated images, for detail (opens in a new tab) |
model | String | false | The model to use for image generation. Must be one of recraftv3 or recraftv2 default is recraftv3 |
size | String | false | The size of the generated images in WxH format, for detail (opens in a new tab), default is 1024x1024 |
negative_prompt | String | false | A text description of undesired elements on an image. |
controls | String | objects | A set of custom parameters to tweak generation process,for detail (opens in a new tab) |
Example Request
import requests
endpoint = "https://api.ttapi.io/recraft/images/generations"
headers = {
"TT-API-KEY": your_key
}
data = {
"prompt": "a cat",
"model": "recraftv3"
}
response = requests.post(endpoint, headers=headers, json=data)
print(response.status_code)
print(response.json())
Example Response
{
"status": "SUCCESS",
"message": "success",
"data": {
"quota": "3.08",
"images": [
{
"image_id": "20f36b20-2b98-4c9a-bf6d-7302bbe16ae5",
"url": "https://img.recraft.ai/C3raH1s9dF3LMvAh2JInyWIc89K2om_7AbAwbg7uhV0/rs:fit:1024:1024:0/raw:1/plain/abs://external/images/20f36b20-2b98-4c9a-bf6d-7302bbe16ae5"
}
]
}
}
Image To Image
POST
https://api.ttapi.io/recraft/images/imageToImage
Image-to-image operation transforms an input image into an output image, preserving certain aspects while altering others based on the prompt.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
image | String | true | (image url not 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 | String | true | A text description of the desired image(s). The maximum length is 1000 characters |
strength | float | true | Defines the difference with the original image, should lie in [0, 1], where 0 means almost identical, and 1 means miserable similarity |
n | integer | false | The number of images to generate, must be between 1 and 6. |
style | String | false | The style of the generated images, for detail (opens in a new tab) |
substyle | String | false | The substyle of the generated images, for detail (opens in a new tab) |
model | String | false | The model to use for image generation. Must be one of recraftv3 or recraftv2 default is recraftv3 |
negative_prompt | String | false | A text description of undesired elements on an image. |
controls | String | objects | A set of custom parameters to tweak generation process,for detail (opens in a new tab) |
Example Request
import requests
endpoint = "https://api.ttapi.io/recraft/images/imageToImage"
headers = {
"TT-API-KEY": your_key
}
data = {
"image": "https://cdn.ttapi.io/demo/20250309/1afa4765-c97c-48f7-8fbb-d6a75f8c36bb.png",
"prompt": "The environment turns into night",
"strength": 0.2
}
response = requests.post(endpoint, headers=headers, json=data)
print(response.status_code)
print(response.json())
Example Response
{
"status": "SUCCESS",
"message": "success",
"data": {
"quota": "2.80",
"images": [
{
"image_id": "87005f1d-d7aa-422b-b1dd-d85c3b287d1f",
"url": "https://cdn.ttapi.io/demo/20250309/87005f1d-d7aa-422b-b1dd-d85c3b287d1f.png"
}
]
}
}
Image Inpainting
POST
https://api.ttapi.io/recraft/images/inpaint
Inpainting replaces or modifies specific parts of an image. 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.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
image | String | true | (image url not 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 | String | true | (image url not 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 | String | true | A text description of the desired image(s). The maximum length is 1000 characters |
n | integer | false | The number of images to generate, must be between 1 and 6. |
style | String | false | The style of the generated images, for detail (opens in a new tab) |
substyle | String | false | The substyle of the generated images, for detail (opens in a new tab) |
model | String | false | The model to use for image generation. Must be one of recraftv3 or recraftv2 default is recraftv3 |
negative_prompt | String | false | A text description of undesired elements on an image. |
Image Inpainting
POST
https://api.ttapi.io/recraft/images/replaceBackground
Replace Background operation detects background of an image and modifies it according to given prompt.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
image | String | true | (image url not 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 | String | true | A text description of the desired image(s). The maximum length is 1000 characters |
n | integer | false | The number of images to generate, must be between 1 and 6. |
style | String | false | The style of the generated images, for detail (opens in a new tab) |
substyle | String | false | The substyle of the generated images, for detail (opens in a new tab) |
model | String | false | The model to use for image generation. Must be one of recraftv3 or recraftv2 default is recraftv3 |
negative_prompt | String | false | A text description of undesired elements on an image. |
Vectorize Image
POST
https://api.ttapi.io/recraft/images/vectorize
Converts a given raster image to SVG format.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
image | String | true | (image url not 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. |
Remove Background
POST
https://api.ttapi.io/recraft/images/removeBackground
Removes background of a given raster image.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
image | String | true | (image url not 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. |
Crisp Upscale
POST
https://api.ttapi.io/recraft/images/crispUpscale
Enhances a given raster image using ‘crisp upscale’ tool, increasing image resolution, making the image sharper and cleaner.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
image | String | true | (image url not 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. |
Creative Upscale
POST
https://api.ttapi.io/recraft/images/creativeUpscale
Enhances a given raster image using ‘creative upscale’ tool, boosting resolution with a focus on refining small details and faces.
Headers
Name | Type | Required | Description |
---|---|---|---|
TT-API-KEY | String | true | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
image | String | true | (image url not 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. |