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

# CSV Preview

> Parses CSV content and returns headers and a preview of rows for
column mapping before confirming the import.
Requires `leads:import` permission.




## OpenAPI

````yaml POST /api/leads/upload/preview
openapi: 3.1.0
info:
  title: Naturalead Leads API
  version: 1.0.0
  description: |
    API for managing leads in the Naturalead platform. All endpoints require
    API key authentication and are scoped to the caller's account.
servers:
  - url: '{baseUrl}'
    description: API server
    variables:
      baseUrl:
        default: http://localhost:3001
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Leads
    description: Lead CRUD, search, filtering, and bulk operations
paths:
  /api/leads/upload/preview:
    post:
      tags:
        - Leads
      summary: Preview CSV upload
      description: |
        Parses CSV content and returns headers and a preview of rows for
        column mapping before confirming the import.
        Requires `leads:import` permission.
      operationId: csvPreview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                content:
                  type: string
                  description: Raw CSV content
              required:
                - content
      responses:
        '200':
          description: CSV preview
          content:
            application/json:
              schema:
                type: object
                properties:
                  headers:
                    type: array
                    items:
                      type: string
                  previewRows:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
                  totalRows:
                    type: integer
                required:
                  - headers
                  - previewRows
                  - totalRows
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            required:
              - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key prefixed with `nl_live_` or `nl_test_`
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer token using an API key (format nl_live_* or nl_test_*)

````