Organize a customer’s project documents
Section: DOC-CP-files-data-folders#folders.
A customer working on several projects needs to find each project's documents together. Give them a folder for the work, store new documents there, and show that folder when they return to the project.
In this recipe, /documents/work holds one application user's work documents. Folder names are organization within that user's storage; they are not separate Travila projects or a way to grant another user access.
Before you start: complete authentication for an application user. Use that same user for folder, upload and listing requests. Your application maintains the association between its project and the folder path.
Prepare a folder and add the first document
Section: DOC-CP-files-data-folders#create-a-folder.
- Choose the folder path your application will use for the project. If your interface displays parent folders, create
/documentsfirst by using that path in the create-folder request. - Create the project's folder:
curl -X POST https://api.travila.ai/api/v1/storage/create-folder \
-H "X-API-Key: sk_your_key_here" \
-H "X-On-Behalf-Of: user_123" \
-H "Content-Type: application/json" \
-d '{
"folderPath": "/documents/work"
}'
Reference: Create a new folder · Request fields.
- Follow the attachment upload recipe, using
/documents/workas the folder path when requesting the upload URL and registering the file. - List files in that folder to display the project's documents. Open a document using a fresh download link for its file ID.
The finished project page shows the uploaded document when the customer returns. Creating /documents/work creates only that folder entry; it does not create a separate /documents entry. Explicitly creating the parents in step 1 keeps a folder-tree interface consistent.
Remove the project’s documents when the customer chooses
Section: DOC-CP-files-data-folders#delete-a-folder.
When the customer no longer needs these documents, first show the files and subfolders affected by deleting the folder. Request confirmation in your application before deleting content the customer may still need. To preserve a document, move it to another folder first.
To delete this folder and its contents:
curl -X POST https://api.travila.ai/api/v1/storage/delete-folder \
-H "X-API-Key: sk_your_key_here" \
-H "X-On-Behalf-Of: user_123" \
-H "Content-Type: application/json" \
-d '{
"folderPath": "/documents/work",
"recursive": true
}'
Reference: Delete a folder · Request fields.
Refresh the folder listing after the operation. If deletion fails, inspect which files remain before offering another attempt: some files may already have been removed.
Document ID: DOC-CP-files-data-folders. Section identities and revisions.