Clearing custom field values on a subscriber

Just starting to tear my hair out (and there's not much left!) so resorting to the forum to help me out with this.

A client of mine is using Campaign Monitor to send out post signup emails for a subscription service (via autoresponders).  The dates for the auto responders are set using custom fields for the subscriber (the exact date for post-signup emails being calculated when a user signs up).

Now, said client, want to cancel some of the actions if the subscribers meets certain conditions with service.

I am trying to remove the value of a custom field for a given subscriber, and this is where I am coming unstuck.  Whilst I can use subscriberAddWithCustomFields to change any of the custom field values, I cannot return a custom field back to an empty value.  It's not a huge issue, tbh, I can successfully set a date custom field to a date in the past, which prevents the email coming out - it just seems a little 'hackish' to me, and it also confused my client when they view the individual subscriber data within Campaign Monitor.

Have tried passing the following as values to the custom field (0, null, false, "", " ", "0000-00-00"), however it seems that any invalid date simply leaves the field in it's present state.

Any help appreciated.


Ken Ken, 5 years ago

Hi Ryan,

I'm afraid there currently isn't a way to clear the value of a date custom field via the API. Currently, we ignore any null or blank values for any custom field updates, and any invalid date values will also be ignored.

I've put in a bug report to see if we can come up with some way of clearing the value of a date custom field. We'll get back to you here when it's been implemented.
drjones69, 5 years ago

Ah, bizarrely I'm almost pleased by that - spent long enough thinking I'd been overlooking something obvious ;-)

Am I safe to assume that if a date is set 'in the past' (and autoresponder using it is set to 'Send on Date') that autoresponder will never trigger (i.e. it won't suddenly realise that something should have been triggered but hasn't and send them all out in 1 go).

All I need to do then, is simply explain to the client that they need to interpret dates in that past as 'Cancelled'.

Thanks for filing a bug report - it would be nice if the field could be empty altogether (from a reporting aspect) - but so long as the effect is the same, I can work with it.


Aidy, 5 years ago

Hi Guys

Think I have come across the same problem.

Am I right to say that it is impossible clear custom data for any type of field for a subscriber via the API?


Aidy, 5 years ago

Emailed CM with this and they confirmed that you can't simply clear custom data.


I'm afraid there isn't a way to clear data like you are wanting, but you can overwrite it - either with "N/A" or sometimes it works to just import a double space "  " to the value. It's a bit of a hack and the "is not provided" segments will not return those fields

I tried out the double space hack and it seems to work for text fields only.

jamesd jamesd, 5 years ago

Just following up on this old thread to confirm that it is possible to clear a date type custom field by specifying the value "0000-00-00" for a date type custom field.

You will see this is detailed in the documentation for Adding a subscriber, Updating a subscriber, and Importing many subscribers.

jaydisc, 4 years ago

This is something I've just come up against. I have situations where a customer would like to clear their value. I guess making a change like this to the API would affect a lot of people's code, but I think it would be good to allow previously set custom fields to null or blank values.

jamesd jamesd, 4 years ago

Hi there,

We've actually recently allowed clearing of values when updating a subscriber via the API.

Quoting from the documentation:

To clear the value of a custom field, pass a parameter of Clear with a value of true along with the custom field name/value. To remove a specific Multi-Valued Select Many option, pass the option name in the Value field along with the Clear: true parameter. To clear all values of a Multi-Valued Select Many field, pass an empty Value along with the Clear: true parameter. Alternatively, Date type custom fields may be still cleared by passing in a value of "0000-00-00"

jaydisc, 4 years ago

Hmmm... I've tried a few ways without success. Can I confirm I'm doing this right:

Here is some debug output. In the middle, I've inserted the output of my PHP array. I'm trying to clear the "State" custom field:

13:07:41 - Cmonitor: Creating wrapper for
13:07:41 - Cmonitor: Using cURL for transport
13:07:41 - CS_REST_SERIALISATION_get_available: Getting serialiser
13:07:41 - Cmonitor: Using native json serialising
    [EmailAddress] =>
    [Name] => Jay
    [Resubscribe] => 1
    [CustomFields] => Array
            [0] => Array
                    [Key] => School
                    [Value] => School for Gifted

            [1] => Array
                    [Key] => Postcode
                    [Value] => 0345

            [2] => Array
                    [Key] => State
                    [Value] => 
                    [Clear] => 1

            [3] => Array
                    [Key] => Position
                    [Value] => Classroom Teacher, School Support Staff, Student Teacher

            [4] => Array
                    [Key] => Reason
                    [Value] => Postcard

            [5] => Array
                    [Key] => Source
                    [Value] => Freebies


13:07:41 - Cmonitor: Making POST call to:
13:07:41 - CS_REST_CurlTransport: curl+zlib support available. Requesting gzipped response.
13:07:42 - CS_REST_CurlTransport: API Call Info for POST 396 bytes uploaded. 33 bytes downloaded Total time (seconds): 0.970483
13:07:42 - Cmonitor: Call result:
array (
  'code' => 201,
  'response' => '""',

CS_REST_Wrapper_Result Object
    [response] =>
    [http_status_code] => 201

I've tried setting State's value to NULL instead of "". I've tried setting Clear to "true" as a string instead of a native BOOLEAN. No mattter what, the old state seems to stay there.

Am I missing something obvious? What can I check?

davidh, 4 years ago


We have just released an update to the API to allow clearing custom fields for existing subscribers. The updated doco is here:

jaydisc, 4 years ago

Hi David, I've read, and believe to have followed that documentation. Doesn't my code sample correctly implement it as documented?

Phil Phil, 4 years ago

Hi jaydisc,

You're right - the procedure for removing the custom field value was inexplicably missing from the production databases. Give it a bash now :)

jaydisc, 4 years ago

Yay! Works great now. Thank you.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free