# Updating Custom Field Values using the API

**URL:** <https://integration.keap.com/t/updating-custom-field-values-using-the-api/85700>\
**Category:** API Q&A\
**Tags:** custom-fields, api, php-sdk\
**Created:** [November 21, 2021, 10:27pm UTC](https://integration.keap.com/t/updating-custom-field-values-using-the-api/85700 "2021-11-21T22:27:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Willoughby1](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@Luke\_Willoughby1](https://integration.keap.com/u/Luke_Willoughby1)\
**Post date:** [November 21, 2021, 10:27pm UTC](https://integration.keap.com/t/updating-custom-field-values-using-the-api/85700/1 "2021-11-21T22:27:43Z")

</div>

Hi,

Any ideas on how to update the values of a custom field using the API? I am currently following this [xml-rpc - Keap Developer Portal](https://developer.keap.com/docs/xml-rpc/#data-update-a-custom-field) I am using the PHP SDK trying to add more options to a dropdown custom field.

This is what I have tried:

```auto
    $values = array(

        'label' => "TestField", 
        'options' => array(
            "label" => "TestOption"
        )    
    );

$infusionsoft->data('xml')->updateCustomField($customFieldId, $values);

```

But I get this error, which is not very specific on what the problem is:

```auto
 [DatabaseError]Error updating custom field 

```

I tested only updating the name of the custom field, using this code below, which is successful:

```auto
$values = array('label' => 'TestField');
$infusionsoft->data('xml')->updateCustomField($customFieldId, $values);

```

Therefore I assume that it must be the format of the field values is wrong but I can not find any documentation on the correct format to use when updating the field values.

Any help would be greatly apricated.

Thanks

---

<div class="post-metadata">

**Author:** ![Luke\_Willoughby1](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@Luke\_Willoughby1](https://integration.keap.com/u/Luke_Willoughby1)\
**Post date:** [November 23, 2021, 1:00am UTC](https://integration.keap.com/t/updating-custom-field-values-using-the-api/85700/2 "2021-11-23T01:00:25Z")

</div>

Okay so I figured out how to do this. Working code below for anyone else who needs it:

```auto
$values = array(

        'Label' => "TestField", 
        'Values' => "TestOption"
    );

$infusionsoft->data()->updateCustomField($customFieldId, $values);

```

Multiple values can be added using comma to separate the values. e.g

```auto
  'Values' => "TestOption, TestOption 2, TestOption 3"

```
