> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2/daf/subida-de-assets.md).

# Asset upload

DAF does not receive files directly: it consumes the assets already loaded in the Facephi storage service, referenced by their `fileKey`. Before starting a validation, upload each asset (document and, optionally, selfie) with the storage Endpoint.

### Endpoint

```
POST /storage
```

### Headers

| Name              | Type   | Required | Description                                                                                                             |
| ----------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| **Authorization** | string | **Yes**  | consumer Token in format `Bearer <token>` (see [Authentication](/docs.facephi-en/rest-api/midapi-v2/autenticacion.md)). |
| **consumer-id**   | string | **Yes**  | Consumer identifier.                                                                                                    |

### Request body

**Content-Type:** `application/json`

#### Parameters

| Parameter       | Type   | Required | Description                                                                                                                                                                                   |
| --------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `operationId`   | string | **Yes**  | Identifier of the operation to which the asset belongs.                                                                                                                                       |
| `asset`         | object | **Yes**  | Asset to save.                                                                                                                                                                                |
| `asset.context` | string | **Yes**  | Type of asset (see the table of types below).                                                                                                                                                 |
| `asset.file`    | string | **Yes**  | Asset content (document or selfie Token), encoded in **Base64**. For `TOKEN_FRONT_DOCUMENT` and `TOKEN_BACK_DOCUMENT` must be the **RAW Token** of the document generated by the capture SDK. |

#### Request example

```json
{
  "operationId": "<operationId>",
  "asset": {
    "context": "TOKEN_FRONT_DOCUMENT",
    "file": "<base64>"
  }
}
```

### Responses

#### `200` Success

#### Response parameters

| Parameter   | Type   | Description                                         |
| ----------- | ------ | --------------------------------------------------- |
| `fileKey`   | string | Asset key in the form `<consumerId>/<operationId>`. |
| `timestamp` | string | Response timestamp in format **ISO 8601**.          |

#### Response example

```json
{
  "fileKey": "<consumerId>/<operationId>",
  "timestamp": "2026-06-26T12:00:00.000Z"
}
```

#### `409` Conflict

An asset of the same type already exists for that `operationId`. There cannot be more than one asset of the same `type` for the same `operationId`.

### Asset types relevant to DAF

| type                   | Content                                                                                                               | Requiredness |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------ |
| `TOKEN_FRONT_DOCUMENT` | **RAW Token** of the front side of the Identity document (e.g. `tokenRawFrontDocument` generated by the capture SDK). | **Required** |
| `TOKEN_BACK_DOCUMENT`  | **RAW Token** of the back side of the Identity document (e.g. `tokenRawBackDocument` generated by the capture SDK).   | Optional     |
| `TOKEN_FACE_IMAGE`     | Selfie of the holder.                                                                                                 | Optional     |

{% hint style="warning" %}
**Important:** the document assets must be the Tokens **RAW** of the front/back, not the processed Tokens. If a non-RAW Token is uploaded, validation cannot be executed and the transaction ends in `FAILED`.
{% endhint %}

{% hint style="info" %}
If it is not provided `TOKEN_FACE_IMAGE`, DAF validates only the document: the signals derived from the selfie (facial comparison) are lost and the diagnosis is based only on the document validations.
{% endhint %}

### Supported documents

* DAF validates **identity documents (ID)** and **passports**.
* For passports, the back side is not required: the front side is enough (`TOKEN_FRONT_DOCUMENT`).
* The specific set of **supported document types and countries/issuers** is defined in the **service registration**; check it with Facephi for your Integration.
* If the document is not supported or its Version cannot be validated, the transaction is resolved as `DECLINED` with the corresponding reason code (see [Result response](/docs.facephi-en/rest-api/midapi-v2/daf/respuesta-de-resultado.md)).

### Requirements and image quality

Capture quality determines whether the document can be validated. To maximize the approval rate:

* **Resolution** recommended minimum: HD (≥ 720×1080 px).
* **Size** maximum per file: 10 MB. Avoid aggressive compression; use the default values of a guided capture Flow.
* **Framing**: the document must appear **complete and without cropping**, occupying most of the frame and with a standard card aspect ratio.
* **Sharpness and lighting**: without blur, without reflections or glare that hide data, and without excessive rotation.
* There cannot be more than one asset of the same `type` for the same `operationId` (a second upload of the same type returns `409 Conflict`).

{% hint style="info" %}
If a capture does not meet these requirements, validation flags it as a **quality/capture issue** (not as fraud): these are the codes of the categories `input` and `integrity` (e.g. 100/101/104/105 and 102/103/106-111/500/501, see [Result response](/docs.facephi-en/rest-api/midapi-v2/daf/respuesta-de-resultado.md#rechazo-por-calidad-vs-deteccion-de-fraude)). In these cases, repeating the capture with better quality usually resolves the issue.
{% endhint %}
