Skip to main content
Solved

Create or Update Profile API is not clearing out fields when passing null

  • February 26, 2025
  • 2 replies
  • 21 views

Hello.

 

I’m using the Create or Update Profile API method (reference) on the revision v2024-06-15 and it’s not clearing out a field when passing null to it, despite what the mentioned documention says.

Note that setting a field to null will clear out the field, whereas not including a field in your request will leave it unchanged.

It doesn’t work on the latest stable version v2025-01-15 as well.

 

Am I doing something wrong? Or is it not really working as supposed?

 

See real example below. Some information has been supressed.

 

Request

{
  "RequestMethod": "POST",
  "RequestUrl": "https://a.klaviyo.com/api/profile-import/",
  "RequestBody": {
    "data": { "type": "profile", "attributes": { "properties": {}, "email": "test@example.com", "title": null } }
  }
}
 

Response
{
  "data": {
    "type": "profile",
    "id": "<id>",
    "attributes": {
      "email": "<email>",
      "phone_number": null,
      "external_id": null,
      "anonymous_id": null,
      "first_name": null,
      "last_name": null,
      "organization": null,
      "locale": null,
      "title": "test title",
      "image": null,
      "created": "2025-02-25T17:50:38+00:00",
      "updated": "2025-02-26T14:40:30.073777+00:00",
      "last_event_date": null,
      "location": {
        "zip": null,
        "region": null,
        "city": null,
        "latitude": null,
        "longitude": null,
        "address1": null,
        "country": null,
        "address2": null,
        "timezone": null,
        "ip": null
      },
      "properties": {
        "customproperty": "test"
      }
    },
    "relationships": {
      "lists": {
        "links": {
          "self": "https://a.klaviyo.com/api/profiles/<id>/relationships/lists/",
          "related": "https://a.klaviyo.com/api/profiles/<id>/lists/"
        }
      },
      "segments": {
        "links": {
          "self": "https://a.klaviyo.com/api/profiles/<id>/relationships/segments/",
          "related": "https://a.klaviyo.com/api/profiles/<id>/segments/"
        }
      },
      "conversation": {
        "links": {
          "self": "https://a.klaviyo.com/api/profiles/<id>/relationships/conversation/",
          "related": "https://a.klaviyo.com/api/profiles/<id>/conversation/"
        }
      }
    },
    "links": {
      "self": "https://a.klaviyo.com/api/profiles/<id>/"
    }
  },
  "links": {
    "self": "https://a.klaviyo.com/api/profile-import/"
  }
}

Best answer by Byrne C

Hey ​@other1467 and ​@KeviSunshine,

Just wanted to jump in to confirm the behavior you’re seeing! Right now, passing null as a property value will not successfully unset that value, when using the Create or Update Profile API call. This is a bug, and something that our engineers are aware of, and are working to fix. In the meantime, you can use the Update Profile PATCH call, where null works correctly.

-Byrne

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

KeviSunshine
Expert Problem Solver III
Forum|alt.badge.img+8
  • Expert Problem Solver III
  • 159 replies
  • February 26, 2025

Hi ​@other1467,

Using this API, I am seeing the same behavior as you for the field “title.” I am assuming this is the same behavior for all built-in Klaviyo fields.

If I set a custom profile property field to a string, and then set it to null, it works. 

If I use the “update profile” method (https://developers.klaviyo.com/en/v2024-06-15/reference/update_profile) I am seeing the correct behavior: passing { title: null } will clear the field. (This method requires the profile ID though!)

But to your original inquiry I do not have an answer but can confirm the behavior you’re seeing, and it doesn’t match the documentation!

Best,

Kevin.


Byrne C
Community Manager
Forum|alt.badge.img+14
  • Community Manager
  • 110 replies
  • Answer
  • February 28, 2025

Hey ​@other1467 and ​@KeviSunshine,

Just wanted to jump in to confirm the behavior you’re seeing! Right now, passing null as a property value will not successfully unset that value, when using the Create or Update Profile API call. This is a bug, and something that our engineers are aware of, and are working to fix. In the meantime, you can use the Update Profile PATCH call, where null works correctly.

-Byrne