# Add a File to a Folder This is a two-step workflow: first upload the file using `upload_files`, then place it in a target folder using `add_file_to_folder`. ## Step 1: Upload the file ```{code-block} python from io import BytesIO from pathlib import Path from uncountable.core import AuthDetailsApiKey, Client from uncountable.core.client import ClientConfig from uncountable.core.file_upload import DataFileUpload, UploadedFile client: Client = Client( base_url="", auth_details=AuthDetailsApiKey( api_id="", api_secret_key="" ), config=ClientConfig(allow_insecure_tls=False), ) filepath = Path("") file_io: BytesIO = BytesIO(filepath.read_bytes()) upload_file_response: list[UploadedFile] = client.upload_files( file_uploads=[DataFileUpload(data=file_io, name=filepath.name)] ) file_id = upload_file_response[0].file_id ``` ## Step 2: Add the file to a folder ```{code-block} python from uncountable.types import identifier_t response = client.add_file_to_folder( file_id=file_id, folder_key=identifier_t.IdentifierKeyId(id=), ) ``` Example Response: ```{code} Data(modification_made=True, result_id=4521, entity=Entity(id=892, type=), result_values=None) ``` To add the file to the root folder instead of a specific folder: ```{code-block} python response = client.add_file_to_folder( file_id=file_id, folder_key=identifier_t.IdentifierKeyRefName(ref_name="root"), ) ```