Cannot download ERA5 data via CDS-API: "requests.exceptions.HTTPError: 404 Client Error" and "Exception: Not Found"

Hello, I am new to the CDS-API and I am struggling with using the CDS-API in downloading ERA5 reanalysis data through Windows OS. Here is my code:

import cdsapi

dataset = 'reanalysis-era5-pressure-levels'
request = {
    'product_type': ['reanalysis'],
    'variable': [
        'specific_humidity',
        'temperature',
        'u_component_of_wind',
        'v_component_of_wind',
        'vertical_velocity'
    ],
    'year': [
        '1985', '1986', '1987', '1988', '1989', '1990', '1991', '1992', '1993',
        '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002',
        '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011',
        '2012', '2013', '2014', '2015'
    ],
    'month': ['01', '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', '03:00', '06:00',
        '09:00', '12:00', '15:00',
        '18:00', '21:00'
    ],
    'pressure_level': [
        '100', '125', '150',
        '175', '200', '225',
        '250', '300', '350',
        '400', '450', '500',
        '550', '600', '650',
        '700', '750', '775',
        '800', '825', '850',
        '875', '900', '925',
        '950', '975', '1000'
    ],
    'data_format': 'netcdf',
    'download_format': 'unarchived',
    'area': [50, 90, -10, 180]
}

client = cdsapi.Client()
client.retrieve(dataset, request, 'C:/Users/username/Desktop/clima_upper.nc').download()

I already had the latest python and cdsapi installed and the paths saved in the environment variables. I also have the “.cdsapirc” file stored in the "C:\Users\username" folder. As instructed, my “.cdsapirc” file contains:

url: https://cds.climate.copernicus.eu/api
key: <PERSONAL-ACCESS-TOKEN>

To prevent the “401 Client Error: Unauthorized” error, I used my User ID and API Token, thus formatting as “User ID:API Token”.

But, the Command Prompt returned the error messages “requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://cds.climate.copernicus.eu/api/resources/reanalysis-era5-pressure-levels” and “Exception: Not Found”:

I been searching for similar cases in the forum but many of them dealt with the CDS-Beta version which has be deprecated, so I can’t apply their troubleshoots. How do I fix this error? Could I have missed some steps or maybe I had done some mistakes along the way?

Brian

URL is now https://cds.climate.copernicus.eu/api/v2

Another thing you might also need to be aware of is that if you have instantaneous variables, such as temperature, and accumulated ones (e.g. solar radiation) two separate netcdf files are created, in which case you need to change download_format to ‘ZIP’. I don’t think this applies in you case.

Kind regards

Angus