> ## Documentation Index
> Fetch the complete documentation index at: https://browseruse-0aece648-pricing-docs-rework.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Session Upload File Presigned Url

> Generate a secure presigned URL for uploading files to an agent session.



## OpenAPI

````yaml /cloud/openapi/v2.json post /files/sessions/{session_id}/presigned-url
openapi: 3.1.0
info:
  title: Browser Use Public API v2
  summary: Browser Use API for running web agents (v2)
  version: 2.0.0
servers:
  - url: https://api.browser-use.com/api/v2
    description: Production server
security: []
paths:
  /files/sessions/{session_id}/presigned-url:
    post:
      tags:
        - Files
      summary: Agent Session Upload File Presigned Url
      description: Generate a secure presigned URL for uploading files to an agent session.
      operationId: >-
        agent_session_upload_file_presigned_url_files_sessions__session_id__presigned_url_post
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Session Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadFileRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadFilePresignedUrlResponse'
        '400':
          description: Unsupported content type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnsupportedContentTypeError'
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionNotFoundError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Failed to generate upload URL
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    UploadFileRequest:
      properties:
        fileName:
          type: string
          maxLength: 255
          minLength: 1
          title: File Name
          description: The name of the file to upload
        contentType:
          type: string
          enum:
            - image/jpg
            - image/jpeg
            - image/png
            - image/gif
            - image/webp
            - image/svg+xml
            - application/pdf
            - application/msword
            - >-
              application/vnd.openxmlformats-officedocument.wordprocessingml.document
            - application/vnd.ms-excel
            - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
            - text/plain
            - text/csv
            - text/markdown
          title: Content Type
          description: The content type of the file to upload
        sizeBytes:
          type: integer
          maximum: 10485760
          minimum: 1
          title: Sizebytes
      type: object
      required:
        - fileName
        - contentType
        - sizeBytes
      title: UploadFileRequest
      description: Request model for uploading a file to the user's files bucket.
    UploadFilePresignedUrlResponse:
      properties:
        url:
          type: string
          title: URL
          description: The URL to upload the file to.
        method:
          type: string
          const: POST
          title: Method
          description: The HTTP method to use for the upload.
        fields:
          additionalProperties:
            type: string
          type: object
          title: Fields
          description: The form fields to include in the upload request.
        fileName:
          type: string
          title: File Name
          description: >-
            The name of the file to upload (should be referenced when user wants
            to use the file in a task).
        expiresIn:
          type: integer
          title: Expires In
          description: The number of seconds until the presigned URL expires.
      type: object
      required:
        - url
        - method
        - fields
        - fileName
        - expiresIn
      title: UploadFilePresignedUrlResponse
      description: Response model for a presigned upload URL.
    UnsupportedContentTypeError:
      properties:
        detail:
          type: string
          title: Detail
          default: Unsupported content type
      type: object
      title: UnsupportedContentTypeError
      description: Error response for unsupported content types
    SessionNotFoundError:
      properties:
        detail:
          type: string
          title: Detail
          default: Session not found
      type: object
      title: SessionNotFoundError
      description: Error response when a session is not found
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    InternalServerError:
      properties:
        detail:
          type: string
          title: Detail
          default: An internal server error occurred
      type: object
      title: InternalServerError
      description: Error response for internal server errors
    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

````