First, you'll need to get an access token. Make this request with your email and password:
curl -X POST [<https://api.piktid.com/api/tokens>](<https://api.piktid.com/api/tokens>) \\
-u "your_email:your_password"
The response will contain your access_token
and refresh_token
. Save the first one for subsequent requests.
curl -X POST <https://api.piktid.com/api/upload_pro> \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-F "options={\\"flag_hair\\":true,\\"mode\\":\\"keep\\",\\"flag_sync\\":true}" \\
-F "file=@/path/to/your/image.jpg"
The response will include:
image_id
: Unique identifier for your uploaded image, save it for subsequent requestsfaces
: Object containing:
number_of_faces
: Number of detected facescoordinates_list
: Array of face positions with boxHeight, boxWidth, centerX, centerY
id
: Face ID, non-negative integer, unique identifier for each faceExample response structure:
{
"image_id": "XYZTb1GeKg...", # string, YOUR_IMAGE_ID
"faces": {
"number_of_faces": 1,
"coordinates_list": [{
"id": 0, # face_id, integer, YOUR_FACE_ID
"boxHeight": 0.459,
"boxWidth": 0.298,
"centerX": 0.476,
"centerY": 0.467
}],
"...": ....
}
}
Select on which face apply the change expression. Be sure to match the proper keywords to the desired expression. Available keys and expressions are reported at the end of the page:
curl -X POST <https://api.piktid.com/api/ask_new_expression> \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{
"flag_sync": false,
"id_image": "YOUR_IMAGE_ID",
"id_face": "YOUR_FACE_ID",
"prompt": "{\\"YOUR_KEY\\":\\"YOUR_EXPRESSION\\"}"
}'
Example of proper prompt entries are "{\\"Expression\\":\\"happy\\"}"
or "{\\"Eyes\\":\\"wink_right\\"}"
. We recommend using only one key x generation.
Response will indicate the processing status.
The change expression process is asynchronous. You'll need to poll for notifications (we suggest approx. every 10 s) until the process is complete: