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

# Replace a sheet

> Fully updates an existing sheet. All provided fields will overwrite existing values.



## OpenAPI

````yaml PUT /1.1/sheet/{sheet_license_key}
openapi: 3.0.0
info:
  title: CSVBox Sheets API Documentation
  description: >-
    CSVBox public API for creating sheets and defining column rules,
    destinations, settings, and JavaScript virtual columns, validation functions
    and data transforms.
  version: 1.2.0
servers:
  - url: https://api.csvbox.io/
    description: CSVBox Sheets API Server
security: []
tags:
  - name: Sheets
    description: Sheets
paths:
  /1.1/sheet/{sheet_license_key}:
    put:
      tags:
        - Sheets
      summary: Update Sheet
      description: >-
        Fully updates an existing sheet. All provided fields will overwrite
        existing values.
      operationId: updateSheet
      parameters:
        - name: sheet_license_key
          in: path
          description: Sheet License Key
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/AcceptHeader'
        - $ref: '#/components/parameters/ContentTypeHeader'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PutSheetRequest'
      responses:
        '200':
          description: Sheet Updated Successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SheetSuccessResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Sheet Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
          ApiSecretKeyAuth: []
components:
  parameters:
    AcceptHeader:
      name: Accept
      in: header
      description: Must be application/json
      required: true
      schema:
        type: string
        example: application/json
    ContentTypeHeader:
      name: Content-Type
      in: header
      description: Content type must be application/json
      required: true
      schema:
        type: string
        example: application/json
  schemas:
    PutSheetRequest:
      properties:
        title:
          type: string
          example: Updated Sheet
        webhooks:
          type: array
          items:
            $ref: '#/components/schemas/Webhook'
        destinations:
          type: array
          items:
            $ref: '#/components/schemas/Destinations'
        sheet_columns:
          type: array
          items:
            $ref: '#/components/schemas/SheetColumn'
          example:
            - column_name: col1
              display_label: Col1 - Text
              info_hint: What is your highest educational degree
              matching_keywords: degree, education
              type: text
              validators:
                min_length: 2
                max_length: 50
              default_value: ''
              required: false
              position: 5
            - column_name: col2
              display_label: col2 - Number
              info_hint: Years of work experience
              type: number
              validators:
                min_value: 1
                max_value: 100
              required: false
              position: 6
            - column_name: col4
              display_label: col4 - Email
              type: email
              required: false
              position: 7
            - column_name: col5
              display_label: col5 - Date
              type: date
              validators:
                format: YYYY-MM-DD
              required: false
              position: 8
        steps:
          $ref: '#/components/schemas/Steps'
        security_settings:
          $ref: '#/components/schemas/SecuritySettings'
        virtual_columns:
          description: >-
            PUT is AUTHORITATIVE for a collection it sends: items listed are
            created or updated in place, and any existing item this array does
            not name is DELETED. Sending [] deletes every virtual column on the
            sheet. Omitting the key entirely leaves the collection untouched.
            Use `_delete` under PATCH instead if you want targeted removal.
          type: array
          items:
            $ref: '#/components/schemas/VirtualColumn'
          maxItems: 20
        validation_functions:
          description: >-
            PUT is AUTHORITATIVE: unlisted existing items are DELETED, []
            empties the collection, an omitted key leaves it untouched. Two
            functions are shown: `check_email` needs nothing beyond the
            built-ins, while `check_date` declares `dayjs` — remove that
            dependency and its code is rejected with js_disallowed_global. That
            entry omits the optional `integrity` field so this body can be sent
            unmodified; in your own sheet add `"integrity": "sha384-<digest
            published by the CDN>"` beside the `url`, and add further scripts as
            further comma-separated objects in the same array (5 max).
          type: array
          items:
            $ref: '#/components/schemas/ValidationFunction'
          maxItems: 10
          example:
            - function_name: check_email
              scope: column
              columns:
                - col4
              js_code: >-
                const rows = csvbox.column['col4'] || []; const errs = []; for
                (let i = 0; i < rows.length; i++) { if
                (String(rows[i]).indexOf('@') === -1) { errs.push({ row_id: i +
                1, column: 'col4', message: 'Not a valid email' }); } } return
                errs;
              active: true
            - function_name: check_date
              scope: column
              columns:
                - col5
              js_code: >-
                const rows = csvbox.column['col5'] || []; const errs = []; const
                today = dayjs(); for (let i = 0; i < rows.length; i++) { const
                raw = String(rows[i] || '').trim(); if (raw === '') { continue;
                } const d = dayjs(raw); if (!d.isValid() ||
                d.format('YYYY-MM-DD') !== raw) { errs.push({ row_id: i + 1,
                column: 'col5', message: 'Use YYYY-MM-DD, e.g. 2024-01-31' }); }
                else if (d.isAfter(today)) { errs.push({ row_id: i + 1, column:
                'col5', message: 'Date cannot be in the future' }); } else if
                (d.year() < 1900) { errs.push({ row_id: i + 1, column: 'col5',
                message: 'Date must be 1900 or later' }); } } return errs;
              dependencies:
                - url: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js
                  globals:
                    - dayjs
              active: true
        data_transforms:
          description: >-
            PUT is AUTHORITATIVE: unlisted existing items are DELETED, []
            empties the collection, an omitted key leaves it untouched.
          type: array
          items:
            $ref: '#/components/schemas/DataTransform'
          maxItems: 10
        pdf_metadata_config:
          description: >-
            Fields to extract from an uploaded PDF/DOCX. Sending the key
            replaces the whole stored array; omitting it leaves any existing
            configuration untouched.
          type: array
          items:
            $ref: '#/components/schemas/PdfMetadataField'
          maxItems: 20
          example:
            - name: Author
              source: native
            - name: Invoice Number
              source: document-kv
            - name: processed_by
              source: static
              value: AP Team
            - name: invoice_date
              source: line-match
              value: 'Invoice Date:'
      type: object
    SheetSuccessResponse:
      properties:
        status:
          type: string
          example: Sheet Created Successfully
        data:
          properties:
            sheet_license_key:
              type: string
            title:
              type: string
            virtual_columns:
              description: >-
                Per-item outcome, present only when the request sent this
                collection. Additive — existing clients reading
                sheet_license_key and title are unaffected.
              type: array
              items:
                properties:
                  column_name:
                    type: string
                    example: full_name
                  result:
                    type: string
                    enum:
                      - created
                      - updated
                      - unchanged
                      - deleted
                    example: created
                type: object
            validation_functions:
              description: >-
                Per-item outcome, present only when the request sent this
                collection. `unchanged` means the item was submitted but matched
                what was already stored, so no write happened.
              type: array
              items:
                properties:
                  function_name:
                    type: string
                    example: check_email
                  result:
                    type: string
                    enum:
                      - created
                      - updated
                      - unchanged
                      - deleted
                    example: updated
                type: object
            data_transforms:
              description: >-
                Per-item outcome, present only when the request sent this
                collection.
              type: array
              items:
                properties:
                  transform_name:
                    type: string
                    example: uppercase_country
                  result:
                    type: string
                    enum:
                      - created
                      - updated
                      - unchanged
                      - deleted
                    example: unchanged
                type: object
          type: object
      type: object
    ErrorResponse:
      properties:
        status:
          type: string
          example: Sheet Creation Failed
        errors:
          description: >-
            Keys are dotted paths into the request body (for example
            `virtual_columns.0.js_code`), each mapping to a list of problems
            found at that path. Every failing item is reported in one response,
            so a caller pushing ten functions learns about all ten in a single
            round trip. Requests rejected by the JavaScript gate always use this
            form, and point into that item's own js_code: `line` is 1-based,
            `column` is 0-based. `identifier`, `line` and `column` are present
            only when the violation has one. Codes: js_code_too_long,
            js_forbidden_sequence, js_syntax_error, js_disallowed_global,
            js_forbidden_construct, js_duplicate_name, js_name_conflicts_column,
            js_unknown_column, js_too_many_items, js_budget_exceeded,
            js_name_ambiguous, js_missing_name, js_unknown_field,
            js_invalid_field, js_invalid_item, dependency_url_invalid,
            dependency_host_not_allowed, column_name_ambiguous.
          type: object
          example:
            virtual_columns.0.js_code:
              - code: js_disallowed_global
                message: >-
                  Disallowed global `fetch`. Snippets may only reference the
                  `csvbox` argument, standard built-ins, and globals declared in
                  this item's dependencies.
                identifier: fetch
                line: 1
                column: 7
          additionalProperties:
            type: array
            items:
              type: object
              properties:
                code:
                  type: string
                  example: js_disallowed_global
                message:
                  type: string
                  example: >-
                    Disallowed global `fetch`. Snippets may only reference the
                    `csvbox` argument, standard built-ins, and globals declared
                    in this item's dependencies.
                identifier:
                  type: string
                  example: fetch
                line:
                  type: integer
                  example: 1
                column:
                  type: integer
                  example: 7
      type: object
    Webhook:
      properties:
        import_complete:
          $ref: '#/components/schemas/WebhookImportComplete'
      type: object
    Destinations:
      properties:
        type:
          type: string
          enum:
            - webhook
            - testapi
            - none
            - xano
          example: webhook
        isActive:
          type: boolean
          example: true
        settings:
          properties:
            method:
              type: string
              enum:
                - POST
                - PATCH
              example: POST
            url:
              type: string
              format: url
              example: https://example.com/api/import
            post_data_format:
              type: string
              enum:
                - JSON
                - FORM_DATA
                - XML
              example: JSON
            rows_per_chunk:
              type: integer
              example: 100
            request_type:
              type: string
              enum:
                - parallel
                - sequential
              example: parallel
            server_side_validation:
              type: boolean
              example: true
            allow_resubmit:
              type: string
              enum:
                - all_rows
                - error_rows_only
              example: all_rows
            custom_headers:
              type: array
              items:
                $ref: '#/components/schemas/Header'
          type: object
      type: object
    SheetColumn:
      required:
        - column_name
      properties:
        column_name:
          type: string
          example: email
        display_label:
          type: string
          example: Email
        info_hint:
          type: string
          example: Enter user email
        matching_keywords:
          type: string
          example: email,user_email
        type:
          type: string
          enum:
            - text
            - number
            - email
            - date
            - time
            - boolean
            - regex
            - ip
            - url
            - credit_card
            - phone_number
            - currency
            - list
            - dependent_list
            - dynamic_list
            - dependent_dynamic_list
            - multiselect_list
            - multiselect_dynamic_list
            - percentage
            - iana_timezone
            - upc
            - uuid
            - domain
            - currency_code
            - country_code_a2
            - country_code_a3
            - imei
            - ean
            - json
          example: text
        default_value:
          type: string
          example: ''
        required:
          type: boolean
          example: false
        read_only:
          type: boolean
          example: false
        position:
          type: integer
          minimum: 1
          example: 1
        validators:
          description: >-
            Validators depend on the column type. See examples below for each
            type.
          properties:
            min_length:
              description: '[text] Minimum character length'
              type: integer
              example: 2
            max_length:
              description: '[text] Maximum character length'
              type: integer
              example: 50
            min_value:
              description: '[number, percentage] Minimum numeric value'
              type: number
              example: 1
            max_value:
              description: '[number, percentage] Maximum numeric value'
              type: number
              example: 100
            output:
              description: '[percentage] Output format'
              type: string
              enum:
                - number
                - percent
              example: number
            format:
              description: >-
                [date] Date format e.g. YYYY-MM-DD | [time] Time format e.g.
                HH:mm:ss
              type: string
              example: YYYY-MM-DD
            custom:
              description: '[date, time] Custom format string, used when format is "custom"'
              type: string
              example: DD/MM/YYYY
            multiple:
              description: '[date, time] Accepted formats, used when format is "multiple"'
              type: array
              items:
                type: string
            expression:
              description: '[regex] Regular expression pattern'
              type: string
              example: ^\d{10}$
            error_message:
              description: '[regex] Custom error message'
              type: string
              example: Please enter a valid 10 digit phone number
            version:
              description: '[ip] IP version'
              type: string
              enum:
                - ipv4
                - ipv6
              example: ipv4
            country_code:
              description: '[phone_number] Country code e.g. IN, US'
              type: string
              example: IN
            symbol:
              description: '[currency] Currency symbol'
              type: string
              example: $
            require_symbol:
              description: '[currency] Whether symbol is required'
              type: boolean
              example: false
            allow_space_after_symbol:
              description: '[currency] Allow a space between the symbol and digits'
              type: boolean
              example: false
            symbol_after_digits:
              description: '[currency] Place the symbol after the digits instead of before'
              type: boolean
              example: false
            allow_negatives:
              description: '[currency] Allow negative values'
              type: boolean
              example: true
            parens_for_negatives:
              description: >-
                [currency] Show negative values in parentheses instead of a
                minus sign
              type: boolean
              example: false
            negative_sign_before_digits:
              description: '[currency] Place the negative sign before the digits'
              type: boolean
              example: true
            negative_sign_after_digits:
              description: '[currency] Place the negative sign after the digits'
              type: boolean
              example: false
            thousands_separator:
              description: '[currency] Thousands separator character'
              type: string
              example: ','
            decimal_separator:
              description: '[currency] Decimal separator character'
              type: string
              example: .
            allow_decimal:
              description: '[currency] Allow decimal values'
              type: boolean
              example: true
            require_decimal:
              description: '[currency] Require a decimal portion'
              type: boolean
              example: false
            digits_after_decimal:
              description: '[currency] Number of digits allowed after the decimal separator'
              type: integer
              example: 2
            allow_space_after_digits:
              description: '[currency] Allow a trailing space after the digits'
              type: boolean
              example: false
            values:
              description: >-
                [list] Array of ListItem objects (with dependents) |
                [multiselect_list] Array of strings
              oneOf:
                - type: array
                  items:
                    $ref: '#/components/schemas/ListItem'
                - type: array
                  items:
                    type: string
            case_sensitive:
              description: '[list, multiselect_list] Case-sensitive matching'
              type: boolean
              example: false
            trim_whitespace:
              description: >-
                [list, dynamic_list, multiselect_list, multiselect_dynamic_list]
                Trim whitespace before matching
              type: boolean
              example: false
            accept_list_values:
              description: >-
                [list] Accept values already present in the configured list
                without further validation
              type: boolean
              example: false
            primary_column:
              description: >-
                [dependent_list, dependent_dynamic_list] The column_name of the
                parent list column
              type: string
              example: col14
            source_url:
              description: '[dynamic_list] URL to fetch list options from'
              type: string
              example: https://example.com/api/list-options
            request_method:
              description: '[dynamic_list] HTTP method'
              type: string
              enum:
                - GET
                - POST
              example: GET
            request_headers:
              description: '[dynamic_list] Custom request headers'
              type: array
              items:
                $ref: '#/components/schemas/Header'
            custom_user_attributes:
              description: '[dynamic_list] Include custom user attributes in request'
              type: boolean
              example: true
            other_values:
              description: >-
                [dynamic_list, multiselect_list] Allow values outside predefined
                list
              type: boolean
              example: false
            delimiter:
              description: >-
                [multiselect_list, multiselect_dynamic_list] Delimiter for
                multiple values
              type: string
              example: ','
            dml_source_url:
              description: '[multiselect_dynamic_list] URL to fetch list options from'
              type: string
              example: https://example.com/api/multiselect-dynamic-options
            dml_request_method:
              description: '[multiselect_dynamic_list] HTTP method'
              type: string
              enum:
                - GET
                - POST
                - PATCH
              example: GET
            dml_request_headers:
              description: '[multiselect_dynamic_list] Custom request headers'
              type: array
              items:
                $ref: '#/components/schemas/Header'
            dml_other_values:
              description: '[multiselect_dynamic_list] Allow values outside predefined list'
              type: boolean
              example: false
          type: object
          example:
            col1 (text):
              min_length: 2
              max_length: 50
            col2 (number):
              min_value: 1
              max_value: 100
            col5 (date):
              format: YYYY-MM-DD
            col6 (time):
              format: HH:mm:ss
            col8 (regex):
              expression: ^\d{10}$
              error_message: Please enter a valid 10 digit phone number
            col9 (ip):
              version: ipv4
            col12 (phone_number):
              country_code: IN
            col13 (currency):
              symbol: $
              require_symbol: false
            col17 (dynamic_list):
              source_url: https://example.com/api/list-options
              request_method: GET
              request_headers: []
              custom_user_attributes: true
              other_values: false
            col18 (dependent_dynamic_list):
              primary_column: col17
            col20 (multiselect_list):
              values:
                - Red
                - Green
                - Blue
              delimiter: ','
              case_sensitive: false
              other_values: false
            col21 (multiselect_dynamic_list):
              dml_source_url: https://example.com/api/multiselect-options
              dml_request_method: GET
              dml_request_headers: []
              delimiter: ','
              dml_other_values: false
            col22 (percentage):
              min_value: 0
              max_value: 100
              output: percent
        metadata:
          description: >-
            Data transforms configured for this column, under the same
            metadata.transforms key POST/PUT/PATCH accept. An empty object when
            no transforms are configured.
          properties:
            transforms:
              type: object
          type: object
      type: object
    Steps:
      properties:
        file_upload:
          properties:
            types:
              type: array
              items:
                type: string
                example: .csv
            title:
              type: string
              example: File Upload
            help:
              type: string
              example: Upload your CSV file
            sample_file_url:
              type: string
              example: ''
            size_mb:
              type: integer
              example: 200
            validation_msg:
              type: string
              example: upto 200mb allowed
            copy_paste:
              type: boolean
              example: true
            copy_delimiter:
              type: string
              example: comma
            show_upload:
              type: boolean
              example: true
            worksheet_select:
              type: boolean
              example: true
            description_option:
              type: boolean
              example: true
            lang:
              type: string
              example: en
            excel_date_format:
              type: string
              example: custom
            excel_date_custom:
              type: string
              example: DD-MM-YYYY
            hide_cancel:
              type: boolean
              example: false
            split:
              description: Split large files into multiple imports
              type: boolean
              example: true
            split_rows:
              description: Rows per import when splitting (min 1)
              type: integer
              example: 1000
            split_confirm:
              description: >-
                User confirmation required after each import: no=0, yes=1,
                no_if_no_errors=2
              type: string
              enum:
                - 'no'
                - 'yes'
                - no_if_no_errors
              example: 'no'
            extract_types:
              description: Allowed document extraction types (mapped to .pdf/.doc/images)
              type: array
              items:
                type: string
                enum:
                  - pdf
                  - docs
                  - images
              example:
                - pdf
                - images
            page_limit:
              description: Max pages allowed for extraction (null = no limit)
              type: integer
              example: 10
              nullable: true
            accept_raw_value:
              description: >-
                Skip data-type coercion and pass raw cell values through.
                Defaults to false, deliberately — see the repo's
                revert-accept-raw-values-default change; this is not a stale
                default to "fix".
              type: boolean
              example: false
            skip_min_rows:
              description: >-
                Skip extracted tables with fewer than this many rows (table
                extraction only)
              type: integer
              example: 2
              nullable: true
            skip_max_rows:
              description: >-
                Skip extracted tables with more than this many rows (table
                extraction only)
              type: integer
              example: 1000
              nullable: true
            skip_min_cols:
              description: >-
                Skip extracted tables with fewer than this many columns (table
                extraction only)
              type: integer
              example: 2
              nullable: true
            skip_max_cols:
              description: >-
                Skip extracted tables with more than this many columns (table
                extraction only)
              type: integer
              example: 20
              nullable: true
          type: object
        select_header:
          properties:
            skip:
              type: boolean
              example: true
            help:
              type: string
              example: Select header row
            default_row:
              type: string
              example: '2'
            encoding_option:
              type: boolean
              example: true
            encoding:
              description: >-
                Accepted values: utf-8, windows-1251, windows-1252, ibm866,
                iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6,
                iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13,
                iso-8859-14, iso-8859-15, iso-8859-16, koi8-r, koi8-u,
                macintosh, windows-874, windows-1250, windows-1253,
                windows-1254, windows-1255, windows-1256, windows-1257,
                windows-1258, gbk, gb18030, big5, euc-jp, shift-jis, euc-kr,
                utf-16be, utf-16le. Values are case-insensitive and lowercased
                before storage.
              type: string
              enum:
                - utf-8
                - windows-1251
                - windows-1252
                - ibm866
                - iso-8859-2
                - iso-8859-3
                - iso-8859-4
                - iso-8859-5
                - iso-8859-6
                - iso-8859-7
                - iso-8859-8
                - iso-8859-8-i
                - iso-8859-10
                - iso-8859-13
                - iso-8859-14
                - iso-8859-15
                - iso-8859-16
                - koi8-r
                - koi8-u
                - macintosh
                - windows-874
                - windows-1250
                - windows-1253
                - windows-1254
                - windows-1255
                - windows-1256
                - windows-1257
                - windows-1258
                - gbk
                - gb18030
                - big5
                - euc-jp
                - shift-jis
                - euc-kr
                - utf-16be
                - utf-16le
              example: windows-1252
            row_column_switch:
              type: boolean
              example: false
          type: object
        map_columns:
          properties:
            skip:
              type: boolean
              example: true
            help:
              type: string
              example: Map columns
            mapping_mode:
              type: string
              example: template_fields
            bulk_cols_dd:
              type: boolean
              example: false
            accept_unmapped:
              type: boolean
              example: true
            accept_unmapped_select:
              type: boolean
              example: true
            allow_zero_template:
              type: boolean
              example: true
            ignore_cols:
              type: boolean
              example: true
            ignore_cols_default:
              type: boolean
              example: true
            user_keywords:
              type: boolean
              example: false
          type: object
        verify_data:
          properties:
            skip:
              type: boolean
              example: true
            help:
              type: string
              example: Verify data
            row_display_mode:
              type: string
              example: invalid
            export_option:
              type: boolean
              example: true
            search_option:
              type: boolean
              example: false
            ai_transform:
              type: boolean
              example: true
            allow_new_rows:
              type: boolean
              example: false
            rows_display:
              type: integer
              example: 25
            allow_invalid:
              type: boolean
              example: true
            invalid_confirmation:
              type: boolean
              example: false
            max_rows:
              type: integer
              example: 600
            allow_upload_if_max:
              type: boolean
              example: false
            max_rows_msg:
              type: string
              example: maaaaaax
            min_rows:
              type: integer
              example: 2
            min_rows_msg:
              type: string
              example: miiiiin
          type: object
        results:
          properties:
            close_mode:
              type: string
              example: close_on_success
            redirect_url:
              type: string
              example: ''
            success_type:
              type: string
              example: static
            success_text:
              type: string
              example: Import successful
            success_method:
              type: string
              example: get
            success_url:
              type: string
              example: ''
            success_headers:
              description: Custom headers sent with the success dynamic callback
              type: array
              items:
                $ref: '#/components/schemas/Header'
            failed_type:
              type: string
              example: static
            failed_text:
              type: string
              example: Failure
            failed_method:
              type: string
              example: get
            failed_url:
              type: string
              example: ''
            failed_headers:
              description: Custom headers sent with the failure dynamic callback
              type: array
              items:
                $ref: '#/components/schemas/Header'
            show_resubmit:
              type: boolean
              example: false
            show_error_text:
              type: boolean
              example: false
          type: object
      type: object
    SecuritySettings:
      properties:
        region:
          type: string
          enum:
            - us
            - eu
          example: us
        domains:
          type: array
          items:
            type: string
            example: example.com
        import_url_upload:
          type: boolean
          example: true
        s3_upload:
          type: boolean
          example: true
      type: object
    VirtualColumn:
      description: >-
        A computed column. Max 20 per sheet. `column_name` must not collide with
        a real sheet column.
      required:
        - column_name
      properties:
        column_name:
          type: string
          maxLength: 190
          example: full_name
        js_code:
          description: >-
            Function body receiving a single `csvbox` argument and returning the
            computed value. Required unless `_delete` is true, or a PATCH is
            updating an item that already exists — an omitted `js_code` then
            keeps the stored snippet. Sending an empty string, null or
            whitespace is refused with js_syntax_error: preservation is
            triggered by absence, not emptiness.
          type: string
          maxLength: 32768
          example: >-
            const a = csvbox.row['col1'] || ''; const b = csvbox.row['col2'] ||
            ''; return (a + ' ' + b).trim();
        active:
          description: >-
            Defaults to true on API create — unlike the web UI, whose post-save
            toggle starts off.
          type: boolean
          default: true
          example: true
        dependencies:
          description: >-
            Supported here as on every collection. Empty in this example because
            the snippet above needs only `csvbox` and built-ins — see the
            `check_date` validation function for a worked dependency. To use one
            here, send `[{"url":
            "https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js",
            "globals": ["dayjs"], "integrity": "sha384-…"}]`; `globals` and
            `integrity` are optional, and further scripts are further objects in
            the same array. See the JsDependency schema for the host allowlist
            and per-field rules.
          type: array
          items:
            $ref: '#/components/schemas/JsDependency'
          maxItems: 5
          example: []
        _delete:
          description: >-
            PATCH only. When true the item is deleted and every other field on
            it is ignored, including `js_code`.
          type: boolean
          example: false
      type: object
    ValidationFunction:
      description: A custom validation rule. Max 10 per sheet.
      required:
        - function_name
      properties:
        function_name:
          type: string
          maxLength: 190
          example: check_email
        scope:
          description: >-
            `column` runs over whole columns via csvbox.column[...]; `row` runs
            per row via csvbox.row[...]. A column-scoped item must name at least
            one entry across `columns` and `dynamic_columns`. On a PATCH
            updating an existing item, `scope`, `columns` and `dynamic_columns`
            preserve as a GROUP: send none of the three and the stored scoping
            is kept; send any one and all three are taken from the request, so
            `columns` alone also clears `dynamic_columns`.
          type: string
          default: column
          enum:
            - column
            - row
          example: column
        columns:
          description: >-
            Sheet columns this function reads. Validated against the sheet as it
            stands AFTER this request, so one call may add a column and a
            function that uses it. A scope preserved by a PATCH that sent none
            of the three scope fields is written back as stored and is not
            re-checked.
          type: array
          items:
            type: string
            example: col4
        dynamic_columns:
          description: >-
            Columns that only exist at import time and so cannot be checked
            against the sheet definition.
          type: array
          items:
            type: string
            example: region
        js_code:
          description: >-
            Function body receiving `csvbox` and returning an array of errors —
            empty means valid. Required unless `_delete` is true, or a PATCH is
            updating an item that already exists — an omitted `js_code` then
            keeps the stored snippet. Sending an empty string, null or
            whitespace is refused with js_syntax_error: preservation is
            triggered by absence, not emptiness.
          type: string
          maxLength: 32768
          example: >-
            const rows = csvbox.column['col4'] || []; const errs = []; for (let
            i = 0; i < rows.length; i++) { if (String(rows[i]).indexOf('@') ===
            -1) { errs.push({ row_id: i + 1, column: 'col4', message: 'Not a
            valid email' }); } } return errs;
        active:
          type: boolean
          default: true
          example: true
        dependencies:
          description: >-
            Scripts this item's `js_code` may use. The `check_date` example
            below is the worked case: `[{"url":
            "https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js",
            "globals": ["dayjs"]}]`, plus an optional `integrity` digest per
            entry. Remove it and the same code is rejected with
            js_disallowed_global, which is the whole purpose of `globals`. Up to
            5 entries, comma-separated in the array, loaded in the order sent.
          type: array
          items:
            $ref: '#/components/schemas/JsDependency'
          maxItems: 5
        _delete:
          description: PATCH only. See VirtualColumn._delete.
          type: boolean
          example: false
      type: object
    DataTransform:
      description: A transform that rewrites values in place. Max 10 per sheet.
      required:
        - transform_name
      properties:
        transform_name:
          type: string
          maxLength: 190
          example: uppercase_country
        scope:
          type: string
          default: column
          enum:
            - column
            - row
          example: column
        run_at:
          description: When the transform runs relative to validation.
          type: string
          enum:
            - before_validation
            - after_validation
          example: before_validation
        columns:
          type: array
          items:
            type: string
            example: col1
        dynamic_columns:
          type: array
          items:
            type: string
            example: region
        js_code:
          description: >-
            Function body receiving `csvbox`, mutating it and returning it.
            Required unless `_delete` is true, or a PATCH is updating an item
            that already exists — an omitted `js_code` then keeps the stored
            snippet. Sending an empty string, null or whitespace is refused with
            js_syntax_error: preservation is triggered by absence, not
            emptiness.
          type: string
          maxLength: 32768
          example: >-
            for (let i = 0; i < csvbox.column['col1'].length; i++) {
            csvbox.column['col1'][i] =
            String(csvbox.column['col1'][i]).toUpperCase(); } return csvbox;
        active:
          type: boolean
          default: true
          example: true
        dependencies:
          description: >-
            Supported here as on every collection. Empty in this example because
            the snippet above needs only `csvbox` and built-ins — see the
            `check_date` validation function for a worked dependency. To use one
            here, send `[{"url":
            "https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js",
            "globals": ["dayjs"], "integrity": "sha384-…"}]`; `globals` and
            `integrity` are optional, and further scripts are further objects in
            the same array. See the JsDependency schema for the host allowlist
            and per-field rules.
          type: array
          items:
            $ref: '#/components/schemas/JsDependency'
          maxItems: 5
          example: []
        _delete:
          description: PATCH only. See VirtualColumn._delete.
          type: boolean
          example: false
      type: object
    PdfMetadataField:
      description: >-
        One metadata field to extract from an uploaded PDF/DOCX. Max 20 per
        sheet.
      required:
        - name
        - source
      properties:
        name:
          description: >-
            Output key. For `source=native`/`document-kv` this also drives
            matching (see `source`); for `static`/`line-match` it is only the
            output key.
          type: string
          maxLength: 100
          example: Invoice Number
        source:
          description: >-
            Where the value comes from. `native`: `name` is matched
            case-insensitively against the uploaded PDF/DOCX's own document
            properties (e.g. Author, Title, Subject, Keywords, CreationDate) —
            `value` is ignored. `document-kv`: `name` must match, after
            whitespace/trailing-punctuation normalization, the exact
            (case-sensitive) label text of a key-value pair detected on the
            document (e.g. a form field literally labeled `Invoice Number`) —
            `value` is ignored. `static`: `value` is returned verbatim.
            `line-match`: `value` is a search term — the document's extracted
            text is scanned line by line and whatever follows that term is
            returned (falling back to the next line if nothing follows it on the
            same line).
          type: string
          enum:
            - native
            - document-kv
            - static
            - line-match
          example: document-kv
        value:
          description: >-
            Required when `source` is `static` (the literal to return) or
            `line-match` (the search term). Ignored for `native` and
            `document-kv`.
          type: string
          example: null
          nullable: true
      type: object
    WebhookImportComplete:
      properties:
        url:
          type: string
          format: url
          example: https://example.com/webhook
        send_copy:
          description: Send a copy of imported data to client
          type: boolean
          example: false
        custom_headers:
          type: array
          items:
            $ref: '#/components/schemas/Header'
      type: object
    Header:
      required:
        - key
        - value
      properties:
        key:
          description: |-
            ---------------------------------------------------------
            HEADER OBJECT
            ---------------------------------------------------------
          type: string
          example: Content-Type
        value:
          type: string
          example: application/json
      type: object
    ListItem:
      properties:
        value:
          type: string
          example: ind
        display_label:
          type: string
          example: India
        dependents:
          type: array
          items:
            $ref: '#/components/schemas/ListItemChild'
      type: object
    JsDependency:
      description: >-
        A third-party script an item's `js_code` may use. The API never accepts
        raw HTML — send the URL and the server renders the <script src> tag.
        Migrating from the web UI: `js_dependency` markup is not a writable
        field. Full shape, all three fields, on any of the three collections:
        `"dependencies": [{"url":
        "https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js", "globals":
        ["dayjs"], "integrity": "sha384-…"}]`. Only `url` is required; `globals`
        is what makes the library's name callable from `js_code`, and
        `integrity` is optional. Up to 5 dependencies per item — send them as
        separate objects in the array, comma-separated, one per script. The
        server renders each as `<script src="…" integrity="…"
        crossorigin="anonymous"></script>`, in the order sent, so a library that
        must load before another goes first.
      required:
        - url
      properties:
        url:
          description: >-
            HTTPS only. Host must be exactly cdn.jsdelivr.net, unpkg.com or
            cdnjs.cloudflare.com (no subdomains). Path must end in .js or .mjs.
            No query string, fragment, userinfo or port.
          type: string
          format: url
          maxLength: 512
          example: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js
        globals:
          description: >-
            Names this script defines. Each is added to the allowed-identifier
            list for this item only — code referencing an undeclared global is
            rejected with js_disallowed_global. May not shadow a built-in or
            `csvbox`. Loading the script is not enough on its own: the code gate
            checks this list, so a name absent from it is refused whether or not
            the CDN would have defined it at runtime. Up to 5 names, each
            matching /^[A-Za-z_$][A-Za-z0-9_$]{0,63}$/.
          type: array
          items:
            type: string
            example: dayjs
          maxItems: 5
        integrity:
          description: >-
            Optional Subresource Integrity digest: sha256-, sha384- or sha512-
            followed by base64. When sent it is rendered as the tag's integrity
            attribute, so the browser refuses the script if the file does not
            hash to it. Take the digest from the CDN's own copy button (jsDelivr
            and cdnjs both publish one) — a digest that does not match the exact
            file at that URL stops the library loading, and the failure shows up
            in the importer at runtime, not as a 422 here. Pin an exact version
            in the URL when you use it: a floating version resolves to a
            different file later and invalidates the digest.
          type: string
          example: sha384-abc123+/def456==
      type: object
    ListItemChild:
      properties:
        value:
          type: string
          example: mh
        display_label:
          type: string
          example: Maharashtra
        dependents:
          type: array
          items:
            $ref: '#/components/schemas/ListItemDependent'
      type: object
    ListItemDependent:
      properties:
        value:
          type: string
          example: mum
        display_label:
          type: string
          example: Mumbai
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: x-csvbox-api-key
      in: header
    ApiSecretKeyAuth:
      type: apiKey
      name: x-csvbox-secret-api-key
      in: header

````

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