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

# Update a file

> Update a file's metadata or move it to a different folder.

This endpoint can be used to:
- Update the file name
- Move the file to a different folder (must be owned by the same user)

To confirm a direct upload, use POST /api/v1/files/:id/confirm instead.




## OpenAPI

````yaml /openapi.json patch /api/v1/files/{id}
openapi: 3.1.0
info:
  title: Scholarly API V1
  version: v1
  description: API for accessing Scholarly data
  license:
    name: Proprietary
    identifier: Proprietary
servers:
  - url: https://api.scholarlysoftware.com
    description: Production server
security: []
paths:
  /api/v1/files/{id}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    patch:
      tags:
        - Files
      summary: Update a file
      description: |
        Update a file's metadata or move it to a different folder.

        This endpoint can be used to:
        - Update the file name
        - Move the file to a different folder (must be owned by the same user)

        To confirm a direct upload, use POST /api/v1/files/:id/confirm instead.
      operationId: updateFile
      parameters:
        - name: Authorization
          in: header
          required: true
          description: Bearer token
          schema:
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/UpdateFile'
      responses:
        '200':
          description: file updated
          content:
            application/vnd.api+json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/File'
        '401':
          description: unauthorized
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: forbidden
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: not found
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation error
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ValidationError'
      security:
        - bearer_auth: []
components:
  schemas:
    UpdateFile:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              format: uuid
            type:
              type: string
              const: file
              example: file
            attributes:
              type: object
              properties:
                name:
                  type: string
                  example: annual_report.pdf
            relationships:
              type: object
              properties:
                folder:
                  type: object
                  properties:
                    data:
                      oneOf:
                        - type: object
                          required:
                            - type
                            - id
                          properties:
                            type:
                              type: string
                              const: folder
                              example: folder
                            id:
                              type: string
                              format: uuid
                        - type: 'null'
                      description: Set to null to move file to top-level root
                  required:
                    - data
          required:
            - id
            - type
      required:
        - data
    File:
      type: object
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          const: file
          example: file
        attributes:
          type: object
          properties:
            created_at:
              type: string
              format: datetime
            updated_at:
              type: string
              format: datetime
            name:
              type: string
              example: annual_report.pdf
            content_type:
              type:
                - string
                - 'null'
              example: application/pdf
            byte_size:
              type:
                - integer
                - 'null'
              example: 1024000
            checksum_md5:
              type:
                - string
                - 'null'
            url:
              type:
                - string
                - 'null'
            locked:
              type:
                - boolean
                - 'null'
            state:
              type: string
        relationships:
          type: object
          properties:
            folder:
              type: object
              properties:
                links:
                  type: object
                  properties:
                    related:
                      type:
                        - string
                        - 'null'
                      format: uri
                  required:
                    - related
                meta:
                  type: object
              anyOf:
                - required:
                    - links
                - required:
                    - meta
            created_by:
              type: object
              properties:
                links:
                  type: object
                  properties:
                    related:
                      type:
                        - string
                        - 'null'
                      format: uri
                  required:
                    - related
                meta:
                  type: object
              anyOf:
                - required:
                    - links
                - required:
                    - meta
      required:
        - id
        - type
        - attributes
    Error:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              status:
                type: string
              title:
                type: string
              detail:
                type: string
            required:
              - status
              - title
      required:
        - errors
    ValidationError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              status:
                type: string
                example: '422'
              title:
                type: string
                example: Validation Error
              detail:
                type: string
                example: Label can't be blank
            required:
              - status
              - title
              - detail
      required:
        - errors
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````