You will want to ensure you are formatting all data points as listed in our API documentation. The image below shows a successful call following our api doc:
You can also check to see if your list is set to double opt-in. If the list is set to double opt-in the subscription would have to be confirmed by the customer. To subscribe someone with SMS consent, I believe you'll need to use our POST endpoint detailed on our subscription API documentation under the "Subscribe to list" header.
I was not looking for SMS concent status. I was looking for a way to see if the person was opted out of getting emails. I have found nothing in the docs that shows where in a person’s profile that is stored.
I ended up using a brute force work around by getting all cancellation events and matching our emails to the event person’s email.
If you’re looking to find people who were opted out of emails, it seems like you would want a list of unsubscribed people.
To make a note, just because someone is not found from using that API code you posted does not mean they are unsubscribed users. They could be active in a different LIST_ID that was not checked. The person’s profile could also still be active by doing other tasks such as placing orders. Your solution works but does not take into account if that customer is active and subscribed in another list.
I would suggest taking a look at our apidocs regarding global exclusions. This is more likely to aid in what you are trying to achieve in terms of data collection.