Upload from Path
This page is for version v2 (default).
For other versions, use one of these documentation indexes:
- v2 (default): https://docs.pinnacle.sh/v-2/llms.txt
- v1: https://docs.pinnacle.sh/v1/llms.txt
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
Python
Ruby
| 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 | Additional file options (e.g., download settings) |
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
Python
Ruby
Node.js
import { PinnacleClient } from 'rcs-js';const client = new PinnacleClient({ apiKey: process.env.PINNACLE_API_KEY });// Upload from file pathasync function uploadDocument() {try {// Returns the download URL as a stringconst 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
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 elementdocument.getElementById('fileInput')?.addEventListener('change', async (e) => {const file = (e.target as HTMLInputElement).files?.[0];if (file) {await uploadFromInput(file);}});

