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

# Change the CSV mapping

> Re-reads a CSV batch under review with a different mapping and returns a new preview; the rows endpoint then
serves the re-read rows. The mapping must name a date column and an amount column (or debit and credit
columns), and no column may feed two fields. A `counterparty_account` column is accepted and ignored.



## OpenAPI

````yaml /openapi/v1.json put /finance/accounts/{accountId}/imports/{importId}/mapping
openapi: 3.2.0
info:
  title: Synci
  version: '1.0'
  description: >-
    Synci is a platform for integrating financial accounts with your favorite
    apps.
servers:
  - url: https://api.synci.io/api/v1
security:
  - oauth2: []
  - http: []
tags:
  - name: Finance
    kind: nav
  - name: Connections
    parent: Finance
  - name: Accounts
    parent: Finance
  - name: Transactions
    parent: Finance
  - name: Institutions
    parent: Finance
  - name: Destinations
    kind: nav
  - name: YNAB
    parent: Destinations
  - name: Lunch Money
    parent: Destinations
  - name: Google Sheets
    parent: Destinations
  - name: SimpleFIN
    parent: Destinations
  - name: Notion
    parent: Destinations
  - name: Account
    kind: nav
  - name: Webhooks
    parent: Account
  - name: User
    parent: Account
  - name: rule-engine
    summary: Rules
    kind: nav
  - name: Rules
    parent: rule-engine
  - name: Rule Logs
    parent: rule-engine
  - name: Transfers
    kind: nav
  - name: Transfer Links
    parent: Transfers
  - name: Transfer Logs
    parent: Transfers
