Getting email address from ApiRequest (not returning)


I own a Patreon campaign that I’m trying to call from my website to simply see if a user is an active member (without requiring them to click any buttons to authorize access or anything). Once I know that their logged in email address (to my website) is associated with an active member, they will get access to some extra features. I can get all sorts of information back once I grab the campaign ID, but the array that is returned completely leaves out the user’s “email” and I get a warning saying:

Undefined array key “email”

$apiUrl = '';

$patronResponse = makeApiRequest($apiUrl . "/campaigns/{$campaignId}/members?include=user&fields%5Bmember%5D=full_name,patron_status&fields%5Buser%5D=email", $accessToken);

The email should be under the attributes key if I’m doing this right:

foreach ($patronList as $patron) {
  if ($patron['type'] == 'user' && $patron['attributes']['email'] == $checkEmail && $patron['attributes']['patron_status'] == 'active_patron') {
      $activePatron = true;


Any help would be much appreciated!

I don’t think it’s possible without having the user manually confirm (by authorizing) every time their token expires.

“If you have the identity[email] scope, you will also get the user’s email address. You will not receive email address without that scope.”

This makes absolutely no sense seeing as I just want to get a list of all the user email addresses in my campaign. If I wanted to I could go onto the Patreon website and scrape all of them, but that’s what the API is supposed to do! @codebard is my reading of that correct?

Just use your creator’s access token if you are accessing your own members. If you are accessing the members of another campaign, then you will have to get the user to authorize a token via oAuth. Also you will need to refresh the token before it expires to keep it fresh. Or get users to go through the auth again if it expires.

Never got it to work (this is my own campaign, not someone elses). Completely ignores my call for the email ($members_url = “{$campaign_id}/members?include=user&fields[user]=email&fields[member]=patron_status”;):

$client_id = 'redacted';
$client_secret = 'redacted';
$creator_access_token = 'redacted';

function getPatreonData($url, $access_token) {
    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => array(
            "Authorization: Bearer {$access_token}",
            "User-Agent: YourApp/1.0"

    $response = curl_exec($curl);
    $err = curl_error($curl);


    if ($err) {
        return "cURL Error #:" . $err;
    } else {
        return json_decode($response, true);

// Fetch your campaign details
$campaign_url = ",full_name&fields%5Bcampaign%5D=created_at,creation_name,patron_count";
$campaign_data = getPatreonData($campaign_url, $creator_access_token);

if (isset($campaign_data['data'][0])) {
    $campaign_id = $campaign_data['data'][0]['id'];

    // Fetch campaign members
    $members_url = "{$campaign_id}/members?include=user&fields%5Buser%5D=email&fields%5Bmember%5D=patron_status";

    $members_data = getPatreonData($members_url, $creator_access_token);

    $members = [];

    if (isset($members_data['data']) && isset($members_data['included'])) {
        $users = [];
        foreach ($members_data['included'] as $user) {
            $users[$user['id']] = $user['attributes']['email'];

        foreach ($members_data['data'] as $member) {
            $user_id = $member['relationships']['user']['data']['id'];
            $members[] = [
                'id' => $user_id,
                'email' => $users[$user_id],
                'patron_status' => $member['attributes']['patron_status']

} else {
    echo "Error fetching campaign data.";

Is your client v2? Also check and confirm whether the token is not expired:

Yes, client is V2, and if token was expired it would throw me back an error, right? Either way, a new token refresh produces same results.

Is that token your creator access token or a user’s token?

creator access token. I’m convinced the documentation is either wrong or there is a bug.

That’s unlikely since nobody else has this problem. Try the same call from somewhere else and see if it behaves differently.