About
This API empowers users to effortlessly explore various hairstyles, experiment with hair colors, and virtually try out different haircuts, all through simple API endpoints.
With the Hair Changer API, developers can enable users to upload their images and apply desired changes to their hairstyles or hair colors in real-time. By leveraging this API, developers can enhance user experiences by providing them with personalized and interactive features related to hair styling.
This API supports essential functionalities such as changing hairstyles, modifying hair colors, and trying virtual haircuts. Developers can integrate these features into a wide range of applications, including virtual makeover apps, beauty salon booking platforms, or fashion styling tools.
Users can access the Hair Changer API securely through authentication using API keys, ensuring data privacy and security. Additionally, the API incorporates rate limits to manage usage and prevent abuse, promoting fair and efficient utilization.
For developers seeking to enhance their applications with hair modification capabilities, the Hair Changer API offers comprehensive documentation, error handling support, and dedicated customer assistance. Get started today and bring dynamic hair styling functionalities to your applications with ease.
Curl Requests and Responses
Process the image
Curl Python PHP NodeJs Javascript
Copy curl -X 'POST' \
'https://api.magicapi.dev/api/v1/magicapi/hair/hair' \
-H 'accept: application/json' \
-H 'x-magicapi-key: API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"image": "https://replicate.delivery/mgxm/b8be17a7-abcb-4421-80f2-e6a1e3fe38c7/MarkZuckerberg.jpg",
"editing_type": "both",
"color_description": "blond",
"hairstyle_description": "hi-top fade hairstyle"
}'
Copy import requests
headers = {
'accept' : 'application/json' ,
'x-magicapi-key' : 'API_KEY' ,
'Content-Type' : 'application/json' ,
}
json_data = {
'image' : 'https://replicate.delivery/mgxm/b8be17a7-abcb-4421-80f2-e6a1e3fe38c7/MarkZuckerberg.jpg' ,
'editing_type' : 'both' ,
'color_description' : 'blond' ,
'hairstyle_description' : 'hi-top fade hairstyle' ,
}
response = requests . post ( 'https://api.magicapi.dev/api/v1/magicapi/hair/hair' , headers = headers, json = json_data)
Copy <? php
$ch = curl_init () ;
curl_setopt ( $ch , CURLOPT_URL , 'https://api.magicapi.dev/api/v1/magicapi/hair/hair' ) ;
curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , true ) ;
curl_setopt ( $ch , CURLOPT_CUSTOMREQUEST , 'POST' ) ;
curl_setopt ( $ch , CURLOPT_HTTPHEADER , [
'accept: application/json' ,
'x-magicapi-key: API_KEY' ,
'Content-Type: application/json' ,
] ) ;
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"image\": \"https://replicate.delivery/mgxm/b8be17a7-abcb-4421-80f2-e6a1e3fe38c7/MarkZuckerberg.jpg\",\n \"editing_type\": \"both\",\n \"color_description\": \"blond\",\n \"hairstyle_description\": \"hi-top fade hairstyle\"\n}");
$response = curl_exec ( $ch ) ;
curl_close ( $ch ) ;
Copy import axios from 'axios' ;
const response = await axios .post (
'https://api.magicapi.dev/api/v1/magicapi/hair/hair' ,
{
'image' : 'https://replicate.delivery/mgxm/b8be17a7-abcb-4421-80f2-e6a1e3fe38c7/MarkZuckerberg.jpg' ,
'editing_type' : 'both' ,
'color_description' : 'blond' ,
'hairstyle_description' : 'hi-top fade hairstyle'
} ,
{
headers : {
'accept' : 'application/json' ,
'x-magicapi-key' : 'API_KEY' ,
'Content-Type' : 'application/json'
}
}
);
Copy fetch ( 'https://api.magicapi.dev/api/v1/magicapi/hair/hair' , {
method : 'POST' ,
headers : {
'accept' : 'application/json' ,
'x-magicapi-key' : 'API_KEY' ,
'Content-Type' : 'application/json'
} ,
body : JSON .stringify ({
'image' : 'https://replicate.delivery/mgxm/b8be17a7-abcb-4421-80f2-e6a1e3fe38c7/MarkZuckerberg.jpg' ,
'editing_type' : 'both' ,
'color_description' : 'blond' ,
'hairstyle_description' : 'hi-top fade hairstyle'
})
});
Copy {
"request_id" : REQUEST_ID
}
Get the result
Curl Python PHP NodeJs Javascript
Copy curl -X 'GET' \
'https://api.magicapi.dev/api/v1/magicapi/hair/predictions/REQUEST_ID' \
-H 'accept: application/json' \
-H 'x-magicapi-key: API_KEY'
Copy import requests
headers = {
'accept' : 'application/json' ,
'x-magicapi-key' : 'API_KEY' ,
}
response = requests . get ( 'https://api.magicapi.dev/api/v1/magicapi/hair/predictions/REQUEST_ID' , headers = headers)
Copy <? php
$ch = curl_init () ;
curl_setopt ( $ch , CURLOPT_URL , 'https://api.magicapi.dev/api/v1/magicapi/hair/predictions/REQUEST_ID' ) ;
curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , true ) ;
curl_setopt ( $ch , CURLOPT_CUSTOMREQUEST , 'GET' ) ;
curl_setopt ( $ch , CURLOPT_HTTPHEADER , [
'accept: application/json' ,
'x-magicapi-key: API_KEY' ,
] ) ;
$response = curl_exec ( $ch ) ;
curl_close ( $ch ) ;
Copy import axios from 'axios' ;
const response = await axios .get ( 'https://api.magicapi.dev/api/v1/magicapi/hair/predictions/REQUEST_ID' , {
headers : {
'accept' : 'application/json' ,
'x-magicapi-key' : 'API_KEY'
}
});
Copy fetch ( 'https://api.magicapi.dev/api/v1/magicapi/hair/predictions/REQUEST_ID' , {
headers : {
'accept' : 'application/json' ,
'x-magicapi-key' : 'API_KEY'
}
});
Copy {
"status" : "succeeded" ,
"result" : "RESULT_URL"
}
Parameters
color_description
would be - purple, red, orange, yellow, green, blue, gray, brown, black, white, blond, pink
hairstyle_description
would be these:
Copy afro hairstyle
bob cut hairstyle
bowl cut hairstyle
braid hairstyle
caesar cut hairstyle
chignon hairstyle
cornrows hairstyle
crew cut hairstyle
crown braid hairstyle
curtained hair hairstyle
dido flip hairstyle
dreadlocks hairstyle
extensions hairstyle
fade hairstyle
fauxhawk hairstyle
finger waves hairstyle
french braid hairstyle
frosted tips hairstyle
full crown hairstyle
harvard clip hairstyle
high and tight hairstyle
hime cut hairstyle
hi-top fade hairstyle
jewfro hairstyle
jheri curl hairstyle
liberty spikes hairstyle
marcel waves hairstyle
mohawk hairstyle
pageboy hairstyle
perm hairstyle
pixie cut hairstyle
psychobilly wedge hairstyle
quiff hairstyle
regular taper cut hairstyle
ringlets hairstyle
shingle bob hairstyle
short hair hairstyle
slicked-back hairstyle
spiky hair hairstyle
surfer hair hairstyle
taper cut hairstyle
the rachel hairstyle
undercut hairstyle
updo hairstyle