> ## Documentation Index
> Fetch the complete documentation index at: https://docs.get-rial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview a CSV import

> Check a CSV before importing: column mapping, row counts and per-row problems. Changes nothing.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/link-templates/{slug}/import/preview
openapi: 3.1.0
info:
  title: rial API
  version: 0.1.0
  description: 'Prove a photo is real. Base URL: https://api.rial.io'
  contact:
    name: rial-platform team
    url: https://github.com/Rial-ventures-Inc/rial-platform
  license:
    name: UNLICENSED — proprietary, internal use only
servers:
  - url: https://api.rial.io
    description: Production
security: []
tags:
  - name: Verifications
    description: >-
      Create, fetch, list, and finalize verifications. The core of the API —
      every tenant integration starts here.
  - name: Templates
    description: >-
      Publish, update, revoke and inspect link templates — the reusable capture
      links behind `/l/{token}` (a compact JWT carrying the org and template
      slugs; the legacy `/l/{org}/{slug}` keeps resolving). Callable with a
      secret key; each publish snapshots a versioned capture spec (GET-83).
  - name: Databases
    description: >-
      Create, update, inspect and synchronize tenant-scoped databases used by
      reusable verification templates. Callable with a dashboard session or
      secret API key.
paths:
  /v1/link-templates/{slug}/import/preview:
    post:
      tags:
        - Templates
      summary: Preview a CSV import
      description: >-
        Check a CSV before importing: column mapping, row counts and per-row
        problems. Changes nothing.
      parameters:
        - schema:
            type: string
            pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
            description: Template slug — lowercase `[a-z0-9-]`.
            example: warehouse-intake
          required: true
          name: slug
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CsvImportRequest'
            example:
              csv: |
                external_ref
                ci-inso-row-1
                ci-inso-row-2
      responses:
        '200':
          description: >-
            Parse report — resolved mapping, valid/invalid rows, abort
            prediction.
          content:
            application/json:
              schema:
                type: object
                properties:
                  column_mapping:
                    type: object
                    additionalProperties:
                      type: string
                  ignored_columns:
                    type: array
                    items:
                      type: string
                  total_rows:
                    type: integer
                  valid_rows:
                    type: integer
                  invalid_rows:
                    type: array
                    items:
                      type: object
                      properties:
                        row:
                          type: integer
                        reason:
                          type: string
                      required:
                        - row
                        - reason
                      description: >-
                        1-based CSV row (header is row 1) and why it was
                        rejected.
                  invalid_rows_total:
                    type: integer
                  would_abort:
                    type: boolean
                  preview:
                    type: array
                    items:
                      type: object
                      properties:
                        row:
                          type: integer
                        subject:
                          type: object
                          properties: {}
                      required:
                        - row
                        - subject
                required:
                  - column_mapping
                  - ignored_columns
                  - total_rows
                  - valid_rows
                  - invalid_rows
                  - invalid_rows_total
                  - would_abort
                  - preview
              example:
                column_mapping:
                  external_ref: external_ref
                ignored_columns: []
                total_rows: 2
                valid_rows: 2
                invalid_rows: []
                invalid_rows_total: 0
                would_abort: false
                preview:
                  - row: 2
                    subject:
                      person:
                        external_ref: ci-row-1
        '400':
          description: Body failed validation (missing `csv`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No template with that slug for the authenticated tenant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: not_found
                  message: Resource not found
        '422':
          description: CSV unparseable (no mapped columns, malformed).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '503':
          description: The template store is unreachable — retry with backoff.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  cause:
                    type: string
                required:
                  - error
              example:
                error: storage_unavailable
      security:
        - bearerApiKey: []
components:
  schemas:
    CsvImportRequest:
      type: object
      properties:
        csv:
          type: string
          minLength: 1
          description: Raw CSV text, header row first.
        column_mapping:
          type: object
          additionalProperties:
            type: string
          description: Optional explicit header→field mapping when automap falls short.
      required:
        - csv
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            fields:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: string
                  message:
                    type: string
                required:
                  - path
                  - message
          required:
            - code
            - message
      required:
        - error
      description: >-
        Uniform error envelope. `code` is the stable string SDKs branch on
        (`invalid_request`, `unauthorized`, `not_found`, `expired`, `step_full`,
        `unknown_step`, `steps_incomplete`, `already_finalized`,
        `too_many_requests`, `storage_unavailable`, `internal_error`). `fields`
        is only present on `invalid_request` validation failures.
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: rk_secret_<key>
      description: >-
        Secret API key, created in the dashboard under Settings → API. Send it
        as `Authorization: Bearer rk_secret_…` from your server only.
        Publishable keys (`pk_live_…`) are for the native SDKs and reach the
        capture endpoints alone. An unknown key returns 401.

````