Generate AI images using cURL or Python and create your own styles programmatically.

Generate a digital illustration using RecraftV3 model

curl https://external.api.recraft.ai/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "two race cars on a track",
        "style": "digital_illustration",
        "model": "recraftv3"
    }'

Generate a realistic image with specific size

curl https://external.api.recraft.ai/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "red point siamese cat",
        "style": "realistic_image",
        "size": "1280x1024"
    }'

Generate a digital illustration with specific substyle

curl https://external.api.recraft.ai/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -d '{
        "prompt": "a monster with lots of hands",
        "style": "digital_illustration",
        "substyle": "hand_drawn"
    }'

Image to image with digital illustration style

curl -X POST https://external.api.recraft.ai/v1/images/imageToImage \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "[email protected]" \
    -F "prompt=winter" \
    -F "strength=0.2" \
    -F "style=digital_illustration"

Inpaint an image with digital illustration style

curl -X POST https://external.api.recraft.ai/v1/images/inpaint \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "prompt=moon" \
    -F "style=digital_illustration" \
    -F "[email protected]" -F "[email protected]"

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

curl -X POST https://external.api.recraft.ai/v1/styles \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "style=digital_illustration" \
    -F "[email protected]"

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

curl https://external.api.recraft.ai/v1/images/generations \
    -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

curl -X POST https://external.api.recraft.ai/v1/images/vectorize \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "[email protected]"

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

curl -X POST https://external.api.recraft.ai/v1/images/removeBackground \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "response_format=b64_json" \
    -F "[email protected]"

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

curl -X POST https://external.api.recraft.ai/v1/images/crispUpscale \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "response_format=b64_json" \
    -F "[email protected]"

Run creative upscale tool for a PNG image

curl -X POST https://external.api.recraft.ai/v1/images/creativeUpscale \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -F "[email protected]"

Variate PNG image, get the result in WEBP format

curl -X POST https://external.api.recraft.ai/v1/images/variateImage \
    -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 "[email protected]"