Update a custome deal field for a specific deal

I’m curious if this is currently possible via API or BULK update from spreadsheet? Our organization needs this ability to be able to integrate with our data platform. We have created custom deal fields for YTD sales from each deal respectively and would like to be able to automate updating these fields to be able to use pipedrive for accurate and up to date reporting with out having someone manually update each of these fields.

Hey @rwhittaker, yes this is definitely possible via either option - although you would need to work with the API to bulk update via a spreadsheet.
What process do you currently have in mind for running this update?

How would one update a custom dealField? According to the API docs, there isn’t a value for custom fields in the update deal endpoint, although I suspect one could add the field ID to the URL?

Yes, exactly, you would just add whatever the ID of the field is to the endpoint
https://developers.pipedrive.com/docs/api/v1/#!/DealFields/put_dealFields_id

This thread helped me understand the same problem as JohnBell. Thanks for the answer. I think it would be good if it was better stated in the API documentation though.

What about the field’s API key, when is that key supposed to be used?

The Field’s API key is using for returning results. So, if you’re using (for example) a GET /deals/{id}, the body response will include the API Key along with the Field Name. We use this instead of ID as it’s how you’re able to tell the difference between Fields of similar names where you have multiple numbers (IDs) that could easily get confused between each other.

Ok, I understand. Thanks for the answer!

1 Like

Hello,

I’d like to know how to update a deal’s custom field via API, so I found this topic, but I still can’t figure how to do it…

I tried the following endpoints, but none of them seems to do the job:
https://developers.pipedrive.com/docs/api/v1/#!/Deals/put_deals_id > can update a Deal, but not it’s custom fields
https://developers.pipedrive.com/docs/api/v1/#!/DealFields/put_dealFields_id > updates a DealField, not a specific Deal’s dealField

Any help would be appreciated, thanks!

Hey @hugoskwirrel
Missed your post until now. A similar question was answered here, but let me copy what was written:

When using the Pipedrive API doc, please keep in mind it is more of an example rather than a be-all-end-all option and it is best to use an API Development Environment like Postman. To GET all the organization fields, this endpoint can be used to pinpoint the API hash or the field API key: https://api.pipedrive.com/v1/organizationFields?api_token= 16

Knowing which custom field you want to update for a specific organization, feel free to use:
https://api.pipedrive.com/v1/organizations/ 16[ORG ID]?api_token=

and in the body:
{
“API hash or field API key”:“intended value”,
“API hash or field API key”:“intended value”
}

Note: if looking to update one field only, remove the comma “,” at the end of the first line in the body.

Hi @David,

Thank you very much for your answer. I was not sure how to do it since the documentation doesn’t talk about updating custom fields, but now I understand :slight_smile:

1 Like

Good point, I’ll try to get our documentation updated for this. :slight_smile:

Hi @David,

I have a similar doubt but unfortunately none this answers helped me. My case is, I have a custom field in a deal that I want to update the value of this custom field. Example, when I use the endpoint to get details of deal I get this:
"data": {
"id": 14221,
"creator_user_id": {
...
},
"user_id": {
...
},
"person_id": {
...
},
"0c8034019b1b62d9173848713fe487829a887e": null,
}

The field “0c8034019b1b62d9173848713fe487829a887e” is what I want to update the value. Which endpoint I need to use to do this?

Hey @Gabrieli you need to use this one: https://developers.pipedrive.com/docs/api/v1/#!/Deals/put_deals_id.

1 Like

Hi @diego.mendez,

I tried use this endpoint but it returns an error 400, I just can update fields like title, user… but custom fields I can’t.

Can you put the exact PUT request you’re doing on this?

Sure, I’m using curl and PHP

$data = array('0c8034019b1b62d9173848713fe487829a887e' => $newValue);
$url = "https://api.pipedrive.com/v1/deals/14221?api_token=xxxxxxxxxxxxxxxxxx";
$request = curl_init($url);
curl_setopt($request, CURLOPT_HEADER, array(
"content-type: application/json"
));
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($request, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'PUT');
$response = curl_exec($request);

And it returns this

"{"success":false,"error":"Bad request","error_info":"Acesse developers.pipedrive.com para mais informa\u00e7\u00f5es sobre a API do Pipedrive.","data":null,"additional_data":null}"

Just a update, because I don’t know if I made it clear, what I’m trying to change it’s not the label of field 0c8034019b1b62d9173848713fe487829a887e. I want to change the value, “0c8034019b1b62d9173848713fe487829a887e”: null, I want to change it from null to other value.

Any news about it?

Hi Gabrieli. I just tested your code and it actually works fine for me.

The first thing that comes to mind is to double check that the key is correct and actually a custom field of the deal, and not of the linked contact, organisation, etc.

If it’s correct, is it possible that the problem lies somewhere else in the code? For example, is $newValue a string or a complex object?

Also, you can consider using this library https://github.com/IsraelOrtuno/pipedrive or an http client like Guzzle https://github.com/guzzle/guzzle to build the requests.

Hi @dani, thanks for your answer I’ll try what you said. I’ll post here any update that I’ll have!

1 Like

Hi all, here’s a tutorial on how to update the value of a custom field, I hope you’ll find it useful: https://pipedrive.readme.io/docs/updating-custom-field-value

1 Like