You can use the API to download and upload binary files. The API supports three types of file uploads: chat files (with automatic expiration), project assets, and user/bot avatars.
File Upload Types
Chat files: Files uploaded during conversations. These have automatic expiration (default: 30 days).
Assets: Project assets that can be used across the platform. These have no expiration by default, but can be set via query parameter. Images automatically generate thumbnails.
Avatars: User profile photos or bot avatars. These have no expiration and are stored in a fixed path structure.
Upload a project asset
POST https://api.tiledesk.com/v3/:project_id/files/assets
Uploads a file as a project asset. Assets have no expiration by default, but can be set via query parameter.
Path Parameters
Query Parameters
Example:
Upload a chat file
POST https://api.tiledesk.com/v3/:project_id/files/chat
Uploads a file for use in chat conversations. The file will automatically expire after a configured time (default: 30 days).
Path Parameters
Example:
Upload user profile photo or bot avatar
POST https://api.tiledesk.com/v3/:project_id/files/users/photo
Uploads a profile photo for a user or avatar for a bot. Only image files are allowed (.png, .jpg, .jpeg, .gif). The file is stored in a fixed path structure: uploads/users/{user_id|bot_id}/images/photo.jpg. Automatically generates a 200x200 thumbnail. Requires agent role or bot/subscription authentication.
Path Parameters
Query Parameters
Example (user photo):
Example (bot avatar):
Get the binary file as stream by filename path
GET https://api.tiledesk.com/v3/files
Retrieves a file as a stream by its path. The file is returned with appropriate Content-Type headers. If the file is not found in the primary storage, the system automatically falls back to a secondary storage service.
Query Parameters
Example:
Example (as attachment):
Download the binary file by filename path
GET https://api.tiledesk.com/v3/files/download
Downloads a file by its path. The file is returned with Content-Disposition header set to attachment, forcing download with the original filename.
Query Parameters
Example:
DELETE https://api.tiledesk.com/v3/files
Deletes a file by its path. If the file is an image, the associated thumbnail (if exists) will also be deleted automatically. The system checks both primary and fallback storage services.
Query Parameters
Example (delete user photo):
Example (delete project asset):
400: Bad request - Invalid file, missing parameters, or upload error
403: Forbidden - File extension not allowed, content verification failed, or insufficient permissions
404: Not found - File or resource not found
413: Payload too large - File exceeds maximum upload size (configurable via MAX_UPLOAD_FILE_SIZE environment variable)
500: Internal server error - Server error during file operations
File Content Verification
All uploaded files are verified to ensure the file content matches the declared MIME type. This prevents security issues by detecting mismatched file types.
Thumbnail Generation
Images uploaded as assets or user/bot avatars automatically generate 200x200 pixel thumbnails. Thumbnails are stored with the pattern thumbnails_200_200-{original_filename} and are automatically deleted when the main file is deleted.