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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
promptStringtrueA text description of the desired image(s). The maximum length is 1000 characters
text_layoutobjectsfalseAvailable in recraftv3 model only. This topic is covered below
nintegerfalseThe number of images to generate, must be between 1 and 6.
styleStringfalseThe style of the generated images, for detail (opens in a new tab)
substyleStringfalseThe substyle of the generated images, for detail (opens in a new tab)
modelStringfalseThe model to use for image generation. Must be one of recraftv3 or recraftv2
default is recraftv3
sizeStringfalseThe size of the generated images in WxH format, for detail (opens in a new tab),
default is 1024x1024
negative_promptStringfalseA text description of undesired elements on an image.
controlsStringobjectsA 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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
imageStringtrue(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.
promptStringtrueA text description of the desired image(s). The maximum length is 1000 characters
strengthfloattrueDefines the difference with the original image, should lie in [0, 1], where 0 means almost identical, and 1 means miserable similarity
nintegerfalseThe number of images to generate, must be between 1 and 6.
styleStringfalseThe style of the generated images, for detail (opens in a new tab)
substyleStringfalseThe substyle of the generated images, for detail (opens in a new tab)
modelStringfalseThe model to use for image generation. Must be one of recraftv3 or recraftv2
default is recraftv3
negative_promptStringfalseA text description of undesired elements on an image.
controlsStringobjectsA 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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
imageStringtrue(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.
maskStringtrue(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).
promptStringtrueA text description of the desired image(s). The maximum length is 1000 characters
nintegerfalseThe number of images to generate, must be between 1 and 6.
styleStringfalseThe style of the generated images, for detail (opens in a new tab)
substyleStringfalseThe substyle of the generated images, for detail (opens in a new tab)
modelStringfalseThe model to use for image generation. Must be one of recraftv3 or recraftv2
default is recraftv3
negative_promptStringfalseA 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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
imageStringtrue(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.
promptStringtrueA text description of the desired image(s). The maximum length is 1000 characters
nintegerfalseThe number of images to generate, must be between 1 and 6.
styleStringfalseThe style of the generated images, for detail (opens in a new tab)
substyleStringfalseThe substyle of the generated images, for detail (opens in a new tab)
modelStringfalseThe model to use for image generation. Must be one of recraftv3 or recraftv2
default is recraftv3
negative_promptStringfalseA 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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
imageStringtrue(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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
imageStringtrue(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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
imageStringtrue(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

NameTypeRequiredDescription
TT-API-KEYStringtrueYour API Key in TT API used for request authorization

Request Body

NameTypeRequiredDescription
imageStringtrue(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.