pythonapipython-requestscalendly

Calendly API returns a 401


I want to do an API call using request of my user in Calendly like Documentation but I can't do it. I don't know if I need something else in my code, thanks.

import requests, json

api_key = 'aaaaaaaaa'
header = {
    'Authorization' : api_key
}

response = requests.get('https://api.calendly.com/users/me/', headers= header)
print(response)
print(response.json())

I'm getting a 401 response:

<Response [401]> {'title': 'Unauthenticated', 'message': 'The access token is invalid'}

Solution

  • I suspect you're trying to use the API Key for API v2. The API Key only works with Calendly's legacy API v1. API v2 supports the following two authorization schemes:

    See developer.calendly.com/getting-started for more details.