openapi: 3.2.0 info: title: Browser Use Public API v2 Files API 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 tags: - name: Files 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 security: - APIKeyHeader: [] 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' '500': description: Failed to generate upload URL content: application/json: schema: $ref: '#/components/schemas/InternalServerError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /files/browsers/{session_id}/presigned-url: post: tags: - Files summary: Browser Session Upload File Presigned Url description: Generate a secure presigned URL for uploading files to a browser session. operationId: browser_session_upload_file_presigned_url_files_browsers__session_id__presigned_url_post security: - APIKeyHeader: [] 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' '500': description: Failed to generate upload URL content: application/json: schema: $ref: '#/components/schemas/InternalServerError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /files/tasks/{task_id}/output-files/{file_id}: get: tags: - Files summary: Get Task Output File Presigned Url description: Get secure download URL for an output file generated by the AI agent. operationId: get_task_output_file_presigned_url_files_tasks__task_id__output_files__file_id__get security: - APIKeyHeader: [] parameters: - name: task_id in: path required: true schema: type: string format: uuid title: Task Id - name: file_id in: path required: true schema: type: string format: uuid title: File Id responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/TaskOutputFileResponse' '404': description: Task or file not found content: application/json: schema: anyOf: - $ref: '#/components/schemas/TaskNotFoundError' - $ref: '#/components/schemas/OutputFileNotFoundError' title: Response 404 Get Task Output File Presigned Url Files Tasks Task Id Output Files File Id Get '500': description: Failed to generate download URL content: application/json: schema: $ref: '#/components/schemas/DownloadUrlGenerationError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: InternalServerError: properties: detail: type: string title: Detail default: An internal server error occurred type: object title: InternalServerError description: Error response for internal server errors DownloadUrlGenerationError: properties: detail: type: string title: Detail default: Failed to generate download URL type: object title: DownloadUrlGenerationError description: Error response when download URL generation fails TaskNotFoundError: properties: detail: type: string title: Detail default: Task not found type: object title: TaskNotFoundError description: Error response when a task is not found 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 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 OutputFileNotFoundError: properties: detail: type: string title: Detail default: Output file not found type: object title: OutputFileNotFoundError description: Error response when an output file is not found UnsupportedContentTypeError: properties: detail: type: string title: Detail default: Unsupported content type type: object title: UnsupportedContentTypeError description: Error response for unsupported content types 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. 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.0 minimum: 1.0 title: Sizebytes type: object required: - fileName - contentType - sizeBytes title: UploadFileRequest description: Request model for uploading a file to the user's files bucket. TaskOutputFileResponse: properties: id: type: string format: uuid title: ID description: Unique identifier for the file fileName: type: string title: File Name description: Name of the file downloadUrl: type: string title: Download URL description: URL to download the file type: object required: - id - fileName - downloadUrl title: TaskOutputFileResponse description: Response model for output file requests. securitySchemes: APIKeyHeader: type: apiKey in: header name: X-Browser-Use-API-Key