> ## Documentation Index
> Fetch the complete documentation index at: https://sure-917046f5-mintlify-docs-update-1787365945657.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate import content without creating an import

> Validate CSV or Sure NDJSON import content and return counts, headers, warnings, and validation errors without persisting an import or enqueueing jobs. CSV content is limited to 10MB.



## OpenAPI

````yaml /openapi.yaml post /api/v1/imports/preflight
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation generated from executable request specs.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/imports/preflight:
    post:
      tags:
        - Imports
      summary: Validate import content without creating an import
      description: >-
        Validate CSV or Sure NDJSON import content and return counts, headers,
        warnings, and validation errors without persisting an import or
        enqueueing jobs. CSV content is limited to 10MB.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                raw_file_content:
                  type: string
                  description: >-
                    Raw CSV or Sure NDJSON content as a string. CSV content is
                    limited to 10MB.
                type:
                  type: string
                  enum:
                    - TransactionImport
                    - TradeImport
                    - AccountImport
                    - MintImport
                    - ActualImport
                    - YnabImport
                    - CategoryImport
                    - RuleImport
                    - MerchantImport
                    - PdfImport
                    - QifImport
                    - SureImport
                  description: Import type to validate (defaults to TransactionImport)
                account_id:
                  type: string
                  format: uuid
                  description: Account ID used for account-scoped CSV import validation
                date_col_label:
                  type: string
                  description: CSV imports only. Header name for the date column
                amount_col_label:
                  type: string
                  description: CSV imports only. Header name for the amount column
                name_col_label:
                  type: string
                  description: >-
                    CSV imports only. Header name for the transaction name
                    column
                category_col_label:
                  type: string
                  description: CSV imports only. Header name for the category column
                tags_col_label:
                  type: string
                  description: CSV imports only. Header name for the tags column
                notes_col_label:
                  type: string
                  description: CSV imports only. Header name for the notes column
                account_col_label:
                  type: string
                  description: CSV imports only. Header name for the account column
                qty_col_label:
                  type: string
                  description: CSV trade imports only. Header name for the quantity column
                ticker_col_label:
                  type: string
                  description: CSV trade imports only. Header name for the ticker column
                price_col_label:
                  type: string
                  description: CSV trade imports only. Header name for the price column
                entity_type_col_label:
                  type: string
                  description: CSV imports only. Header name for the entity type column
                currency_col_label:
                  type: string
                  description: CSV imports only. Header name for the currency column
                exchange_operating_mic_col_label:
                  type: string
                  description: >-
                    CSV trade imports only. Header name for the exchange
                    operating MIC column
                date_format:
                  type: string
                  description: CSV imports only. Date format pattern
                number_format:
                  type: string
                  enum:
                    - 1,234.56
                    - 1.234,56
                    - 1 234,56
                    - 1,234
                  description: CSV imports only. Number format for parsing amounts
                signage_convention:
                  type: string
                  enum:
                    - inflows_positive
                    - inflows_negative
                  description: CSV imports only. How to interpret positive/negative amounts
                col_sep:
                  type: string
                  enum:
                    - ','
                    - ;
                  description: CSV imports only. Column separator
                rows_to_skip:
                  type: integer
                  minimum: 0
                  description: >-
                    CSV imports only. Number of leading rows to skip before
                    reading headers
                amount_type_strategy:
                  type: string
                  enum:
                    - signed_amount
                    - custom_column
                  description: CSV imports only. Amount parsing strategy
                amount_type_inflow_value:
                  type: string
                  description: >-
                    CSV imports only. Column value that marks an amount as an
                    inflow when using custom_column strategy
          multipart/form-data:
            schema:
              type: object
              properties:
                raw_file_content:
                  type: string
                  description: >-
                    Raw CSV or Sure NDJSON content as a string. CSV content is
                    limited to 10MB.
                file:
                  type: string
                  format: binary
                  description: >-
                    CSV or Sure NDJSON upload when using multipart/form-data.
                    CSV files are limited to 10MB.
                type:
                  type: string
                  enum:
                    - TransactionImport
                    - TradeImport
                    - AccountImport
                    - MintImport
                    - ActualImport
                    - YnabImport
                    - CategoryImport
                    - RuleImport
                    - MerchantImport
                    - PdfImport
                    - QifImport
                    - SureImport
                  description: Import type to validate (defaults to TransactionImport)
                account_id:
                  type: string
                  format: uuid
                  description: Account ID used for account-scoped CSV import validation
                date_col_label:
                  type: string
                  description: CSV imports only. Header name for the date column
                amount_col_label:
                  type: string
                  description: CSV imports only. Header name for the amount column
                name_col_label:
                  type: string
                  description: >-
                    CSV imports only. Header name for the transaction name
                    column
                category_col_label:
                  type: string
                  description: CSV imports only. Header name for the category column
                tags_col_label:
                  type: string
                  description: CSV imports only. Header name for the tags column
                notes_col_label:
                  type: string
                  description: CSV imports only. Header name for the notes column
                account_col_label:
                  type: string
                  description: CSV imports only. Header name for the account column
                qty_col_label:
                  type: string
                  description: CSV trade imports only. Header name for the quantity column
                ticker_col_label:
                  type: string
                  description: CSV trade imports only. Header name for the ticker column
                price_col_label:
                  type: string
                  description: CSV trade imports only. Header name for the price column
                entity_type_col_label:
                  type: string
                  description: CSV imports only. Header name for the entity type column
                currency_col_label:
                  type: string
                  description: CSV imports only. Header name for the currency column
                exchange_operating_mic_col_label:
                  type: string
                  description: >-
                    CSV trade imports only. Header name for the exchange
                    operating MIC column
                date_format:
                  type: string
                  description: CSV imports only. Date format pattern
                number_format:
                  type: string
                  enum:
                    - 1,234.56
                    - 1.234,56
                    - 1 234,56
                    - 1,234
                  description: CSV imports only. Number format for parsing amounts
                signage_convention:
                  type: string
                  enum:
                    - inflows_positive
                    - inflows_negative
                  description: CSV imports only. How to interpret positive/negative amounts
                col_sep:
                  type: string
                  enum:
                    - ','
                    - ;
                  description: CSV imports only. Column separator
                rows_to_skip:
                  type: integer
                  minimum: 0
                  description: >-
                    CSV imports only. Number of leading rows to skip before
                    reading headers
                amount_type_strategy:
                  type: string
                  enum:
                    - signed_amount
                    - custom_column
                  description: CSV imports only. Amount parsing strategy
                amount_type_inflow_value:
                  type: string
                  description: >-
                    CSV imports only. Column value that marks an amount as an
                    inflow when using custom_column strategy
      responses:
        '200':
          description: import content preflighted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportPreflightResponse'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: missing or invalid content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    ImportPreflightResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/ImportPreflight'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
        errors:
          type: array
          items:
            type: string
          nullable: true
          description: >-
            Validation error messages (alternative to details used by trades,
            valuations, etc.)
    ImportPreflight:
      type: object
      required:
        - type
        - valid
        - content
        - stats
        - errors
        - warnings
      properties:
        type:
          type: string
          enum:
            - TransactionImport
            - TradeImport
            - AccountImport
            - MintImport
            - ActualImport
            - YnabImport
            - CategoryImport
            - RuleImport
            - MerchantImport
            - PdfImport
            - QifImport
            - SureImport
        valid:
          type: boolean
        content:
          $ref: '#/components/schemas/ImportPreflightContent'
        stats:
          $ref: '#/components/schemas/ImportPreflightStats'
        headers:
          type: array
          items:
            type: string
          nullable: true
        required_headers:
          type: array
          items:
            type: string
          nullable: true
        missing_required_headers:
          type: array
          items:
            type: string
          nullable: true
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ImportPreflightError'
        warnings:
          type: array
          items:
            type: string
    ImportPreflightContent:
      type: object
      required:
        - filename
        - content_type
        - byte_size
      properties:
        filename:
          type: string
        content_type:
          type: string
        byte_size:
          type: integer
          minimum: 0
    ImportPreflightStats:
      type: object
      required:
        - rows_count
      properties:
        rows_count:
          type: integer
          minimum: 0
          description: CSV parsed non-header rows, or nonblank Sure NDJSON lines.
        valid_rows_count:
          type: integer
          minimum: 0
          description: SureImport only. Valid NDJSON records.
        invalid_rows_count:
          type: integer
          minimum: 0
          description: >-
            SureImport only. Invalid NDJSON records. CSV malformed content
            returns a 422 instead.
        entity_counts:
          type: object
          additionalProperties:
            type: integer
          nullable: true
        record_type_counts:
          type: object
          additionalProperties:
            type: integer
          nullable: true
    ImportPreflightError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.

````