Problems with API to get list of patrons

Hi, Im trying to use the API to get the latest list of patrons, however I can’t get the API to work properly,

the code I used:

import requests

# Replace these values with your own
client_id = ‘YOUR_CLIENT_ID’
client_secret = ‘YOUR_CLIENT_SECRET’
access_token = ‘YOUR_ACCESS_TOKEN’
campaign_id = ‘YOUR_CAMPAIGN_ID’

# Authenticate with the Patreon API
auth_url = ‘
auth_data = {

  • ‘grant_type’: ‘client_credentials’,*
  • ‘client_id’: client_id,*
  • ‘client_secret’: client_secret,*
    auth_response =, data=auth_data)
    access_token = auth_response.json()[‘access_token’]

# Get the list of patrons
patrons_url = f’{campaign_id}/members
patrons_headers = {

  • ‘Authorization’: f’Bearer {access_token}',*
    patrons_response = requests.get(patrons_url, headers=patrons_headers)
    patrons = patrons_response.json()[‘data’]

# Extract the names of the patrons
patron_names = [patron[‘attributes’][‘full_name’] for patron in patrons]

# Print the list of names

But the only response I get from the API is this:

Traceback (most recent call last):
File “D:\GitHub\CocktailCodex\”, line 17, in
access_token = auth_response.json()[‘access_token’]
KeyError: ‘access_token’

And when I just print “auth_response.json()” it says this:

[{‘code’: None, ‘code_name’: ‘InternalError’, ‘detail’: ‘An unrecoverable internal server error has occurred.’, ‘id’: ‘XXXXX’, ‘status’: ‘500’, ‘title’: ‘Internal Error.’}]

What is it / can it be, and how can i solve my problems?

Try double-checking that you are receiving a valid v2 access token and using it with a v2 endpoint and v2 calls.