Skip to content

Examples

Fresh

​ Generate a raster image using Recraft V4 model

generate_recraftv4.sh

generate_recraftv4.py

curl  \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "two race cars on a track",
        "model": "recraftv4"
    }'

​ Generate a vector image using Recraft V4 Vector model

generate_recraftv4_vector.sh

generate_recraftv4_vector.py

curl  \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "cat on a mat",
        "model": "recraftv4_vector"
    }'

​ Generate a realistic image by Recraft V3 with specific size

generate_with_size.sh

generate_with_size.py

curl  \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "red point siamese cat",
        "model": "recraftv3",
        "style": "Photorealism",
        "size": "1280x1024"
    }'

​ Generate a digital illustration by Recraft V3 with specific style

generate_digital_illustration.sh

generate_digital_illustration.py

curl  \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "a monster with lots of hands",
        "style": "Hand-drawn"
    }'

​ Image to image by Recraft V3 with digital illustration style

image_to_image.sh

image_to_image.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "image=@image.png" \
    -F "prompt=winter" \
    -F "strength=0.2" \
    -F "style=Illustration"

​ Inpaint an image by Recraft V3 with style Enterprise

inpaint.sh

inpaint.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "prompt=moon" \
    -F "style=Enterprise" \
    -F "image=@image.png" -F "mask=@mask.png"

​ Create own Recraft V3 style by uploading reference images and use them for generation

create_style_and_generate.sh

create_style_and_generate.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "style=digital_illustration" \
    -F "file=@image.png"

# response: {"id":"095b9f9d-f06f-4b4e-9bb2-d4f823203427"}

curl  \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "wood potato masher",
        "style_id": "095b9f9d-f06f-4b4e-9bb2-d4f823203427"
    }'

​ Vectorize an image in PNG format

vectorize.sh

vectorize.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "file=@image.png"

​ Remove background from a PNG image, get the result in B64 JSON

remove_background_b64.sh

remove_background_b64.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "response_format=b64_json" \
    -F "file=@image.png"

​ Run crisp upscale tool for a PNG image, get the result in B64 JSON

crisp_upscale_b64.sh

crisp_upscale_b64.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "response_format=b64_json" \
    -F "file=@image.png"

​ Run creative upscale tool for a PNG image

creative_upscale.sh

creative_upscale.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "file=@image.png"

​ Variate PNG image, get the result in WEBP format

variate_image.sh

variate_image.py

curl -X POST  \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "response_format=url" \
    -F "size=1024x1024" \
    -F "n=1" \
    -F "seed=13191922" \
    -F "image_format=webp" \
    -F "file=@image.png"

​ Explore images

explore.sh

explore.py

curl  \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "race car on a track",
        "model": "recraftv4"
    }'

​ Explore similar images

explore_similar.sh

explore_similar.py

curl  \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "source_image_id": "c18a1988-45e7-4c00-82c4-4ad7d3dbce3a",
        "similarity": 3
    }'

Endpoints Styles

Ctrl+I

Assistant

Responses are generated using AI and may contain mistakes.

Recraft AI documentation. Not affiliated with Recraft.ai.