How to get "opt_in_reason" for a contact? (Getting fake contacts, can't figure our where they are coming from)

Hi All!

We’re getting 10-20 fake contacts added every day. I can’t see any evidence in the contact details that would give me any hint for where they are coming from. Could be some old form or something else.

I’ve checked very carefully in every tab of the “Contact Information” page but can’t find anything. Every single field besides the email is just empty.

Also tried getting “opt_in_reason” field for one of these contacts via API, but got this: [NoFieldFound]No field found: Contact.opt_in_reason"

Any suggestions on tracking down the source of the fake opt-ins?

Hi @Arseni_Timofeev1,

You will need to use the REST v2 API to get the Opt In Reason. It will be inside the “email_addresses” response.

https://developer.keap.com/docs/restv2/#tag/Contact/operation/retrieveContactModelUsingGET_1

It is also available via the List Contacts as well.

https://developer.keap.com/docs/restv2/#tag/Contact/operation/listContactsUsingGET_1

Hope that helps.

1 Like

Thank You! That worked perfectly!

1 Like

btw, Is there a trick to list contacts with a specific opt_in_reason? It looks like I would need to fetch all contacts using the API to be able getting the ones with a given value.

Not from what I can see, not even the Saved Searches are showing any possible search criteria either.

The REST API Query Parameters are very limiting, but at least you have the field available to you in the results.

I do see an “is_opt_in” Boolean value, but then you would already be filtering on the Opt in Reason.

The only other suggestion is that if you can see a specific pattern with the Contacts that have the particular Opt In Reason. Do they have a particular Tags or Custom Field set in the data.

1 Like

If identifying a list of Contacts like that is a requirement I would suggest tagging them as you add them, which will then allow you use the List Tagged Contacts endpoint to retrieve them. The free-text entry for the reason is there for compliance reasons and isn’t indexed so we can’t provide querying on it.