Catering to various startups and businesses
Let users test your color shades to see how they look on them before they buy.

import requests
url = 'https://api.lightxeditor.com/external/api/v2/haircolor/'
headers = {
'Content-Type': 'application/json',
'x-api-key': '<Insert your API Key>' # Replace with your actual API key
}
data = {
"imageUrl": "https://example.com/your-image.jpg", // Replace with the URL of your input image
"textPrompt": "YourInputPrompt" // Replace with your hair color prompt
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code)
print(response.json())
# Check if the request was successful
if response.status_code == 200:
print("Request was successful!")
print(response.json())
else:
print(f"Request failed with status code: {response.status_code}")
print(response.text)
const fetch = require('node-fetch'); // If using Node.js
const url = 'https://api.lightxeditor.com/external/api/v2/haircolor/';
const headers = {
'Content-Type': 'application/json',
'x-api-key': '<Insert your API Key>' // Replace with your actual API key
};
const data = {
imageUrl: 'https://example.com/your-image.jpg', // Replace with the URL of your input image
textPrompt: 'YourInputPrompt' // Replace with your hair color prompt
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
console.log('Success:', result);
})
.catch(error => {
console.error('Error:', error);
});
}
import Foundation
let url = URL(string: "https://api.lightxeditor.com/external/api/v2/haircolor/")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("<Insert your API Key>", forHTTPHeaderField: "x-api-key") // Replace with your actual API key
let parameters: [String: Any] = [
"imageUrl": "https://example.com/your-image.jpg", // Replace with the URL of your input image
"textPrompt": "YourInputPrompt" // Replace with your hair color prompt
]
do {
request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: [])
} catch {
print("Failed to encode JSON: \(error)")
return
}
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: \(error)")
return
}
guard let data = data else {
print("No data received.")
return
}
do {
if let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
print("Response JSON:", json)
}
} catch {
print("Failed to decode JSON: \(error)")
}
}
task.resume()
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject
import java.io.IOException
fun main() {
val client = OkHttpClient()
val json = JSONObject().apply {
put("imageUrl", "https://example.com/your-image.jpg") // Replace with the URL of your input image
put("textPrompt", "YourInputPrompt") // Replace with your hair color prompt
}
val mediaType = "application/json; charset=utf-8".toMediaTypeOrNull()
val requestBody = json.toString().toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.lightxeditor.com/external/api/v2/haircolor/")
.addHeader("Content-Type", "application/json")
.addHeader("x-api-key", "<Insert your API Key>") // Replace with your API key
.post(requestBody)
.build()
client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
println("Request failed: ${e.message}")
}
override fun onResponse(call: Call, response: Response) {
response.use {
if (!it.isSuccessful) {
println("Unexpected code: ${it.code}")
} else {
println("Response: ${it.body?.string()}")
}
}
}
})
}
Method- Post
curl --location 'https://api.lightxeditor.com/external/api/v2/haircolor/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <Insert your API Key>' \
--data '{
"imageUrl": "https://example.com/your-image.jpg", // Replace with the URL of your input image
"textPrompt": "YourInputPrompt" // Replace with your hair color prompt
}'
Choose your plan
Explore a variety of pricing plans designed to meet your unique requirements. Find the perfect fit and start today.
Automatic hair detection, realistic color simulation
LightX’s Hair Color Changer API detects hair automatically without the need to manual masking. It then uses guided inpainting to add the desired color onto the hair. It not only blends the new color naturally but also keeps the rest of the image intact, giving hyper-realistic results in mere seconds.

Two-way input: Image upload & color prompt
This API has two inputs: users upload their photos, and then write a prompt specifying the color they Canwant. The prompt can be a single color, multiple shades, a two-tone shade, or highlights.
On the backend, you can fully customize the API by adding your own branded color options, allowing the end users to try specific shades in one click.

No data storage or used for training
LightX ensures the privacy of both inputs and outputs. We do not store any data or use it for training purposes. All user inputs (images and prompts) are automatically deleted after 24 hours, and the generated outputs are never saved.

Start with Free Credits
Get started with LightX APIs today! Receive 25 free credits instantly on API signup – no credit card required
Frequently Asked Questions
Get the detailed pricing of all our APIs on the Pricing Page.
Still Unsure? Allow Us To Assist You!
Write to us and we'd love to understand your requirements