YesGraph’s Python SDK is available through the pip package manager.

$ pip install --upgrade yesgraph

It’s also open source! Check out the source code on [Github](, or the YesGraph package on PyPI.


Here’s how to setup the Python SDK using your API key:

from yesgraph import YesGraphAPI
api = YesGraphAPI('YOUR_SECRET_KEY')
{'message': 'You have successfully made an authorized request to the '
            'YesGraph API!',
 'meta': {'app_name': 'test',
          'docs': '',
          'env': 'live',
          'help': 'Please contact for any issues.',
          'user_id': None}}

POST /address-book

Assuming that your secret key is still set from the example above, here’s how you would make a POST call to rank some contacts:

# Build the list of address book entries
entries = [
  {"name": "Ivan Kirigin", "email": ""},
  {"name": "Vincent Driessen", "email": ""},
  {"name": "George Hickman", "email": ""}

# Hit the API!
response = api.post_address_book(user_id=1234,
                                 source_name='Jonathan Chu',
{'batch_id': '3d958e33-9734-4095-8bfc-e95f13db86a5',
 'message': 'Address book for 1234 added.'}

POST /invites-sent

Here’s how you would make a POST call to track invites sent. Let’s say you sent an invite to “” and would like to track that data with YesGraph:

# Build the list of invite entries
entries = [
        "user_id": 1234, # The inviter's user ID
        "email": "", # The recipient's email
        "sent_at": "1970-01-01T00:00:00+00:00"  # When the invite was sent
response = api.post_invites_sent(entries)
{'meta': {'time': 0.10435795783996582},
 'message': 'Invite sent added.'}

POST /invites-accepted

And finally, when John Smith (from the above example) accepts your invite, here’s how you can track that data:

# Build the list of invite entries
entries = [
        "user_id": "43eb4524", # John's new user ID!
        "email": "",
        "accepted_at": "1970-02-01T00:00:00+00:00"
response = api.post_invites_accepted(entries)
{'meta': {'time': 0.02321600914001465},
 'message': 'Invite accepted added.'}