How To Get Discord user ID from pledges

I am making a discord bot in Python. How can I make a script that gets all the pledges and their discord ids to check if they have pledged to our Patreon thing? I want to get these values in python btw.

Thanks In Advance!

This is a broad question, there are various ways to do it.

Getting all the members for your campaign, and then getting each member’s details is an option.

1 Like

So in the api The Response GIves you this

  "data": {
    "attributes": {
      "about": null,
      "created": "2017-10-20T21:36:23+00:00",
      **"discord_id"**: null,
      "email": "",
      "facebook": null,
      "facebook_id": null,
      "first_name": "Corgi",
      "full_name": "Corgi The Dev",
      "gender": 0,
      "has_password": true,
      "image_url": "",
      "is_deleted": false,
      "is_email_verified": false,
      "is_nuked": false,
      "is_suspended": false,
      "last_name": "The Dev",
      "social_connections": {
        "deviantart": null,
        "discord": null,
        "facebook": null,
        "reddit": null,
        "spotify": null,
        "twitch": null,
        "twitter": null,
        "youtube": null
      "thumb_url": "",
      "twitch": null,
      "twitter": null,
      "url": "",
      "vanity": "corgithedev",
      "youtube": null
    "id": "0000000",
    "relationships": {
      "pledges": {
        "data": []
    "type": "user"
  "links": {
    "self": ""

How would I get this What I need is discord_id fetch members maybe like

def discord_id(persons):
list = []    
for person in persons

Is there away I can get person?

Was Very Helpful BTW

@codebard I found a way to get to patron info I use


But To Get Discord Id would I do


or am I doing something wrong there? :smiley:

1 Like

If you got the patron via the relationship of pledge (good idea), what you get with that info of patron would be what you get. What exactly you are receiving when you do that call? (by omitting any private info)

Well I don’t have any patrons yet but when the time comes we need the code ready so I am currently getting nothing

You can sign up for a new patron account via a different email, use the same payment method as your creator account, and subscribe to your creator account from a $1 tier or something. That would allow you to do live tests.

discord_id = pledger.relationship(“patron”).attribute(“social_connections”)[“discord”][“user_id”]

You were on the right track you just needed to change a few small things.