Buckets
BucketsService ¶
Service for managing UiPath storage buckets.
Buckets are cloud storage containers that can be used to store and manage files used by automation processes.
create ¶
Create a new bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Bucket name (must be unique within folder) |
required |
description
|
Optional[str]
|
Optional description |
None
|
identifier
|
Optional[str]
|
UUID identifier (auto-generated if not provided) |
None
|
folder_path
|
Optional[str]
|
Folder to create bucket in |
None
|
folder_key
|
Optional[str]
|
Folder key |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Bucket |
Bucket
|
Newly created bucket resource |
Raises:
| Type | Description |
|---|---|
Exception
|
If bucket creation fails |
Examples:
create_async
async
¶
Async version of create().
delete ¶
Delete a bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier (UUID) |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
folder_key
|
Optional[str]
|
Folder key |
None
|
Raises:
| Type | Description |
|---|---|
LookupError
|
If bucket is not found |
Examples:
delete_async
async
¶
Async version of delete().
delete_file ¶
Delete a file from a bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier |
None
|
blob_file_path
|
str
|
Path to the file in the bucket |
required |
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Examples:
delete_file_async
async
¶
Delete a file from a bucket asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier |
None
|
blob_file_path
|
str
|
Path to the file in the bucket |
required |
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Examples:
download ¶
download(
*,
name=None,
key=None,
blob_file_path,
destination_path,
folder_key=None,
folder_path=None,
)
Download a file from a bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Optional[str]
|
The key of the bucket. |
None
|
name
|
Optional[str]
|
The name of the bucket. |
None
|
blob_file_path
|
str
|
The path to the file in the bucket. |
required |
destination_path
|
str
|
The local path where the file will be saved. |
required |
folder_key
|
Optional[str]
|
The key of the folder where the bucket resides. |
None
|
folder_path
|
Optional[str]
|
The path of the folder where the bucket resides. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither key nor name is provided. |
Exception
|
If the bucket with the specified key is not found. |
download_async
async
¶
download_async(
*,
name=None,
key=None,
blob_file_path,
destination_path,
folder_key=None,
folder_path=None,
)
Download a file from a bucket asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Optional[str]
|
The key of the bucket. |
None
|
name
|
Optional[str]
|
The name of the bucket. |
None
|
blob_file_path
|
str
|
The path to the file in the bucket. |
required |
destination_path
|
str
|
The local path where the file will be saved. |
required |
folder_key
|
Optional[str]
|
The key of the folder where the bucket resides. |
None
|
folder_path
|
Optional[str]
|
The path of the folder where the bucket resides. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither key nor name is provided. |
Exception
|
If the bucket with the specified key is not found. |
exists ¶
Check if bucket exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Bucket name |
required |
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if bucket exists |
Examples:
exists_async
async
¶
Async version of exists().
exists_file ¶
Check if a file exists in a bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier |
None
|
blob_file_path
|
str
|
Path to the file in the bucket (cannot be empty) |
required |
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if file exists, False otherwise |
Note
This method uses short-circuit iteration to stop at the first match, making it memory-efficient even for large buckets. It will raise LookupError if the bucket itself doesn't exist.
Raises:
| Type | Description |
|---|---|
ValueError
|
If blob_file_path is empty or whitespace-only |
LookupError
|
If bucket is not found |
Examples:
exists_file_async
async
¶
Async version of exists_file().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier |
None
|
blob_file_path
|
str
|
Path to the file in the bucket (cannot be empty) |
required |
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if file exists, False otherwise |
Raises:
| Type | Description |
|---|---|
ValueError
|
If blob_file_path is empty or whitespace-only |
LookupError
|
If bucket is not found |
Examples:
get_files ¶
get_files(
*,
name=None,
key=None,
prefix="",
recursive=False,
file_name_glob=None,
folder_key=None,
folder_path=None,
)
Get files using OData GetFiles API (Studio-compatible).
This method uses the GetFiles API which is used by UiPath Studio activities. Use this when you need: - Recursive directory traversal - Glob pattern filtering (e.g., "*.pdf") - Compatibility with Studio activity behavior
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier |
None
|
prefix
|
str
|
Directory path to filter files (default: root) |
''
|
recursive
|
bool
|
Recurse subdirectories for flat view (default: False) |
False
|
file_name_glob
|
Optional[str]
|
File filter pattern (e.g., ".pdf", "data_.csv") |
None
|
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[BucketFile]
|
Iterator[BucketFile]: Iterator of files matching criteria |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither name nor key is provided |
LookupError
|
If bucket not found |
Exception
|
For API errors or invalid responses |
Note
For large buckets with 10,000+ files, consider using list_files() which uses more efficient cursor-based pagination.
Examples:
>>> # Get all PDF files recursively
>>> for file in sdk.buckets.get_files(
... name="my-storage",
... recursive=True,
... file_name_glob="*.pdf"
... ):
... print(f"{file.path} - {file.size} bytes")
>>>
>>> # Get files in specific directory
>>> files = list(sdk.buckets.get_files(
... name="my-storage",
... prefix="reports/"
... ))
get_files_async
async
¶
list ¶
List buckets with auto-pagination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_path
|
Optional[str]
|
Folder path to filter buckets |
None
|
folder_key
|
Optional[str]
|
Folder key (mutually exclusive with folder_path) |
None
|
name
|
Optional[str]
|
Filter by bucket name (contains match) |
None
|
Yields:
| Name | Type | Description |
|---|---|---|
Bucket |
Bucket
|
Bucket resource instances |
Examples:
list_async
async
¶
Async version of list() with auto-pagination.
list_files ¶
List files in a bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier |
None
|
prefix
|
str
|
Filter files by prefix |
''
|
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[BucketFile]
|
Iterator[BucketFile]: Iterator of files in the bucket |
Note
Returns an iterator for memory efficiency. Use list() to materialize all results: files = list(sdk.buckets.list_files(name="my-storage"))
This method automatically handles pagination, fetching up to 500 files per request.
Examples:
list_files_async
async
¶
List files in a bucket asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Bucket name |
None
|
key
|
Optional[str]
|
Bucket identifier |
None
|
prefix
|
str
|
Filter files by prefix |
''
|
folder_key
|
Optional[str]
|
Folder key |
None
|
folder_path
|
Optional[str]
|
Folder path |
None
|
Returns:
| Type | Description |
|---|---|
AsyncIterator[BucketFile]
|
AsyncIterator[BucketFile]: Async iterator of files in the bucket |
Note
Returns an async iterator for memory efficiency. Use list comprehension to materialize: files = [f async for f in sdk.buckets.list_files_async(name="my-storage")]
This method automatically handles pagination, fetching up to 500 files per request.
Examples:
retrieve ¶
Retrieve bucket information by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
The name of the bucket to retrieve. |
None
|
key
|
Optional[str]
|
The key of the bucket. |
None
|
folder_key
|
Optional[str]
|
The key of the folder where the bucket resides. |
None
|
folder_path
|
Optional[str]
|
The path of the folder where the bucket resides. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Bucket |
Bucket
|
The bucket resource instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither bucket key nor bucket name is provided. |
Exception
|
If the bucket with the specified name is not found. |
Examples:
retrieve_async
async
¶
Asynchronously retrieve bucket information by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
The name of the bucket to retrieve. |
None
|
key
|
Optional[str]
|
The key of the bucket. |
None
|
folder_key
|
Optional[str]
|
The key of the folder where the bucket resides. |
None
|
folder_path
|
Optional[str]
|
The path of the folder where the bucket resides. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Bucket |
Bucket
|
The bucket resource instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither bucket key nor bucket name is provided. |
Exception
|
If the bucket with the specified name is not found. |
Examples:
upload ¶
upload(
*,
key=None,
name=None,
blob_file_path,
content_type=None,
source_path=None,
content=None,
folder_key=None,
folder_path=None,
)
Upload a file to a bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Optional[str]
|
The key of the bucket. |
None
|
name
|
Optional[str]
|
The name of the bucket. |
None
|
blob_file_path
|
str
|
The path where the file will be stored in the bucket. |
required |
content_type
|
Optional[str]
|
The MIME type of the file. For file inputs this is computed dynamically. Default is "application/octet-stream". |
None
|
source_path
|
Optional[str]
|
The local path of the file to upload. |
None
|
content
|
Optional[Union[str, bytes]]
|
The content to upload (string or bytes). |
None
|
folder_key
|
Optional[str]
|
The key of the folder where the bucket resides. |
None
|
folder_path
|
Optional[str]
|
The path of the folder where the bucket resides. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither key nor name is provided. |
Exception
|
If the bucket with the specified key or name is not found. |
upload_async
async
¶
upload_async(
*,
key=None,
name=None,
blob_file_path,
content_type=None,
source_path=None,
content=None,
folder_key=None,
folder_path=None,
)
Upload a file to a bucket asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Optional[str]
|
The key of the bucket. |
None
|
name
|
Optional[str]
|
The name of the bucket. |
None
|
blob_file_path
|
str
|
The path where the file will be stored in the bucket. |
required |
content_type
|
Optional[str]
|
The MIME type of the file. For file inputs this is computed dynamically. Default is "application/octet-stream". |
None
|
source_path
|
Optional[str]
|
The local path of the file to upload. |
None
|
content
|
Optional[Union[str, bytes]]
|
The content to upload (string or bytes). |
None
|
folder_key
|
Optional[str]
|
The key of the folder where the bucket resides. |
None
|
folder_path
|
Optional[str]
|
The path of the folder where the bucket resides. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither key nor name is provided. |
Exception
|
If the bucket with the specified key or name is not found. |