our logo

Image Editing & Modification API

These APIs let you edit existing photos using prompts, change hairstyles and colors, and convert sketches into finished images.

Introduction

The Image Editing APIs support both simple edits (like brightness changes) and complex transformations like hairstyle swaps or sketch‑to‑image generation.

Use them to:

  • Edit a base image using just a text description.
  • Change only the hairstyle or hair color while keeping the face intact.
  • Turn rough sketches into detailed illustrations.

Base URL

https://taiapi.aiphotocraft.com/

Authentication

Every request must include your API key from the Developer Dashboard.

Header

X-Api-Key: YOUR_API_KEY

Example

curl -X POST "https://taiapi.aiphotocraft.com/api/edit_image" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@base.jpg;type=image/jpeg" \
  -F "prompt=add warm golden hour lighting"

Secure usage

Avoid calling these endpoints directly from browsers with a hard‑coded key; use a backend instead.

Image Editing Endpoints

Edit Image

POST/api/edit_image

Edit an image using a text prompt. Upload a base image along with a prompt describing the desired edits.

Parameters

NameTypeRequiredDescription
imagefile (formData)RequiredBase image file to edit.
promptstring (formData)RequiredText prompt describing the edits (add/remove/modify/style/color).

Task Status Endpoint

GET/api/task-status/{task_id}

Get the status of a task and retrieve the processed image URL.

NameTypeRequiredDescription
task_idstring (path)RequiredThe ID of the task to get the status for.

Example Request

curl -X GET "https://taiapi.aiphotocraft.com/api/task-status/{task_id}"-H "accept: application/json"-H "X-Api-Key: YOUR_API_KEY"

Example Response

{
  "image_url": "https://taiapi.aiphotocraft.com/results/swapped_image.jpg"
}

Response Status Codes

Status CodeDescription
200Successfully retrieved task status.
400Bad request.
401Unauthorized.

Examples

import requests

url = "https://taiapi.aiphotocraft.com/api/edit_image"
headers = {
    "X-Api-Key": "YOUR_API_KEY",
    "accept": "application/json",
}

files = {
    "image": ("base.jpg", open("base.jpg", "rb"), "image/jpeg"),
}

data = {
    "prompt": "make it more bright",
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.status_code, response.text)

Hair Color Change

POST/api/hair_color_change

Change only the hair color of the main person in an image. Upload a base portrait image plus the target hair color.

Parameters

NameTypeRequiredDescription
imagefile (formData)RequiredBase portrait image whose hair color will be changed.
hairColorstring (formData)RequiredTarget hair color (e.g. "blonde", "dark brown", "red").

Task Status Endpoint

GET/api/task-status/{task_id}

Get the status of a task and retrieve the processed image URL.

NameTypeRequiredDescription
task_idstring (path)RequiredThe ID of the task to get the status for.

Example Request

curl -X GET "https://taiapi.aiphotocraft.com/api/task-status/{task_id}"-H "accept: application/json"-H "X-Api-Key: YOUR_API_KEY"

Example Response

{
  "image_url": "https://taiapi.aiphotocraft.com/results/swapped_image.jpg"
}

Response Status Codes

Status CodeDescription
200Successfully retrieved task status.
400Bad request.
401Unauthorized.

Examples

import requests

url = "https://taiapi.aiphotocraft.com/api/hair_color_change"
headers = {
    "X-Api-Key": "YOUR_API_KEY",
    "accept": "application/json",
}

files = {
    "image": ("portrait.jpg", open("portrait.jpg", "rb"), "image/jpeg"),
}

data = {
    "hairColor": "red",
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.status_code, response.text)

Hair Style Change

POST/api/hair_style_change

Change only the hairstyle of the main person in an image. Upload a base portrait image along with a target hairstyle description.

Parameters

NameTypeRequiredDescription
imagefile (formData)RequiredBase portrait image whose hairstyle will be changed.
hairStylestring (formData)RequiredTarget hairstyle description (e.g. "short bob", "long curly hair", "ponytail").

Task Status Endpoint

GET/api/task-status/{task_id}

Get the status of a task and retrieve the processed image URL.

NameTypeRequiredDescription
task_idstring (path)RequiredThe ID of the task to get the status for.

Example Request

curl -X GET "https://taiapi.aiphotocraft.com/api/task-status/{task_id}"-H "accept: application/json"-H "X-Api-Key: YOUR_API_KEY"

Example Response

{
  "image_url": "https://taiapi.aiphotocraft.com/results/swapped_image.jpg"
}

Response Status Codes

Status CodeDescription
200Successfully retrieved task status.
400Bad request.
401Unauthorized.

Examples

import requests

url = "https://taiapi.aiphotocraft.com/api/hair_style_change"
headers = {
    "X-Api-Key": "YOUR_API_KEY",
    "accept": "application/json",
}

files = {
    "image": ("portrait.jpg", open("portrait.jpg", "rb"), "image/jpeg"),
}

data = {
    "hairStyle": "short bob with bangs",
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.status_code, response.text)

Sketch to Image

POST/api/sketch_to_image

Generate a detailed image from a sketch and text prompt (Sketch + Text-to-Image). Upload a sketch image file plus a text prompt describing the desired final image.

Parameters

NameTypeRequiredDescription
sketchfile (formData)RequiredSketch/line-art image to transform into a full image.
promptstring (formData)RequiredText prompt describing the desired final image. Will be combined with an internal helper prompt for best results.

Task Status Endpoint

GET/api/task-status/{task_id}

Get the status of a task and retrieve the processed image URL.

NameTypeRequiredDescription
task_idstring (path)RequiredThe ID of the task to get the status for.

Example Request

curl -X GET "https://taiapi.aiphotocraft.com/api/task-status/{task_id}"-H "accept: application/json"-H "X-Api-Key: YOUR_API_KEY"

Example Response

{
  "image_url": "https://taiapi.aiphotocraft.com/results/swapped_image.jpg"
}

Response Status Codes

Status CodeDescription
200Successfully retrieved task status.
400Bad request.
401Unauthorized.

Examples

import requests

url = "https://taiapi.aiphotocraft.com/api/sketch_to_image"
headers = {
    "X-Api-Key": "YOUR_API_KEY",
    "accept": "application/json",
}

files = {
    "sketch": ("sketch.png", open("sketch.png", "rb"), "image/png"),
}

data = {
    "prompt": "highly detailed colorful illustration of a futuristic city based on this sketch",
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.status_code, response.text)