# 3D Hair Reconstruction

## API METHODS

| HTTP type |               name              |
| --------- | :-----------------------------: |
| POST      | [/run\_pipeline](#run_pipeline) |

### /run\_pipeline

Reconstruction 3D hair model in GLB format from photo.

Some details about hair model:

* number of vertices
  * in ***volume*** mode: from 10000 to 20000
  * in ***card*** mode: from 15000 to 25000
* material
  * in ***volume*** mode: base color from photo
  * in ***card*** mode: UV texture
* location and scale: corresponds to the head from [GLB Constructor Service](https://docs.metahumansdk.io/service-apis-for-creating-virtual-avatars/getting-started/glb-constructor)
* blendshapes: *coming soon*

## Method for 3D Hair Reconstruction

<mark style="color:green;">`POST`</mark> `https://api.metahumansdk.io/hair_recon/run_pipeline`

Reconstruction 3D hair model in GLB format from photo.

#### Request Body

| Name                                           | Type   | Description                                                                                                                                        |
| ---------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| token<mark style="color:red;">\*</mark>        | string | Registered token.                                                                                                                                  |
| image\_bytes<mark style="color:red;">\*</mark> | binary | Photo of a person in full face or half a turn, in which hair is clearly visible. Supported file formats: JPG, PNG, HEIC. Maximum file size: 10 MB. |
| mode                                           | string | Hair reconstruction mode: 'card' or 'volume'. Mode 'card' is used by default.                                                                      |
| hair\_color                                    | string | Custom hair color as hex triplet. Default color is predicted from photo.                                                                           |

{% tabs %}
{% tab title="200: OK the request is successful, a file with GLB model will be returned" %}

```javascript
string($binary)
```

{% endtab %}

{% tab title="422: Unprocessable Entity Error while processing" %}

```
{
    "error": {
            "code": int
            "message": str
    }
}
```

Check in [ERRORS](https://docs.metahumansdk.io/service-apis-for-creating-virtual-avatars/errors/3d-face-reconstruction) section for possible error response examples.
{% endtab %}
{% endtabs %}
