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

# Replace file

> Replace a File with a new version.

**Operation ID:** `http.files.replace`

```http theme={null}
POST /v1/orgs/{org}/projects/{project}/files/{file}/versions
```


## OpenAPI

````yaml openapi.json POST /v1/orgs/{org}/projects/{project}/files/{file}/versions
openapi: 3.1.0
info:
  title: Penumbra API
  version: v1
  description: >-
    HTTP reference for Files, search, extraction, reviews, Graph, Shapes and
    sharing.
servers:
  - url: https://api.pnbr.io
    description: Penumbra API
security: []
paths:
  /v1/orgs/{org}/projects/{project}/files/{file}/versions:
    post:
      tags:
        - Files
      summary: Replace file
      description: >-
        Replace a File with a new version.


        Product guidance: [File](/concepts/file), [Synced
        folder](/concepts/source).
      operationId: http.files.replace
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
        - name: project
          in: path
          required: true
          schema:
            type: string
        - name: file
          in: path
          required: true
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            1–200 printable ASCII characters, no surrounding spaces; '.' and
            '..' are reserved. Reuse this key with the same request when
            retrying an uncertain outcome.
          schema:
            type: string
            minLength: 1
            maxLength: 200
            pattern: ^(?!\.{1,2}$)[!-~](?:[ -~]*[!-~])?$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/http_files_replace_request'
      responses:
        2XX:
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/http_files_replace_response'
      security:
        - bearerAuth: []
components:
  schemas:
    http_files_replace_request:
      type: object
      properties:
        upload_id:
          type: string
        expected_current_version_id:
          anyOf:
            - type: string
            - type: 'null'
        source_date:
          type: string
        expected_latest_version_id:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - upload_id
      additionalProperties: false
    http_files_replace_response:
      type: object
      properties:
        request_id:
          type: string
        outcome:
          type: string
          const: queued
        replayed:
          type: boolean
        data:
          type: object
          properties:
            kind:
              type: string
              const: file_replace
            mode:
              type: string
              const: managed_admission
            outcome:
              type: string
              const: queued
            replayed:
              type: boolean
            request_id:
              type: string
            upload_id:
              type: string
            file_operation_id:
              type: string
            file_id:
              type: string
            expected_current_version_id:
              anyOf:
                - type: string
                - type: 'null'
            expected_latest_version_id:
              type: string
            filename:
              type: string
            media_type:
              type: string
            operation:
              type: object
              properties:
                kind:
                  type: string
                  const: create_version
                status:
                  type: string
                  const: queued
                stage:
                  type: string
                  const: validate_input
              required:
                - kind
                - status
                - stage
              additionalProperties: {}
            timings_ms:
              type: object
              propertyNames:
                type: string
              additionalProperties:
                type: number
          required:
            - kind
            - mode
            - outcome
            - replayed
            - request_id
            - upload_id
            - file_operation_id
            - file_id
            - expected_current_version_id
            - filename
            - media_type
            - operation
            - timings_ms
          additionalProperties: {}
      required:
        - request_id
        - outcome
        - replayed
        - data
      additionalProperties: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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