Retreive custom field value of a Lead

Hi there,

I have set a custom field (Single Option Field) to filter my Leads. It’s a “Yes” / “No” filter.
I’m trying to retreive the value of this custom field for every leads (= not deals) in my pipedrive.

I’ve read the doc and tried using the API but can’t get the value of the field.

What I’ve tried :

  • /dealFields/{id}/?api_token=myToken => Only gives me the keys (and Ids) of custom fields
  • /leads/{leadId}. => Doesn’t give the custom fields
  • /leads/{leadId}?fields=custom_fields(key,custom_field_key) => Doesn’t give the custom fields

Do you know how I can achieve this ?

Hi, @Cparam
I might be wrong, but I believe you’re getting this field, just can’t identify it.
The API call returns the fields’ and labels’ IDs instead of names and actual labels.
First run the call /dealFields - in the response, using the field name, find the field ID and look into the options: the labels Yes and No should have numeric ids. Copy these values (field ID and options).
Then run /leads/{leadId} - in the result search the id of the field and you’ll get the value, which is the id of the label.
Hope this is clear enough.