API query to CDS-Beta returns HTTPError: 404 Client Error

Hi Team,

I am experiencing problems with retrieving data from CDS-Beta with following error:

I’ve complied with new authentication protocols and have agreed to Terms and Conditions checkbox found on: ERA5 hourly data on single levels from 1940 to present

My code is reproduced as follows:

import cdsapi
dataset = “reanalysis-era5-single-levels”
request = {
‘product_type’: [‘reanalysis’],
‘variable’: [‘2m_temperature’],
‘year’: [‘2023’, ‘2024’],
‘month’: [‘01’, ‘02’, ‘03’, ‘04’, ‘05’, ‘06’, ‘07’, ‘08’, ‘09’, ‘10’, ‘11’, ‘12’],
‘day’: [‘01’, ‘02’, ‘03’, ‘04’, ‘05’, ‘06’, ‘07’, ‘08’, ‘09’, ‘10’, ‘11’, ‘12’, ‘13’, ‘14’, ‘15’, ‘16’, ‘17’, ‘18’, ‘19’, ‘20’, ‘21’, ‘22’, ‘23’, ‘24’, ‘25’, ‘26’, ‘27’, ‘28’, ‘29’, ‘30’, ‘31’],
‘time’: [‘00:00’, ‘01:00’, ‘02:00’, ‘03:00’, ‘04:00’, ‘05:00’, ‘06:00’, ‘07:00’, ‘08:00’, ‘09:00’, ‘10:00’, ‘11:00’, ‘12:00’, ‘13:00’, ‘14:00’, ‘15:00’, ‘16:00’, ‘17:00’, ‘18:00’, ‘19:00’, ‘20:00’, ‘21:00’, ‘22:00’, ‘23:00’],
‘data_format’: ‘netcdf’,
‘area’: [30, 75, 25, 80]
}

client = cdsapi.Client()
client.retrieve(dataset, request).download()

Requesting support on this issue, thanks.

Hi,
Could you login on CDS-Beta and check that the content of your .cdsapirc file matches what you see displayed on the first black box here.

Please note that new .cdsapirc file should only contain a URL and a key field - there is NO UID field anymore!

Hope this helps!

Hi Anabelle,

Thanks for the response. I have checked the .cdsapirc file - it is compliant with the new format shared.

I have tried following potential solutions mentioned in the following link to no avail as well: Unable to download corresponding data using the new API - #19 by user104

I would deeply appreciate support on this.

Warm Regards,
Shubham

Hi @Anabelle, I’m finding the same issue. Could you please advise?

1 Like

Hi,

I am facing the same issue. Did you get the solution? Or is it an existing issue?

Thank you.

Hi,
I made a new cds account yesterday and I’m trying to implement the API key through following the tutorial.

url: https://cds.climate.copernicus.eu/api
key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

When i try to use the example request, I accepted the terms of the datasets, i get the following error

import cdsapi

client = cdsapi.Client()

dataset = ‘reanalysis-era5-pressure-levels’
request = {
‘product_type’: [‘reanalysis’],
‘variable’: [‘geopotential’],
‘year’: [‘2024’],
‘month’: [‘03’],
‘day’: [‘01’],
‘time’: [‘13:00’],
‘pressure_level’: [‘1000’],
‘data_format’: ‘grib’,
}
target = ‘download.grib’

client.retrieve(dataset, request, target)

I get the following error:
AssertionError: The cdsapi key provided is not the correct format, please ensure it conforms to:
:

when i change the keyformat to
UID:APIKEY

i get the HTTP error:
HTTPError: 404 Client Error: Not Found for url: https://cds.climate.copernicus.eu/api/resources/reanalysis-era5-pressure-levels

along with exception
460 “To access this resource, you first need to accept the terms”
461 “of ‘%s’ at %s” % (t[“title”], t[“url”])
462 )
463 error = ". ".join(e)
→ 464 raise Exception(error)
465 else:
466 raise

Exception: Not Found

I’m confused about the apikey format, the HTTP error, also, I’ve definitely accepted the term of the relevant dataset. Whats going wrong?

1 Like

Hello,

I have updated my .cdsapirc in my $HOME to the new version and I am having the same issue.

In my environment:

cads-api-client           1.4.3              pyhd8ed1ab_0    conda-forge
cdsapi                    0.7.3              pyhd8ed1ab_0    conda-forge

Minimal example:

import cdsapi

client = cdsapi.Client()

Returns error:

AssertionError: The cdsapi key provided is not the correct format, please ensure it conforms to:
<UID>:<APIKEY>

Hi everyone,

I had a similar issue when trying to download data using cdsapi. I was using Python 3.11 and kept getting the same error for several days. After trying different things, I switched the interpreter to Miniconda with Python 3.12 in Spyder, restarted the kernel, and it worked. I also tested it in PyCharm and it ran smoothly. Make sure your .cdsapirc file is correctly configured:

url: https://cds.climate.copernicus.eu/api
key: Personal Access Token

Hope this helps, and good luck!

1 Like

I followed today’s instuctions on CDS, with a new venv, python 3.12.3, and new key and url (https://cds.climate.copernicus.eu/api/v2), and still it fails: HTTPError: 404 Client Error: Not Found for url: https://cds.climate.copernicus.eu/api/resources/reanalysis-era5-land

Hi David,
Check your url in the .cdsapirc file; from the API page at Climate Data Store

it should be :
url: https://cds.climate.copernicus.eu/api
key: PERSONAL-ACCESS-TOKEN

(i.e. no “v2” in the url)

Ah, thanks, I don’t know where I got that v2 from, but removing it solved the problem.

1 Like

I did remove the v2 and I stil get the same error.

Hi,
please have a look at the following announcement: CDS, ADS and EWDS down until further notice

Thanks