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

# Upload Workspace Files

> Presigned PUT URLs for input files, placed under ``uploads/`` in the
workspace. The agent pulls them in at the start of every run. URLs are
pinned to the declared Content-Type and exact Content-Length.



## OpenAPI

````yaml /cloud/openapi/v4.json post /workspaces/{workspace_id}/files/upload
openapi: 3.1.0
info:
  title: Browser Use Public API v4
  summary: Browser Use agent runs API (v4)
  version: 4.0.0
servers:
  - url: https://api.browser-use.com/api/v4
    description: Production server
security: []
tags:
  - name: Runs
  - name: Sessions
  - name: Workspaces
  - name: Browsers
  - name: Profiles
paths:
  /workspaces/{workspace_id}/files/upload:
    post:
      tags:
        - Workspaces
      summary: Upload Workspace Files
      description: |-
        Presigned PUT URLs for input files, placed under ``uploads/`` in the
        workspace. The agent pulls them in at the start of every run. URLs are
        pinned to the declared Content-Type and exact Content-Length.
      operationId: upload_workspace_files_workspaces__workspace_id__files_upload_post
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceFileUploadRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceFileUploadResponse'
        '400':
          description: Invalid request (bad session/workspace pairing or file path).
        '403':
          description: Zero Data Retention is enabled on the project (V4 unsupported).
        '404':
          description: Run, session, workspace, or profile not found.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    WorkspaceFileUploadRequest:
      properties:
        files:
          items:
            $ref: '#/components/schemas/WorkspaceFileUploadItem'
          type: array
          maxItems: 10
          minItems: 1
          title: Files
      type: object
      required:
        - files
      title: WorkspaceFileUploadRequest
    WorkspaceFileUploadResponse:
      properties:
        files:
          items:
            $ref: '#/components/schemas/WorkspaceFileUploadResponseItem'
          type: array
          title: Files
      type: object
      required:
        - files
      title: WorkspaceFileUploadResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkspaceFileUploadItem:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          description: Filename, e.g. "data.csv"
        contentType:
          type: string
          maxLength: 255
          title: Contenttype
          description: MIME type, e.g. "text/csv"
          default: application/octet-stream
        size:
          type: integer
          maximum: 52428800
          minimum: 1
          title: Size
          description: Exact file size in bytes; the presigned URL is pinned to it.
      type: object
      required:
        - name
        - size
      title: WorkspaceFileUploadItem
    WorkspaceFileUploadResponseItem:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: >-
            Upload id. Pass THIS in RunCreateRequest.attachedFileIds to attach
            the file to a run.
        name:
          type: string
          title: Name
          description: Original filename from the request
        storedName:
          type: string
          title: Storedname
          description: Sanitized filename the object is stored under, e.g. "data.csv".
        path:
          type: string
          title: Path
          description: Path within the workspace, e.g. "uploads/data.csv"
        willOverride:
          type: boolean
          title: Willoverride
          description: >-
            True if a file with this stored_name already exists in the workspace
            and uploading will replace it. Surface a warning to the user.
        uploadUrl:
          type: string
          title: Uploadurl
          description: >-
            Presigned PUT URL (5 min expiry). PUT the file bytes with the
            matching Content-Type and Content-Length headers.
      type: object
      required:
        - id
        - name
        - storedName
        - path
        - willOverride
        - uploadUrl
      title: WorkspaceFileUploadResponseItem
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-Browser-Use-API-Key

````