Retreiving opt out customers from the API

Hi All,

I would like to retrieve a list of all email addresses that have been opted out between a certain date range via the API. I’ve been through the API documentation for both REST and legacy but I can’t see an endpoint that would do this. I also can’t see a way to work around it.

The closest thing I can see is the Reports endpoint in the Legacy docs but even that doesn’t have the information I’m after.

Wou

1 Like

We do have a feature request in our backlog to allow Opt-Out Status as a filter on the Contact search endpoint for REST, but it is not implemented yet. I’ll add this thread as a reference on the ticket.

1 Like

Technically speaking, your opt out status is on the email address and not the contact itself. If a contact (or a number of contacts) use an email address that has been opted out then you would get all of those contacts. There is a table that would give you a list of the opt out email addresses and then the contact table could be queried for all contacts using each address (two step process of course) in the interim until what @TomScott had mentioned comes into fruition.

Thanks John, what api endpoint gives the list of opted out email addresses? Is there a way to use a date range to only retrieve e-mails opted out in the last x days.

The reason for the date range is that the number of opt outs will keep growing and I’ll probably hit issues with it in the future unless I can limit it somehow.

You would need to use the standard api (not REST) and read the EmailAddStatus table:

https://developer.infusionsoft.com/docs/table-schema/

Thanks John, is there any documentation on how to use the legacy API Data Service with .NET. I’ve had a good look and can’t see anything. I’m already using something like the below to opt out emails -

var contactService = XmlRpcProxyGen.Create();
var result = contactService.OptOutByEmail(keyId, email, “OptingOut”);

Which is using the legacy API via the CookComputing.XmlRpc library.

Would reading all the email from the table on a daily basis via this method cause any issues?

I found a bit more information but it looks like that table isn’t part of the .net library. See attached image.

I’m not .net proficient myself but I do know that it has an equivalent to cURL calls. There may be other ways but I know that scripts can be written as endpoints that can get return json back. That would be the extend of what I can say for certain though.