API with SAML authentification

My org has been using Redash for a while and we have auth configured using SAML. However, recently I’ve wanted the ability to copy dashboards, generate new dashboards using specific params, etc which seems like something that only the API can do. However, whenever I make a request to the API (using my API key) I receive an HTML response that appears to be the SAML login screen.

Is it possible to use the API when redash is configured using SAML auth? If so has anyone done it and how?

My code

import requests
API_KEY = 'xxx'
REDASH_HOST = 'xxx'
sess = requests.Session()
sess.headers.update({'Authorization': f'Key {API_KEY}'})
response = sess.get(f'{REDASH_HOST}/queries/')
print(response.content)

Where did you get your API key? Is it possible you used a specific query key instead of your user-level key?

You’re not hitting the API endpoint. You’re accessing the web UI.

The API is under ${REDASH_HOST}/api/queries

Thanks for your response!
Updating the url (whoops - I wish there was some documentation on this) did not change the response. Still hits the SAML login page.

sess = requests.Session()
sess.headers.update({'Authorization': f'Key {API_KEY}'})
response = sess.get(f'{REDASH_HOST}/api/queries/')
print(response.content)

To answer your stuck through point, I got the API key from my user profile - so I’m pretty sure it’s not a query-level API key.

Can you provide more information about your Redash instance? What version do you have? Where is it hosted?

I can’t reproduce your issue.

We’re using version 5.0.2 self hosted (well on AWS) with SAML auth through Okta.