You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FilesApi addFile error: 'Invalid input: file - This field was not expected.', #682
import {Configuration as PipeDriveV1Configuration, FilesApi} from "pipedrive/v1";
const apiConfig = new PipeDriveV1Configuration({apiKey: ####});
const apiInstance = new FilesApi(tmpApiConfig);
const opts = {
file: 'test.csv',
activity_id: 123
}
await apiInstance.addFile(opts)
{
success: false,
error: 'Invalid input: file - This field was not expected.',
error_info: 'Please check developers.pipedrive.com for more information about Pipedrive API.',
data: null,
additional_data: null
}
// All tutorial Node.js code examples are for reference only and shouldn't be used in production code as is.// In production, a new Configuration() instance should be initialised separately for each request.constpipedrive=require('pipedrive');constfs=require('fs');const{ File }=require('node:buffer');// Configure authorization by setting api key// PIPEDRIVE_API_KEY is an environment variable that holds real api keyconstdefaultClient=newpipedrive.v1.Configuration({apiKey: process.env.PIPEDRIVE_API_KEY,});asyncfunctionaddFile(){try{console.log('Sending request...');constapi=newpipedrive.v1.FilesApi(defaultClient);// Read the file from disk into a Bufferconstfilepath='./example.txt';constfileBuffer=fs.readFileSync(filepath);// Create a File object from the bufferconstfileToUpload=newFile([fileBuffer],'example.txt',{type: 'text/plain',});// Upload the file - note the object structureconstresponse=awaitapi.addFile({file: fileToUpload,deal_id: 1,// You can also associate with other entities:// person_id: 1,// org_id: 1,// activity_id: 1,// product_id: 1});console.log('File was added successfully!',response);}catch(err){consterrorToLog=err.context?.body||err;console.log('Adding a file failed',errorToLog);}}addFile();
Activity
youssef-saber-3 commentedon Feb 5, 2026
Hey , here is an updated example of the file upload, you can find it in our pipedrive file upload tutorial https://developers.pipedrive.com/tutorials/adding-files-via-pipedrive-api?step=7