Build To Scale
Build To Scale
Logo
Build to Scale
Adding a File via Pipedrive API
Contents
Adding a File via Pipedrive API ................................................................................................... 2
1. Introduction ...................................................................................................................... 2
2. Get your API token and company domain ............................................................................ 2
3. Payload for adding a file ..................................................................................................... 2
4. Making the API request ...................................................................................................... 3
5. Check the result ................................................................................................................ 3
6. Full working example (PHP) ................................................................................................ 4
7. Full working example (Node.js) ........................................................................................... 5
Adding a File via Pipedrive API
1. Introduction
In Pipedrive, you're able to add several different types of files - images, spreadsheets, text files, etc.
You can also associate files with a Deal, Lead, Person, Organization, Activity or even a Product. In
this example, we're going to add a text file and connect it to a Person, so it'll appear in the details
view of that Person. If you want to see the finished code for adding a file, you can find it below in PHP
and Node.js.
You can also try adding a file through our Postman API collection using the endpoint.
Next, a file path must be added. When adding the file path, it's suggested to have the file you want to
add in the same folder as the code file triggering the process. This way you can just write the file
name after ./ and the file will be added properly. If the file is located in some other place on your
computer, be sure to enter a proper file path based on the location (file paths differ for different
operating systems).
You can also associate a file with a Deal, Organization, Person, Activity, or Product. To do that, you
need to know the specific ID of that item. To see more information, you can check our API Reference.
In this example, we're going to associate the file with a Person, so it will appear in the details view of
that Person.
4. Making the API request
To make a request, you'll need the correct URL meant for adding files. All available endpoints and
their URLs are described in our API Reference. You must provide the API token as part of the query
string for all requests at the end of the URL, an example would look like this:
You need to create a variable that holds the correct URL for file adding and
add variable to it:
This part of the code is more complex and you don't need to understand it right away, all you need to
know is that it contains everything to make a POST request with your data against our API. Simply
copy and paste this:
$ch = curl_i
Then you can check if data returned in the result is not empty:
And now you should check if file ID came back as returned data. If it did, then this means that the file
was added successfully.
You can also check the changes in the Pipedrive web app in the item's details view, where you added
the file. In this example, it would be seen in the details view of the Person with the person_id of 16.
Use command to execute the code in the command line. Here's an example
output if the file was added: