API connexion failed : Unauthenticated

Hi,

Since today my API request are not working anymore and returning an error of bad authorisation.
Last week it was working very well, I used to copy paste the CURL in the inspector as recommended by Metabase and run requests in python. But today I cannot run my previous API requests and the new one are also not working.

Here is a simple example of what I'm trying to do in Python :

url = "https://metabase.codexfit.com/api/dataset/json"

    payload = "query=%7B%22database%22%3A11%2C%22query%22%3A%7B%22source-table%22%3A687%7D%2C%22type%22%3A%22query%22%2C%22middleware%22%3A%7B%22js-int-to-string%3F%22%3Atrue%2C%22add-default-userland-constraints%3F%22%3Atrue%7D%7D&visualization_settings=%7B%22column_settings%22%3A%7B%7D%2C%22table.pivot%22%3Afalse%2C%22table.pivot_column%22%3A%22sca_confirmation_url%22%2C%22table.cell_column%22%3A%22frontend_survey_url%22%2C%22table.columns%22%3A%5B%7B%22name%22%3A%22id%22%2C%22fieldRef%22%3A%5B%22field%22%2C6523%2Cnull%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22name%22%2C%22fieldRef%22%3A%5B%22field%22%2C6526%2Cnull%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22description%22%2C%22fieldRef%22%3A%5B%22field%22%2C6923%2Cnull%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22handle%22%2C%22fieldRef%22%3A%5B%22field%22%2C6525%2Cnull%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22sca_confirmation_url%22%2C%22fieldRef%22%3A%5B%22field%22%2C14184%2Cnull%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22created_at%22%2C%22fieldRef%22%3A%5B%22field%22%2C6527%2C%7B%22temporal-unit%22%3A%22default%22%7D%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22updated_at%22%2C%22fieldRef%22%3A%5B%22field%22%2C6528%2C%7B%22temporal-unit%22%3A%22default%22%7D%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22deleted_at%22%2C%22fieldRef%22%3A%5B%22field%22%2C6531%2C%7B%22temporal-unit%22%3A%22default%22%7D%5D%2C%22enabled%22%3Atrue%7D%2C%7B%22name%22%3A%22frontend_survey_url%22%2C%22fieldRef%22%3A%5B%22field%22%2C18729%2Cnull%5D%2C%22enabled%22%3Atrue%7D%5D%2C%22table.column_formatting%22%3A%5B%5D%7D"
    headers = {
    'authority': 'metabase.codexfit.com',
    'accept': '*/*',
    'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
    'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
    'cookie': 'metabase.DEVICE=ea853b6b-660e-4882-89ec-7006ee8db7a6; _ga=GA1.2.1940127687.1699284291; _gid=GA1.2.1257358554.1701074126; metabase.TIMEOUT=alive; metabase.SESSION=204538d2-687a-4e9d-bd8a-75f1ccf653f9; metabase.DEVICE=0c18cb9e-8cd4-43fb-8113-29f90827279f; metabase.SESSION=e03a5bf2-77e4-4c01-828b-a3d5c5a2acf8; metabase.TIMEOUT=alive',
    'origin': 'https://metabase.codexfit.com',
    'referer': 'https://metabase.codexfit.com/question',
    'sec-ch-ua': '"Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"macOS"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-origin',
    'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
    }

    response = requests.request("POST", url, headers=headers, data=payload)
    print(response)`Preformatted text`

Has you login expired?

I don't think so cause I'm still able to run queries on Metabase.

I think maybe this week-end Metabase has changed something because the interface was not working, I didn't have access to our datalake and since the interface is back I cannot use the API but the Metabase interface is working.

I mean the session login contained in your login cookie in the request. If it's expired, it will fail.

It is the cookie from the CURL block so I don't think it is expired, I will try to load another cookie to be sure.