# Clear a field using REST API

**URL:** <https://integration.keap.com/t/clear-a-field-using-rest-api/86657>\
**Category:** API Q&A\
**Tags:** api, rest\
**Created:** [March 3, 2022, 7:38am UTC](https://integration.keap.com/t/clear-a-field-using-rest-api/86657 "2022-03-03T07:38:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrea\_Ravicini](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Andrea\_Ravicini](https://integration.keap.com/u/Andrea_Ravicini)\
**Post date:** [March 3, 2022, 7:38am UTC](https://integration.keap.com/t/clear-a-field-using-rest-api/86657/1 "2022-03-03T07:38:50Z")

</div>

Hello everyone,  
how do I clear a field in the contact using the REST API?  
In my particular case is the birthday field.  
I tried sending null, zero, empty string but the date stay there.  
I do a PATCH to /contacts/$id using {“birthday”:xxxxx} as body, where I changed xxxxx to anything I needed.  
To populate the field I used the string formatted yyyy-mm-dd and it worked fine, but I have accidentally sent to some of my contacts the value 0000-00-00, which translated somewhat to 0002-11-29 in the web form (I don’t know why), and I want to clear this field without deleting the contact.  
Thank you

---

<div class="post-metadata">

**Author:** ![TomScott](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/tomscott/32/67_2.png) [@TomScott](https://integration.keap.com/u/TomScott)\
**Post date:** [March 3, 2022, 4:19pm UTC](https://integration.keap.com/t/clear-a-field-using-rest-api/86657/2 "2022-03-03T16:19:45Z")

</div>

I just tested that you can perform that operation via the v2/contacts API correctly as follows:

GET `https://api.infusionsoft.com/crm/rest/v2/contacts/24?fields=birth_date`  
Response:

```auto
{
    "id": "24",
    "given_name": "FS-16532",
    "family_name": "",
    "birth_date": null
}

```

PATCH `https://api.infusionsoft.com/crm/rest/v2/contacts/24?update_mask=birth_date&fields=birth_date`  
Request:

```auto
{
    "birth_date": "1999-01-01"
}

```

Response:

```auto
{
    "birth_date": "1999-01-01"
}

```

GET `https://api.infusionsoft.com/crm/rest/v2/contacts/24?fields=birth_date`  
Response:

```auto
{
    "id": "24",
    "given_name": "FS-16532",
    "family_name": "",
    "birth_date": "1999-01-01"
}

```

PATCH `https://api.infusionsoft.com/crm/rest/v2/contacts/24?update_mask=birth_date&fields=birth_date`  
Request:

```auto
{
    "birth_date": null
}

```

Response:

```auto
{
    "id": "24",
    "given_name": "FS-16532",
    "family_name": "",
    "birth_date": null
}

```

---

<div class="post-metadata">

**Author:** ![Andrea\_Ravicini](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Andrea\_Ravicini](https://integration.keap.com/u/Andrea_Ravicini)\
**Post date:** [March 4, 2022, 10:35am UTC](https://integration.keap.com/t/clear-a-field-using-rest-api/86657/3 "2022-03-04T10:35:19Z")

</div>

So the bug is only on the v1 API. 😧

Edit: I just tried and have the same outcome with the v2 API, here’s my logging (I added 1s sleep between calls), and I can confirm in the web UI that the birth\_date is the same as birthday in the v1 API and the additional info tab contains the BIrthday field with the value that isn’t cleared.

```auto
[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:8(switchApiVersion) switchApiVersion(2) => https://api.infusionsoft.com/crm/rest/v2 
[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:35] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) 200 {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":null} 
[04/03/2022 12:13:36] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) PATCH /contacts/44229 {"birth_date":"2000-01-01"} 
[04/03/2022 12:13:37] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) 200 {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) 200 {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"} 
[04/03/2022 12:13:39] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) PATCH /contacts/44229 {"birth_date":null} 
[04/03/2022 12:13:40] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) 200 {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:41] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:42] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) 200 {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"}

```

---

<div class="post-metadata">

**Author:** ![Andrea\_Ravicini](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Andrea\_Ravicini](https://integration.keap.com/u/Andrea_Ravicini)\
**Post date:** [March 4, 2022, 11:19am UTC](https://integration.keap.com/t/clear-a-field-using-rest-api/86657/4 "2022-03-04T11:19:31Z")

</div>

Reposting since the forum ate my edit 😄

It isn’t working on my side on the v2 API too.

Below my logging, with 1s pause between API calls.

```auto
[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:8(switchApiVersion) switchApiVersion(2) => https://api.infusionsoft.com/crm/rest/v2 
[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:35] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) 200 {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":null} 
[04/03/2022 12:13:36] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) PATCH /contacts/44229 {"birth_date":"2000-01-01"} 
[04/03/2022 12:13:37] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) 200 {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) 200 {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"} 
[04/03/2022 12:13:39] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) PATCH /contacts/44229 {"birth_date":null} 
[04/03/2022 12:13:40] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) 200 {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:41] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:42] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) 200 {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"} 

```

---

<div class="post-metadata">

**Author:** ![TomScott](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/tomscott/32/67_2.png) [@TomScott](https://integration.keap.com/u/TomScott)\
**Post date:** [March 4, 2022, 4:01pm UTC](https://integration.keap.com/t/clear-a-field-using-rest-api/86657/5 "2022-03-04T16:01:09Z")

</div>

If you set an update\_mask with the request it should work; it is required to set values to null.
