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_KEYExample
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
/api/edit_imageEdit an image using a text prompt. Upload a base image along with a prompt describing the desired edits.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image | file (formData) | Required | Base image file to edit. |
| prompt | string (formData) | Required | Text prompt describing the edits (add/remove/modify/style/color). |
Task Status Endpoint
/api/task-status/{task_id}Get the status of a task and retrieve the processed image URL.
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string (path) | Required | The 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 Code | Description |
|---|---|
| 200 | Successfully retrieved task status. |
| 400 | Bad request. |
| 401 | Unauthorized. |
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
/api/hair_color_changeChange only the hair color of the main person in an image. Upload a base portrait image plus the target hair color.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image | file (formData) | Required | Base portrait image whose hair color will be changed. |
| hairColor | string (formData) | Required | Target hair color (e.g. "blonde", "dark brown", "red"). |
Task Status Endpoint
/api/task-status/{task_id}Get the status of a task and retrieve the processed image URL.
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string (path) | Required | The 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 Code | Description |
|---|---|
| 200 | Successfully retrieved task status. |
| 400 | Bad request. |
| 401 | Unauthorized. |
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
/api/hair_style_changeChange only the hairstyle of the main person in an image. Upload a base portrait image along with a target hairstyle description.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image | file (formData) | Required | Base portrait image whose hairstyle will be changed. |
| hairStyle | string (formData) | Required | Target hairstyle description (e.g. "short bob", "long curly hair", "ponytail"). |
Task Status Endpoint
/api/task-status/{task_id}Get the status of a task and retrieve the processed image URL.
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string (path) | Required | The 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 Code | Description |
|---|---|
| 200 | Successfully retrieved task status. |
| 400 | Bad request. |
| 401 | Unauthorized. |
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
/api/sketch_to_imageGenerate 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
| Name | Type | Required | Description |
|---|---|---|---|
| sketch | file (formData) | Required | Sketch/line-art image to transform into a full image. |
| prompt | string (formData) | Required | Text prompt describing the desired final image. Will be combined with an internal helper prompt for best results. |
Task Status Endpoint
/api/task-status/{task_id}Get the status of a task and retrieve the processed image URL.
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string (path) | Required | The 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 Code | Description |
|---|---|
| 200 | Successfully retrieved task status. |
| 400 | Bad request. |
| 401 | Unauthorized. |
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)