# 3D Face Reconstruction

## API METHODS

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

### /run\_pipeline

Getting face texture and head model parameters of 3D head model from photo.

For visualization use [GLB Constructor Service](https://docs.metahumansdk.io/service-apis-for-creating-virtual-avatars/getting-started/glb-constructor).

Model parameters:

<table><thead><tr><th width="281.3333333333333">Parameter</th><th width="95">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>result.face.textureUrl</code></td><td>string</td><td>UV Texture path saved .png file into /static directory.</td></tr><tr><td><code>result.face.blendShapes</code></td><td>list</td><td>Shape blendshapes. List 80 long with float.</td></tr><tr><td><code>result.face.blinkCorrectionCoeff</code></td><td>int</td><td>Coefficient for corrective blink blendshape.</td></tr><tr><td><code>result.hair.color</code></td><td>string</td><td>Hex RGB color code of hair.</td></tr><tr><td><code>result.hair.type</code></td><td>string</td><td>Type of hairstyle (long/short/ponytail and  straight/wavy).</td></tr><tr><td><code>result.gender</code></td><td>string</td><td>Gender class of input image.</td></tr><tr><td><code>result.skin.color</code></td><td>string</td><td>Hex RGB color code of skin.</td></tr><tr><td><code>result.accessories</code></td><td>list</td><td>List of accessories. List of strings.</td></tr></tbody></table>

## Method for 3D Face Reconstruction

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

Getting face texture and head model parameters of 3D head model 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. Supported file formats: JPG, PNG, HEIC. Maximum file size: 10 MB. |

{% tabs %}
{% tab title="200: OK The request is successful" %}

```javascript
{
  "result": {
    "face": {
      "textureUrl": "/static/input_image_texture.png",
      "blendShapes": [
        -1.7523525953292847,
        ...
        1.5906388759613037
      ],
      "blinkCorrectionCoeff": 1.0096107066555675
    },
    "hair": {
      "color": "#160406",
      "type": "long_straight"
    },
    "skin": {
      "color": "#965e53"
    },
    "accessories": [],
    "gender": "Female"
  }
}
```

{% 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 %}

***
