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

# Sube un archivo (CSV/XLSX en base64) y crea un borrador de importación (08 §Paso 1)



## OpenAPI

````yaml /openapi/v1.json post /v1/imports
openapi: 3.0.0
info:
  title: Finzaria API
  description: >-
    API REST de Finzaria — finanzas personales para México, dev-first y
    agent-first. Autentícate con tu API key bxm_ (o un token OAuth).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.finzaria.com/v1
    description: Producción
security: []
tags: []
paths:
  /v1/imports:
    post:
      tags:
        - imports
      summary: >-
        Sube un archivo (CSV/XLSX en base64) y crea un borrador de importación
        (08 §Paso 1)
      operationId: ImportsController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateImportDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportViewDto'
      security:
        - bearer: []
components:
  schemas:
    CreateImportDto:
      type: object
      properties:
        accountId:
          type: string
          description: Cuenta destino.
        filename:
          type: string
          example: estado-cuenta-julio.csv
        content:
          type: string
          description: Contenido del archivo en base64 (CSV o XLSX).
      required:
        - accountId
        - filename
        - content
    ImportViewDto:
      type: object
      properties:
        id:
          type: string
        accountId:
          type: string
        filename:
          type: string
        status:
          type: string
          enum:
            - draft
            - committed
            - undone
        mapping:
          type: object
          additionalProperties: true
        columns:
          type: array
          items:
            $ref: '#/components/schemas/ImportColumnDto'
        rows:
          type: array
          items:
            type: object
            additionalProperties: true
        newCategories:
          type: array
          items:
            $ref: '#/components/schemas/ImportNewCategoryDto'
        stats:
          $ref: '#/components/schemas/ImportStatsDto'
        detected:
          type: object
          description: Encoding/delimitador detectados y filas de preámbulo saltadas.
          additionalProperties: true
      required:
        - id
        - accountId
        - filename
        - status
        - mapping
        - columns
        - rows
        - newCategories
        - stats
        - detected
    ImportColumnDto:
      type: object
      properties:
        index:
          type: number
        header:
          type: string
        samples:
          description: Primeros valores de la columna (muestra).
          type: array
          items:
            type: string
        field:
          type: string
          description: Campo destino sugerido/confirmado.
      required:
        - index
        - header
        - samples
        - field
    ImportNewCategoryDto:
      type: object
      properties:
        name:
          type: string
        count:
          type: number
      required:
        - name
        - count
    ImportStatsDto:
      type: object
      properties:
        total:
          type: number
        ready:
          type: number
        errors:
          type: number
        duplicates:
          type: number
        excluded:
          type: number
      required:
        - total
        - ready
        - errors
        - duplicates
        - excluded
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT (Supabase Auth)
      type: http

````