---
title: "Update a file"
method: PATCH
path: "/files/{fileId}"
tags: ["files"]
---

# Update a file

`PATCH /files/{fileId}`

Update a file, to change the workbook id for example

## Path parameters

- `fileId` string, required

## Headers

- `Authorization` string, required
- `X-Disable-Hooks` 'true', required

## Request body

- object
  - `workbookId` string — Workbook ID
  - `name` string — The name of the file
  - `mode` 'import' | 'export'
  - `status` 'partial' | 'analyzing' | 'analyzed' | 'complete' | 'archived' | 'purged' | 'failed' — Status of the file. Partial: File is uploaded but not yet processed. Analyzing: Smart Extract is running. Analyzed: Smart Extract has finished running. Complete: File has been extracted and is ready to be used. Archived: File has been archived. Purged: File has been purged. Failed: File has failed to be extracted.
  - `actions` TypeCommonsAction[] — The actions attached to the file
    - `slug` string — **This is deprecated. Use `operation` instead.**
    - `operation` string — This will become the job operation that is triggered
    - `mode` 'foreground' | 'background' | 'toolbarBlocking' — Foreground actions will prevent interacting with the resource until complete
    - `tooltip` string — A tooltip that appears when hovering the action button
    - `messages` TypeCommonsActionMessage[]
      - `type` 'error' | 'info', required
      - `content` string, required
    - `type` string — **This is deprecated.**
    - `description` string — The text that appears in the dialog after the action is clicked.
    - `schedule` 'weekly' | 'daily' | 'hourly'
    - `primary` boolean — A primary action will be more visibly present, whether in Sheet or Workbook.
    - `confirm` boolean — Whether to show a modal to confirm the action
    - `icon` string — Icon will work on primary actions. It will only accept an already existing Flatfile design system icon.
    - `requireAllValid` boolean — **This is deprecated. Use `constraints` instead.**
    - `requireSelection` boolean — **This is deprecated. Use `constraints` instead.**
    - `inputForm` TypeCommonsInputForm
      - `type` 'simple', required
      - `fields` TypeCommonsInputField[], required
        - `key` string, required — Unique key for a Field.
        - `label` string, required — Visible name of a Field.
        - `description` string — Brief description below the name of the Field.
        - `type` string, required — Field Types inform the user interface how to sort and display data.
        - `defaultValue` unknown
        - `config` TypeCommonsInputConfig
          - `options` TypeCommonsInputEnumPropertyOption[], required
            - `label` string — A visual label for this option, defaults to value if not provided
            - `description` string — A short description for this option
            - `color` string — An optional color to assign this option
            - `icon` string — A reference pointer to a previously registered icon
            - `meta` object — An arbitrary JSON object to be associated with this option and made available to hooks
            - `value` unknown, required
        - `constraints` TypeCommonsInputConstraint[] — Indicate additional validations that will be applied to the Field.
          - `type` 'required', required
    - `constraints` TypeCommonsActionConstraint[] — A limitation or restriction on the action.
      - union
        - object
          - `type` 'hasAllValid', required — Discriminator value: hasAllValid
          - `ignoreSelection` boolean
        - object
          - `type` 'hasSelection', required — Discriminator value: hasSelection
        - object
          - `type` 'hasData', required — Discriminator value: hasData
        - object
          - `type` 'hasColumnEnabled', required — Discriminator value: hasColumnEnabled
    - `mount` union
      - object
        - `type` 'sheet', required — Discriminator value: sheet
        - `slugs` string[]
      - object
        - `type` 'workbook', required — Discriminator value: workbook
        - `slugs` string[]
      - object
        - `type` 'field', required — Discriminator value: field
        - `keys` string[]
      - object
        - `type` 'document', required — Discriminator value: document
      - object
        - `type` 'file', required — Discriminator value: file
    - `guide` TypeCommonsGuide
      - `content` string, required — Markdown guidance for this action
    - `guardrail` TypeCommonsGuardrail
      - `content` string, required — Markdown guardrail for this action
    - `createdFrom` string — Action ID
    - `lastPropagatedAt` string, date-time — The last time this action was propagated to a workbook
    - `deletedAt` string, date-time — The time this action was deleted
    - `invalidConditionalMessaging` boolean — When enabled, shows dynamic confirmation messages based on record validation status instead of the static description
    - `validRecordsMessage` string — Custom message to show when all records are valid (only used when invalidConditionalMessaging is true)
    - `invalidRecordsMessage` string — Custom message to show when there are invalid records (only used when invalidConditionalMessaging is true)
    - `label` string, required — The text on the Button itself

## Response `200`

Response with status 200

