> 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/operations/get-file-keys.md).

# Get File Keys

Service that returns the assets stored in an operation, indexed by context.

This is the recommended way to obtain the keys sent to validation services, instead of storing them on the client.

### Endpoint

```
GET /operation/{operationId}/file-keys
```

### Headers

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

### Path parameters

| Parameter     | Type   | Required | Description           |
| ------------- | ------ | -------- | --------------------- |
| `operationId` | string | **Yes**  | Operation identifier. |

### Responses

#### `200` Success

#### Response parameters

| Parameter           | Type   | Description                                                                                                                                                                                |
| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `operationId`       | string | Operation identifier.                                                                                                                                                                      |
| `merchantReference` | string | The reference provided when [creating the operation](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2/operations/create-operation.md). It is not included if none was provided. |
| `fileKeys`          | object | Object indexed by context, where each value is the asset key for that context. Contexts with no stored asset are not included.                                                             |

#### Response example

```json
{
  "operationId": "0192a3f4-7b21-7c44-9e1a-3f5b8c2d1e04",
  "merchantReference": "ORD-4417",
  "fileKeys": {
    "TOKEN_FRONT_DOCUMENT": "0192a3f4-7b21-7c44-9e1a-3f5b8c2d1e04/TOKEN_FRONT_DOCUMENT",
    "TOKEN_BACK_DOCUMENT": "0192a3f4-7b21-7c44-9e1a-3f5b8c2d1e04/TOKEN_BACK_DOCUMENT",
    "TOKEN_BEST_IMAGE": "0192a3f4-7b21-7c44-9e1a-3f5b8c2d1e04/TOKEN_BEST_IMAGE",
    "TOKEN_RAW_IMAGE": "0192a3f4-7b21-7c44-9e1a-3f5b8c2d1e04/TOKEN_RAW_IMAGE"
  }
}
```

An asset uploaded with the context `RAW_IMAGE` appears here under `TOKEN_RAW_IMAGE`, which is the context under which it is stored. See [Asset contexts](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2/storage.md#contextos-de-asset).

{% hint style="info" %}
`merchantReference` is returned to reconcile the operation with your own system. It is not a query criterion: this route is addressed by `operationId`.
{% endhint %}

#### Other responses

| Code  | Description                                                                                                                                                                                       |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `401` | Token is missing, invalid, or expired.                                                                                                                                                            |
| `403` | The consumer is not provisioned for the `OPERATION`.                                                                                                                                              |
| `404` | The operation does not exist or belongs to another consumer.                                                                                                                                      |
| `410` | The operation specified in `operation-id` has expired.                                                                                                                                            |
| `429` | The consumer has exceeded its request rate limit. The response includes `Retry-After` with the wait time in seconds, and `X-RateLimit-Limit` and `X-RateLimit-Burst` with the current thresholds. |
| `503` | The service is temporarily unavailable.                                                                                                                                                           |

The body of an error response has the form described in [Middleware API v2](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2.md#respuestas-de-error).
