> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.pinnacle.sh/v-2/methods/upload-from-path/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.pinnacle.sh/_mcp/server. # Upload from Path > Upload files from local filesystem or browser to Pinnacle cloud storage Uploads a file to Pinnacle's cloud storage. The method handles file validation, MIME type detection, and manages the complete upload process including pre-signed URL generation. ## Parameters #### TypeScript | Parameter | Type | Description | | ----------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------- | | `fileInput` | `string \| File` | File path string (Node.js) or File object (browser) | | `options` | `object` (optional) | Upload configuration | |   `name` | `string` | Display name (defaults to file basename or File.name) | |   `options` | [`UploadFileParams.Options`](/api-reference/tools/upload-file#request.body.options) | Additional file options (e.g., download settings) | #### Python | Parameter | Type | Description | | | ---------------------------------------------------------------------------- | ------------------------------------------------- | ----------------------------------------------- | - | | `file_path` | `str` | Absolute or relative path to the file to upload | | | `name` | `str` (optional) | Display name (defaults to file basename) | | | `options` | | | | | [`UploadFileOptions`](/api-reference/tools/upload-file#request.body.options) | | | | | (optional) | Additional file options (e.g., download settings) | | | #### Ruby | Parameter | Type | Description | | ------------------ | --------------------------------------------------------------------------------------- | ------------------------------------------------- | | `file_path` | `String` | Absolute or relative path to the file to upload | | `name:` | `String` (optional) | Display name (defaults to file basename) | | `options:` | [`UploadFileOptions`](/api-reference/tools/upload-file#request.body.options) (optional) | Additional file options (e.g., download settings) | | `request_options:` | `Hash` (optional) | Additional request options | ## Returns Returns the download URL as a string. ## Errors | Error | Description | | --------------------- | -------------------------------------------------------------------------------------------- | | `NotFoundError` | File does not exist at the specified path (Node.js only) | | `BadRequestError` | Path points to a directory instead of a file, or invalid file input type for the environment | | `InternalServerError` | File system operation failed (permissions, disk errors) | ## Example Implementation #### TypeScript ### Node.js ```typescript import { PinnacleClient } from 'rcs-js'; const client = new PinnacleClient({ apiKey: process.env.PINNACLE_API_KEY }); // Upload from file path async function uploadDocument() { try { // Returns the download URL as a string const downloadUrl = await client.tools.file.uploadFromPath( './media/video.mp4', { name: 'Product Demo Video', options: { download: { expiresAt: '2025-12-31T23:59:59Z' } } } ); console.log('Download URL:', downloadUrl); return downloadUrl; } catch (error) { throw error; } } ``` ### Browser ```typescript import { PinnacleClient } from 'rcs-js'; const client = new PinnacleClient({ apiKey: process.env.PINNACLE_API_KEY }); // Upload from File object (e.g., from file input) async function uploadFromInput(file: File) { try { const downloadUrl = await client.tools.file.uploadFromPath( file, { name: 'User Upload', options: { download: { expiresAt: '2025-12-31T23:59:59Z' } } } ); console.log('Download URL:', downloadUrl); return downloadUrl; } catch (error) { throw error; } } // Example with file input element document.getElementById('fileInput')?.addEventListener('change', async (e) => { const file = (e.target as HTMLInputElement).files?.[0]; if (file) { await uploadFromInput(file); } }); ``` #### Python ```python from rcs import AsyncPinnacle import os client = AsyncPinnacle(api_key=os.environ.get("PINNACLE_API_KEY")) # Upload from file path async def upload_document(): try: # Returns the download URL as a string download_url = await client.tools.file.upload_from_path( './media/video.mp4', name='Product Demo Video', options={ 'download': { 'expires_at': '2025-12-31T23:59:59Z' } } ) # download_url is a string print('Download URL:', download_url) return download_url except Exception as error: raise error ``` #### Ruby ```ruby require 'pinnacle' client = Pinnacle::Client.new(api_key: ENV['PINNACLE_API_KEY']) # Upload from file path def upload_document(client) # Returns the download URL as a string download_url = client.tools.file.upload_from_path( './media/video.mp4', name: 'Product Demo Video', options: { download: { expires_at: '2025-12-31T23:59:59Z' } } ) # download_url is a string puts "Download URL: #{download_url}" download_url rescue Pinnacle::Errors::NotFoundError => e puts "File not found: #{e.message}" raise e rescue Pinnacle::Errors::ClientError => e puts "Invalid file: #{e.message}" raise e end ``` > One API for RCS, iMessage, MMS, and SMS. Build, test, and scale every channel — send your first message in minutes, not weeks.