paths:
  /finance/accounts/{accountId}/imports/{importId}/mapping:
    put:
      tags:
        - Imports
      summary: Change the CSV mapping
      description: >-
        Re-reads a CSV batch under review with a different mapping and returns a
        new preview; the rows endpoint then

        serves the re-read rows. The mapping must name a date column and an
        amount column (or debit and credit

        columns), and no column may feed two fields. A `counterparty_account`
        column is accepted and ignored.
      operationId: financial.accounts.imports.mapping.update
      parameters:
        - name: accountId
          in: path
          required: true
          description: The financial account ID
          schema:
            type: integer
        - name: importId
          in: path
          required: true
          description: The import batch ID
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateImportMappingRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    const: Mapping applied.
                  data:
                    $ref: '#/components/schemas/ImportBatchResource'
                required:
                  - message
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '409':
          description: ''
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      message:
                        type: string
                        const: >-
                          The mapping can only be changed while the import is
                          under review.
                    required:
                      - message
                  - type: object
                    properties:
                      message:
                        type: string
                        const: Only a CSV import has a column mapping.
                    required:
                      - message
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    UpdateImportMappingRequest:
      type: object
      properties:
        mapping:
          type: object
          properties:
            delimiter:
              type: string
              enum:
                - ','
                - ;
                - "\t"
                - '|'
            encoding:
              type:
                - string
                - 'null'
              maxLength: 32
            has_header:
              type: boolean
            date_format:
              type: string
              pattern: '[DMY]'
              maxLength: 32
            number_format:
              type: object
              properties:
                decimal_separator:
                  type: string
                  enum:
                    - .
                    - ','
                thousands_separator:
                  type:
                    - string
                    - 'null'
                  enum:
                    - ''
                    - ','
                    - .
                    - ' '
                    - ''''
                    - null
                sign_convention:
                  $ref: '#/components/schemas/SignConventionEnum'
              required:
                - decimal_separator
                - thousands_separator
                - sign_convention
            columns:
              type: object
              properties:
                booking_date:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                value_date:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                amount:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                debit:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                credit:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                description:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                counterparty_name:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                external_id:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                balance_after:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                currency:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                source_currency:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                status:
                  type:
                    - integer
                    - 'null'
                  minimum: 0
                  maximum: 500
                counterparty_account:
                  type:
                    - integer
                    - 'null'
          required:
            - delimiter
            - has_header
            - date_format
            - number_format
            - columns
      required:
        - mapping
      title: UpdateImportMappingRequest
    ImportBatchResource:
      type: object
      properties:
        id:
          type: string
        financial_account_id:
          type: string
        format:
          type:
            - string
            - 'null'
          description: CAMT053, OFX or CSV, as detected from the file.
        filename:
          type: string
        status:
          type:
            - string
            - 'null'
          description: >-
            PENDING_REVIEW, COMMITTING, COMPLETED, UNDOING, UNDONE, FAILED or
            EXPIRED.
        row_count:
          type: integer
          description: Rows in the file, valid or not.
        imported_count:
          type: integer
          description: Rows written by the commit. 0 until then.
        duplicate_count:
          type: integer
          description: Rows skipped because the account already had them.
        skipped_count:
          type: integer
          description: Rows the parser could not read as a transaction.
        date_from:
          type:
            - string
            - 'null'
        date_to:
          type:
            - string
            - 'null'
        closing_balance:
          type: string
          description: >-
            The closing balance the file stated, or the last running balance a
            CSV mapped. Signed.
        closing_balance_date:
          type:
            - string
            - 'null'
        balance_result:
          type:
            - string
            - 'null'
          description: >-
            After commit: CHECKPOINTED when the closing balance was recorded,
            UNCHANGED when the file carried none.
        balance_adjustment:
          type:
            - object
            - 'null'
          description: >-
            The ADJUSTMENT row the checkpoint posted when the derived balance
            differed. Null otherwise.
          properties:
            amount:
              type: string
            transaction_id:
              type: string
          required:
            - amount
            - transaction_id
        mapping:
          type: string
          description: The CSV mapping this batch is read with. Null for camt.053 and OFX.
        mapping_source:
          type:
            - string
            - 'null'
          description: >-
            SAVED (the account's saved mapping), PROPOSED (suggested for this
            file) or MANUAL (edited by the user).
        error:
          type: string
          description: Why the batch FAILED, in words the user can act on.
        preview:
          type:
            - object
            - 'null'
          description: >-
            Counts over the whole file (new, duplicate, invalid), warnings, the
            statement's account and, for a CSV, the raw headers, column count
            and mapping confidence. Present while the batch is under review; the
            rows are on the rows endpoint. The statement account's number and
            owner are left out for a caller that may not read sensitive
            identifiers.
          additionalProperties: {}
        created_at:
          type:
            - string
            - 'null'
        committed_at:
          type:
            - string
            - 'null'
        expires_at:
          type:
            - string
            - 'null'
          description: When an unconfirmed batch is discarded.
      required:
        - id
        - financial_account_id
        - format
        - filename
        - status
        - row_count
        - imported_count
        - duplicate_count
        - skipped_count
        - date_from
        - date_to
        - closing_balance
        - closing_balance_date
        - balance_result
        - balance_adjustment
        - mapping
        - mapping_source
        - error
        - created_at
        - committed_at
        - expires_at
      title: ImportBatchResource
    SignConventionEnum:
      type: string
      description: >
        How a CSV expresses the direction of an amount: one signed column,
        separate debit and credit columns, a minus after the digits ("123,45-"),
        or a single column where money out is positive.
      enum:
        - SIGNED
        - DEBIT_CREDIT_COLUMNS
        - TRAILING_MINUS
        - DEBIT_POSITIVE
      title: SignConventionEnum
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ModelNotFoundException:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://api.synci.io/oauth/authorize
          tokenUrl: https://api.synci.io/oauth/token
          scopes:
            profile:read: View your name, email, and profile details
            accounts:read: View your connected financial accounts and balances
            accounts:write: >-
              Update, sync, and remove your financial accounts, and change their
              settings
            transactions:read: View your transactions
            transactions:write: Create, update, and delete your transactions
            sensitive:read: >-
              See sensitive identifiers like account numbers and account holder
              names
            transfer-links:read: View your transfer links and their transfer history
            transfer-links:write: Create, update, and delete transfer links, and undo transfers
            rules:read: View your rules and rule activity
            rules:write: Create, update, and delete rules, and undo rule actions
            webhooks:read: View your webhook endpoints
            webhooks:write: >-
              Create, update, and delete webhook endpoints, and rotate their
              secrets
            destinations:read: View your connected destinations
            destinations:write: Connect, update, and remove destinations
            financial-connections:read: View your connected institutions
            financial-connections:write: Manage your connected institutions
    http:
      type: http
      description: Bearer token (personal access token or OAuth access token)
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.