# AI Hair Frizziness Detection

# Overview
180° Full View Hair Frizz Analysis with Just 3 Photos

Our AI Frizzy Hair Analyzer delivers precise hair frizz analysis in seconds by simply uploading 3 photos—front, left, and right views of the hair.

This efficient process delivers accurate results in seconds, enabling businesses to offer tailored hair solutions and defrizz hair products based on hair frizz levels, without the need for time-consuming in-person consultations, complicated hair quizzes, or specialized hardware installations.
![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/hair_frizzy_S_02_enu_b80c238858.jpg)

## Integration Guide

1. **Upload a Selfie**
  You can provide the source image in one of two ways:

  - **Use an Existing Public Image URL**
    Instead of uploading, you may supply a publicly accessible image URL directly when initiating the AI task.

  - **Upload via File API**
    Use the endpoint:
    ```
    POST /s2s/v2.0/file/hair-frizziness-detection
    ```
    This returns a `file_id` for subsequent task execution.

    - ***Important***: Simply calling the File API does not upload your file. You must **manually upload** the file to the **URL provided in the File API response**. That URL is your upload destination, make sure the file is successfully transferred there before proceeding.

    Before calling the AI API, ensure your file has been successfully uploaded. Use the File API to retrieve an upload URL, then upload your file to that location. Once the upload is complete, you'll receive a ***file_id*** in the response, this ID is what you'll use to access AI features related to that file.

      > **Warning:** Please note that, you will get an 500 Server Error / unknown_internal_error or 404 Not Found error when using AI APIs if you do not upload the file to the URL provided in the File API response.

2.  **Run an AI Task to Obtain a Task ID**
    Execute the AI task using /s2s/v2.0/task/hair-frizziness-detection. For the target user image, provide either ``src_file_url`` or ``src_file_id``. And a stype ``template_id`` to apply and obtain a ``task_id``.

3.  **Poll to Check the Status of a Task Until It Succeeds or Fails**
    Use the ``task_id`` to monitor the task status by polling GET /s2s/v2.0/task/hair-frizziness-detection to retrieve the current engine status. Until the engine completes the task, the status will remain as running, and no units will be consumed during this stage.
    You can also implement a webhook to receive notifications when an AI task succeeds or fails. Refer to the **[Webhook](../../../../develop/webhook)** section for details.

    > **Warning:** Polling to check the status of a task within its retention period is mandatory. A task will time out if there is no polling request within the retention period, even if the task is processed successfully. Your units will still be consumed.

    > **Warning:** You will receive an InvalidTaskId error if you check the status of a timed-out task. Therefore, once you run an AI task, you must poll to check the status within the retention period until the status becomes either success or error.

4.  **Retrieve the Result of an AI Task Once Successful**
    The task status will change to success after the engine processes your input file and generates the resulting image. You will receive a URL for the processed image.

## Inputs & Outputs
* Input format
![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/hair_frizzy_step_01_ac5c651ea4.png)
Upload 3 photos - front, left, and right views of the hair.
You can utilize the JS Camera Kit to implement a Javascript camera module to take 3 qualified photos.


* Output format
AI Frizzy Hair Analyzer assesses hair types and identifies 4 distinct degrees of hair frizz - from smooth hair to extremely frizzy hair, offering precise insights into hair frizz condition.

| **Mapping (0–3)** | **Term**            | **Description**                                           |
| ----------------- | ------------------- | --------------------------------------------------------- |
| 0             | Not Frizzy      | Hair appears smooth with minimal or no visible frizz.     |
| 1            | Slightly Frizzy | Light frizz visible; mild surface texture irregularities. |
| 2             | Frizzy         | Noticeable frizz across hair; clear texture disruption.   |
| 3             | Extreme Frizzy  | Strong, widespread frizz; highly irregular hair texture.  |

![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/hair_frizzy_S_01_enu_fcd10905ff.jpg)

* Sample Output
```json
{
  "mapping": 1, // number; the key to map of result, alternatives: [0, 1, 2, 3]
  "term": "Slightly Frizzy" // string; 1-1 map to the "mapping", alternatives: ["Not Frizzy", "Slightly Frizzy", "Frizzy", "Extreme Frizzy"]
}
```

