> 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/api-rest/identity-api/identity-api-reference/country-integrations/chile/previred/get-previred-token.md).

# Get Previred Token

Servicio que recupera el token de autenticación TVI y la URL de descarga del documento de evidencia PDF generado durante el proceso de verificación con Previred.

### Endpoint

```
GET /services/previred/{transactionId}
```

### Headers

| Nombre        | Tipo   | Requerido | Descripción                        |
| ------------- | ------ | --------- | ---------------------------------- |
| **x-api-key** | string | **Sí**    | API key de autorización de acceso. |

### Parámetros de ruta

| Parámetro       | Tipo   | Requerido | Descripción                                                             |
| --------------- | ------ | --------- | ----------------------------------------------------------------------- |
| `transactionId` | string | **Sí**    | ID de transacción retornado por el endpoint de creación de transacción. |

### Respuestas

#### `200` Éxito

#### Parámetros de respuesta

| Parámetro       | Tipo    | Descripción                                                        |
| --------------- | ------- | ------------------------------------------------------------------ |
| `timestamp`     | integer | Marca de tiempo Unix de la respuesta en segundos.                  |
| `transactionId` | string  | ID de transacción vinculado al proceso de generación de evidencia. |
| `token`         | string  | Token de autenticación TVI.                                        |
| `url`           | string  | URL para descargar el documento de evidencia PDF de verificación.  |

#### Ejemplo de respuesta

```json
{
  "timestamp": 1709708084,
  "transactionId": "0fec0e8d-3ef3-477f-ae9e-e350cda74b33",
  "token": "VI19:yCQAnOEPolfgPg5rSG8Px1Ism2DMKgyaWc1pqvYsz5vTx1E7nEAfh1oOrOa59...",
  "url": "https://api.identity-platform.io/services/custody/download?token=eyJhbG..."
}
```

#### `400` Bad Request

```json
{
  "status": 400,
  "title": "Bad Request",
  "detail": "Invalid request.",
  "type": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400",
  "errors": []
}
```

#### `401` Unauthorized

```json
{
  "message": "Unauthorized"
}
```

#### `403` Forbidden

```json
{
  "Message": "User is not authorized to access this resource with an explicit deny"
}
```

#### `404` Not Found

```json
{
  "status": 404,
  "title": "Not Found",
  "detail": "Transaction not found.",
  "type": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404"
}
```

#### `502` Bad Gateway

```json
{
  "status": 502,
  "title": "Bad Gateway",
  "detail": "Server got an invalid response.",
  "type": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502"
}
```

#### `504` Gateway Timeout

```json
{
  "message": "Endpoint request timed out"
}
```