- TypeFilesFileResponse
  - `data` TypeFilesFile, required — Any uploaded file of any type
    - `id` string, required — File ID
    - `name` string, required — Original filename
    - `description` string — Description of the file
    - `ext` string, required — Extension of the file
    - `mimetype` string, required — MIME Type of the file
    - `encoding` string, required — Text encoding of the file
    - `status` 'partial' | 'analyzing' | 'analyzed' | 'complete' | 'archived' | 'purged' | 'failed', required — Status of the file. Partial: File is uploaded but not yet processed. Analyzing: Smart Extract is running. Analyzed: Smart Extract has finished running. Complete: File has been extracted and is ready to be used. Archived: File has been archived. Purged: File has been purged. Failed: File has failed to be extracted.
    - `mode` 'import' | 'export'
    - `size` integer, required — Size of file in bytes
    - `bytesReceived` integer, required — Number of bytes that have been uploaded so far (useful for progress tracking)
    - `createdAt` string, date-time, required — Date the file was created
    - `updatedAt` string, date-time, required — Date the file was last updated
    - `expiredAt` string, date-time — Date the file was expired
    - `spaceId` string, required — Space ID
    - `workbookId` string — Workbook ID
    - `sheetId` string — Sheet ID
    - `actions` TypeCommonsAction[]
      - `slug` string — **This is deprecated. Use `operation` instead.**
      - `operation` string — This will become the job operation that is triggered
      - `mode` 'foreground' | 'background' | 'toolbarBlocking' — Foreground actions will prevent interacting with the resource until complete
      - `tooltip` string — A tooltip that appears when hovering the action button
      - `messages` TypeCommonsActionMessage[]
        - `type` 'error' | 'info', required
        - `content` string, required
      - `type` string — **This is deprecated.**
      - `description` string — The text that appears in the dialog after the action is clicked.
      - `schedule` 'weekly' | 'daily' | 'hourly'
      - `primary` boolean — A primary action will be more visibly present, whether in Sheet or Workbook.
      - `confirm` boolean — Whether to show a modal to confirm the action
      - `icon` string — Icon will work on primary actions. It will only accept an already existing Flatfile design system icon.
      - `requireAllValid` boolean — **This is deprecated. Use `constraints` instead.**
      - `requireSelection` boolean — **This is deprecated. Use `constraints` instead.**
      - `inputForm` TypeCommonsInputForm
        - `type` 'simple', required
        - `fields` TypeCommonsInputField[], required
          - `key` string, required — Unique key for a Field.
          - `label` string, required — Visible name of a Field.
          - `description` string — Brief description below the name of the Field.
          - `type` string, required — Field Types inform the user interface how to sort and display data.
          - `defaultValue` unknown
          - `config` TypeCommonsInputConfig
            - `options` TypeCommonsInputEnumPropertyOption[], required
              - …
          - `constraints` TypeCommonsInputConstraint[] — Indicate additional validations that will be applied to the Field.
            - `type` 'required', required
      - `constraints` TypeCommonsActionConstraint[] — A limitation or restriction on the action.
        - union
          - object
            - `type` 'hasAllValid', required — Discriminator value: hasAllValid
            - `ignoreSelection` boolean
          - object
            - `type` 'hasSelection', required — Discriminator value: hasSelection
          - object
            - `type` 'hasData', required — Discriminator value: hasData
          - object
            - `type` 'hasColumnEnabled', required — Discriminator value: hasColumnEnabled
      - `mount` union
        - object
          - `type` 'sheet', required — Discriminator value: sheet
          - `slugs` string[]
        - object
          - `type` 'workbook', required — Discriminator value: workbook
          - `slugs` string[]
        - object
          - `type` 'field', required — Discriminator value: field
          - `keys` string[]
        - object
          - `type` 'document', required — Discriminator value: document
        - object
          - `type` 'file', required — Discriminator value: file
      - `guide` TypeCommonsGuide
        - `content` string, required — Markdown guidance for this action
      - `guardrail` TypeCommonsGuardrail
        - `content` string, required — Markdown guardrail for this action
      - `createdFrom` string — Action ID
      - `lastPropagatedAt` string, date-time — The last time this action was propagated to a workbook
      - `deletedAt` string, date-time — The time this action was deleted
      - `invalidConditionalMessaging` boolean — When enabled, shows dynamic confirmation messages based on record validation status instead of the static description
      - `validRecordsMessage` string — Custom message to show when all records are valid (only used when invalidConditionalMessaging is true)
      - `invalidRecordsMessage` string — Custom message to show when there are invalid records (only used when invalidConditionalMessaging is true)
      - `label` string, required — The text on the Button itself
    - `origin` 'filesystem' | 'googledrive' | 'box' | 'onedrive'
    - `treatments` TypeFilesFileTreatments[]

## Other responses

- `400` — Error response with status 400
- `404` — Error response with status 404

---

[API](https://skmtc.net/flatfile/apis/api-reference.md) · [All operations](https://skmtc.net/flatfile/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/flatfile/api-reference/revisions/9d3a9979cd96/schema)