## File Specs & Errors
* Supported Formats & Dimensions

|Type|Supported Dimensions|Supported File Size|Supported Formats|
|  ----  | ----  | ----  | ----  |
|AI Hair Frizziness Detection|The image must be at least 320 pixels wide and tall, and no more than 4096 pixels in either dimension. If one side of your image is longer than 1080 pixels, it will be resized automatically to fit within that limit for analysis.|< 10MB|jpg/png|

* Error Codes

|Error Code|Description|
|  ----  | ----  |
|error_mismatch_image_size|Make sure all your face photos (front, left, and right) are the same size|
|error_below_min_image_size|If your image is smaller than 320 pixels in width or height, it's too small to use|
|error_face_position_invalid|Your face needs to be fully visible in the image, without any parts cut off|
|error_face_position_too_small|The face in your photo is too small to analyze properly|
|error_face_position_out_of_boundary|Your face is either too large or partially outside the edges of the photo|
|error_insufficient_lighting|The lighting is too dim, which makes analysis difficult|
|error_face_angle_invalid|Your face angle isn't quite right. For front-facing shots, keep your head within 10 degrees of straight. For side-facing shots, the angle should be more than 15 degrees|

* Environment & Dependency

| Sample Code Language / Tool | Recommended Runtime Versions |
|---|---|
| cURL | - bash >= 3.2</br>   - curl >= 7.58 (modern TLS/HTTP support)</br>   - jq >= 1.6 (robust JSON parsing) |
| Node.js (JavaScript) | Node >= 18 (for global fetch) |
| JavaScript | - Chrome / Edge >= 80</br>   - Firefox >= 74</br>   - Safari >= 13.1 |
| PHP | PHP >= 7.4 (for modern TLS/compat), ext-curl (recommended) or allow_url_fopen=On + ext-openssl, ext-json |
| Python | Python >= 3.10 (for f-strings), requests >= 2.20.0 |
| Java | Java 11+ (for HttpClient), Jackson Databind >= 2.12.0 |

---

## JS Camera Kit
{% partial file="/_partials/js-camera-kit.md" /%}


License: Privacy policy

## Servers

```
https://yce-api-01.makeupar.com
```

## Security

### BearerAuthenticationV2

Use the standard 'Bearer authentication'. Put your 'API Key' in header: `Authorization:Bearer YOUR_API_KEY`. Notice that there is ' ' a space between 'Bearer' and the 'YOUR_API_KEY'.

Type: http
Scheme: bearer

## Download OpenAPI description

[AI Hair Frizziness Detection](https://docs.perfectcorp.com/_bundle/reference/ai_hair_frizziness_detection.yaml)

## V1.0

AI Hair Frizziness Detection API allows you to detect the frizziness of hair in images using three-angle input (front, right, left).

### Create a new file.

 - [POST /s2s/v2.0/file/hair-frizziness-detection](https://docs.perfectcorp.com/reference/ai_hair_frizziness_detection/v1.0/paths/~1s2s~1v2.0~1file~1hair-frizziness-detection/post.md): To upload a new file, you'll first need to use the File API. It will give you a URL – use that URL to upload your file. Once the upload is finished, you can use the file_id from the same response to start using our AI features.

### Run an Hair Frizziness Detection task.

 - [POST /s2s/v2.0/task/hair-frizziness-detection](https://docs.perfectcorp.com/reference/ai_hair_frizziness_detection/v1.0/paths/~1s2s~1v2.0~1task~1hair-frizziness-detection/post.md): Please refer to the polling guide for checking task status.

### Check an Hair Frizziness Detection task status.

 - [GET /s2s/v2.0/task/hair-frizziness-detection/{task_id}](https://docs.perfectcorp.com/reference/ai_hair_frizziness_detection/v1.0/paths/~1s2s~1v2.0~1task~1hair-frizziness-detection~1%7Btask_id%7D/get.md)

