Add/Edit/Update options of a custom Field

for my project I have a custom deal field of field type “Single option”. I want an API access to change/update these options. So lets say I so far have these options:
{ label: ‘m@m’, id: 29 },
{ label: ‘a@a’, id: 30 }

Now in my project I create something that makes me want to add a new option. I have tried for hours now, but I can’t get it done. In the documentations I found ways to update the value of a custom field, but I found nothing that tells me how to change the selection options for my custom field. The closest I got is this:

async function addCustomFieldOption(option) {
try {
console.log(“Adding option to custom field…”);

  // Get the current custom field
  const FIELD_NAME = 'Empfehlungsgeber-EMail'; 
  const fieldsApi = new pipedrive.DealFieldsApi(defaultClient);
  // Get all Deal fields (keep in mind pagination)
  const dealFields = await fieldsApi.getDealFields();
  // Find a field you would like to get the options from
  const customField = => === FIELD_NAME);
  // Get the current options
  const currentOptions = customField.options;
  // Get the largest ID
  let largestId = 0;
  for (let i = 0; i < currentOptions.length; i++) {
    if (currentOptions[i].id > largestId) {
      largestId = currentOptions[i].id;
  // Add the new option to the options array with a new ID
    label: option,
    id: largestId + 1

  const fieldId =;
  // Update the custom field with the new option
  const updatedField = await fieldsApi.updateDealField(fieldId, customField);

  console.log(`Option "${option}" was added to custom field with ID: ${fieldId}`);
} catch (err) {
  console.error("Adding option to custom field failed:", err.message);


Running this with


Gives me this output in my terminal:

Adding option to custom field…
{ label: ‘m@m’, id: 29 },
{ label: ‘a@a’, id: 30 },
{ label: ‘s@s’, id: 31 }
FieldResponse {
success: true,
data: Field {
id: 12487,
key: ‘23d19bf6963b629fbf1362120697087a2aa73915’,
name: ‘Empfehlungsgeber-EMail’,
field_type: ‘enum’,
options: [ [Object], [Object] ],
Option “s@s” was added to custom field with ID: 12487

But it doesn’t actually update my options. Right now I have no idea if I am close to getting it done or miles away, but I don’t know what else I could try. Any help and suggestions are more than welcome.