---
title: "Preview a transaction file"
method: POST
path: "/v1/imports/contexts/{contextId}/sources/{sourceId}/preview"
tags: ["Ingestion"]
---

# Preview a transaction file

`POST /v1/imports/contexts/{contextId}/sources/{sourceId}/preview`

Use this endpoint to preview a transaction file before importing it. Returns sample rows and detected columns to help verify the file structure and field mapping.

## Path parameters

- `contextId` string, required
- `sourceId` string, required

## Headers

- `X-Request-Id` string
- `X-Idempotency-Key` string

## Response `200`

File preview with detected columns and sample rows.

The response includes the `X-Idempotency-Replayed` header.

If the value is false, the request was just processed. If the value is true, the response is a replay of a previously processed request.

See [Retries and idempotency](/en/reference/retries-idempotency) for more details.

- FilePreviewResponse — Preview of a transaction file showing detected columns and sample data
  - `columns` string[] — Detected column names
  - `sampleRows` array[] — Sample data rows
    - string[]
  - `rowCount` integer — Number of sample rows returned
  - `format` string — Detected file format

## Other responses

- `400` — The request contains invalid parameters or payload.
- `401` — The request lacks valid authentication credentials.
- `403` — You do not have permission to access this resource.
- `404` — Context or source not found
- `500` — An unexpected error occurred on the server.

---

[API](https://skmtc.net/lerian/apis/identity-plugin.md) · [All operations](https://skmtc.net/lerian/apis/identity-plugin/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lerian/identity-plugin/versions/25daba385532/schema)
