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

# Preview a CSV Mapping

> Parse the stashed CSV's headers + a sample and return auto-detected
column suggestions and the assignable fields for the mapping UI.

Second step of the [CSV import flow](/api-reference/contacts/import-upload-init). Reads the stashed object back (ranged GET, capped at 15 MB — `413` if the actual object is larger than declared), parses headers + the first 5 data rows, and auto-suggests a canonical field for each CSV column by header name (e.g. `"Work Email"` → `email`). Nothing is written yet.

### Auth

Requires a CRM manage [scope](/authentication#scopes) and an active organization on the token. Any `*:manage` scope qualifies — in practice `contacts:manage`, `deals:manage`, `companies:manage`, or `activities:manage`.

### Response

| Field        | Type                                           | Description                                                                                                                                                                                                                      |
| ------------ | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `columns`    | `array` of `{header, suggested}`               | One entry per CSV column. `suggested` is a canonical field key (`email`, `first_name`, `last_name`, `phone`, `title`, `department`, `company`, `company_domain`, `linkedin_url`, `tags`, `notes`) or `null` if no alias matched. |
| `fields`     | `array` of `{key, label, type_hint, identity}` | The canonical fields a CSV column can be mapped to. `identity: true` on `email`, `first_name`, `last_name`, `linkedin_url` — a row needs at least one of these mapped-and-populated to import.                                   |
| `sample`     | `array` of `object`                            | Up to 5 raw data rows, keyed by original CSV header.                                                                                                                                                                             |
| `total_rows` | `integer`                                      | Total data rows in the file (not just the sample).                                                                                                                                                                               |

### Errors

| Status | Cause                                            |
| ------ | ------------------------------------------------ |
| `400`  | `s3_key` isn't under the caller's import prefix. |
| `413`  | Object exceeds 15 MB.                            |
| `422`  | Empty file, or missing a header row.             |


## OpenAPI

````yaml POST /contacts/import/preview
openapi: 3.1.0
info:
  title: anycrm-api
  version: 0.0.1
servers: []
security: []
tags:
  - name: Customer Intelligence
    description: >-
      Company research and ICP-fit scoring — create a research run, track its
      progress, and read back scored companies as leads.
  - name: Outreach
    description: >-
      The cold-email management console — domains, mailboxes, and campaigns — as
      a thin control plane over the SalesForge stack.
  - name: AnyCard
    description: >-
      Authenticated CRUD for AnyCard, the org's digital business-card /
      lead-capture product.
  - name: AnyCard Events
    description: >-
      Event-attribution analytics for AnyCard — which captured leads converted,
      broken down by source, owner, and deal.
  - name: AnyCard Share Links
    description: >-
      Unauthenticated endpoints reached by anyone who scans a QR code or opens a
      shared AnyCard link.
  - name: AI
    description: >-
      A streaming (SSE) AI chat endpoint with account-commit actions it can take
      on the caller's behalf.
  - name: Analytics Assistant
    description: >-
      The natural-language analytics assistant — a guarded text-to-SQL loop
      (SSE) that answers ad-hoc questions over the org's CRM data as a
      least-privilege, read-only database role.
  - name: Account Readiness
    description: >-
      Account Readiness Profiles — AI-scored signals on whether an account is
      ready for outreach or expansion, computed via a Temporal workflow.
  - name: Integrations
    description: >-
      Pipedream Connect — issuing connect tokens and managing the org's
      connected third-party accounts.
  - name: Feedback
    description: >-
      User-submitted platform feedback (bug reports, feature requests) — global,
      not scoped to one organization.
  - name: Public Media
    description: >-
      Unauthenticated image reads for publicly-embeddable assets (card photos,
      inline email images) — allowlisted by key shape; everything else in the
      storage bucket stays private.
  - name: Service Health
    description: Service liveness.
paths:
  /contacts/import/preview:
    post:
      tags:
        - Contacts
      summary: Contact Import Preview
      description: |-
        Parse the stashed CSV's headers + a sample and return auto-detected
        column suggestions and the assignable fields for the mapping UI.
      operationId: contact_import_preview_contacts_import_preview_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactImportPreviewBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Contact Import Preview Contacts Import Preview Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ContactImportPreviewBody:
      properties:
        s3_key:
          type: string
          minLength: 1
          title: S3 Key
          description: The s3_key returned by upload-init.
      type: object
      required:
        - s3_key
      title: ContactImportPreviewBody
      description: Parse a stashed CSV's headers + a sample for the mapping UI.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````