# Error when posting to multiple checkbox contact field via Properties API

**URL:** <https://community.hubspot.com/t/error-when-posting-to-multiple-checkbox-contact-field-via-properties-api/37956>\
**Category:** APIs & Integrations\
**Tags:** php, developer-tools, contacts\
**Created:** [May 26, 2021, 4:44pm UTC](https://community.hubspot.com/t/error-when-posting-to-multiple-checkbox-contact-field-via-properties-api/37956 "2021-05-26T16:44:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IParsons](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/iparsons/32/35608_2.png) [@IParsons](https://community.hubspot.com/u/IParsons)\
**Post date:** [May 26, 2021, 4:44pm UTC](https://community.hubspot.com/t/error-when-posting-to-multiple-checkbox-contact-field-via-properties-api/37956/1 "2021-05-26T16:44:29Z")

</div>

I’m attempting to post to two multiple checkbox fields using the Properties API (see my previous question [here](https://community.hubspot.com/t5/APIs-Integrations/Error-when-posting-to-multiple-checkbox-contact-field-via/m-p/438278#M43402)).

When I run the below script as part of my full contacts update script, I am getting a validation error. The option I am trying to save to the multiple checkbox does not exist: “message”:"b0e3726b-7fed-4e61-8e66-702a45416813 was not one of the allowed options.

I’m pretty sure I’m missing something obvious 🙂

```lia-code-sample
<?php

$allTeamGuids = array();

function addTeamGUIDtoGUIDProperties($guids){

 //update properties
 //PUT /properties/v1/contacts/properties/named/:property_name

 $properties = array('active_team_guids', 'allteamguids');

 foreach($properties as $property){

 $update_property_url = 'https://api.hubapi.com/crm/v3/properties/contacts/'.$property.'?hapikey=' . HS_API_KEY;

 $ch = curl_init();

 $update_property_json = array(

 "name" => $property,
 "groupName" => "app_data",
 "description" => "",
 "fieldType" => "checkbox",
 "formField" => false,
 "type" => "enumeration",
 "displayOrder" => '',
 "label" => $property,
 'options' => array(
 )
 );

 foreach($guids as $guid) {

 array_push($update_property_json['options'], $guid);
 }

 $update_property_json = json_encode($update_property_json);

 /* echo '<pre>';
 print_r( $update_property_json );
 echo '</pre>'; */

 curl_setopt_array($ch, array(
 CURLOPT_URL => $update_property_url,
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => "",
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 30,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => "PUT",
 CURLOPT_POSTFIELDS => $update_property_json,
 CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Content-Length: ' . strlen($update_property_json)),
 ));

 $response = curl_exec($ch);
 $err = curl_error($ch);

 curl_close($ch);

 if ($err) {
 echo "cURL Error #:" . $err;
 } else {
 echo $response;
 }

 }

}

$ch = curl_init();

$url = $base_url.'/Analytics/Teams?FromDate='.$fromDate;

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','X-API-KEY: '.$client_api_key));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

try{

 $response = curl_exec($ch);

 /* echo '<pre>';
 print_r( json_decode($response, true));
 echo '</pre>'; */

 $teams = json_decode($response, true);
 foreach((array) $teams as $team){
 $guid = array();
 $guid['label'] = $team['guid'];
 $guid['value'] = $team['guid'];

 array_push($allTeamGuids, $guid);
 }

 addTeamGUIDtoGUIDProperties($allTeamGuids);

} catch(Exception $e){
	die('Error');
}

```

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [May 27, 2021, 2:00pm UTC](https://community.hubspot.com/t/error-when-posting-to-multiple-checkbox-contact-field-via-properties-api/37956/2 "2021-05-27T14:00:08Z")

</div>

@IParsons 👋

Throwing @MichaelC at this. He is a pretty smart fellow 😀

---

<div class="post-metadata">

**Author:** ![MichaelC](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/michaelc/32/9055_2.png) [@MichaelC](https://community.hubspot.com/u/MichaelC)\
**Post date:** [May 27, 2021, 2:23pm UTC](https://community.hubspot.com/t/error-when-posting-to-multiple-checkbox-contact-field-via-properties-api/37956/3 "2021-05-27T14:23:04Z")

</div>

@IParsons

Have you tried using PATCH instead of PUT when updating a property?

See documentation here: [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/properties)

---

<div class="post-metadata">

**Author:** ![IParsons](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/iparsons/32/35608_2.png) [@IParsons](https://community.hubspot.com/u/IParsons)\
**Post date:** [May 27, 2021, 7:21pm UTC](https://community.hubspot.com/t/error-when-posting-to-multiple-checkbox-contact-field-via-properties-api/37956/4 "2021-05-27T19:21:29Z")

</div>

Thanks, @MichaelC, my script ran perfectly - 200s all the way.
