# Unable to download corresponding data using the new API

**URL:** <https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448>\
**Category:** C3S - Datasets and Usage\
**Created:** [25 July 2024 06:36 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448 "2024-07-25T06:36:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 06:36 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/1 "2024-07-25T06:36:46Z")

</div>

Dear all,  
I recently tried using the new beta version of the API and encountered an issue that I thought might interest you. Even when following the official example provided, I’m faced with an error. Here’s the code I used:

```python
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)

```

However, I’m getting the following error:

```auto
HTTPError: 404 Client Error: Not Found for url: https://cds-beta.climate.copernicus.eu/api/resources/reanalysis-era5-pressure-levels
During handling of the above exception, another exception occurred:

```

I’m puzzled as to why this is happening. Is it possible that the new version of the API is not ready for data downloads yet? I would appreciate any insights you might have on this issue.  
Best regards,  
Wang

---

<div class="post-metadata">

**Author:** ![Laurens\_Stoop](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/laurens_stoop/32/480_2.png) [@Laurens\_Stoop](https://forum.ecmwf.int/u/Laurens_Stoop)\
**Post date:** [25 July 2024 08:59 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/2 "2024-07-25T08:59:48Z")

</div>

Hi Wang,

No idea what is exactly wrong, but given the same remade request, I got the data. The only difference is the " instead of ’ around the dataset name (& use of Pathlib).

WIth the following code-block I was able to retreive the data:

```auto
import cdsapi

# nicer paths
from pathlib import Path
LOCATION_ERA5 = Path("c:/Data/")

# input
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'
}

# Request call
client = cdsapi.Client()
target = LOCATION_ERA5 / 'download.grib'
client.retrieve(dataset, request, target)

```

Make sure to set your .cdsapirc file as shown on: [How to API](https://cds-beta.climate.copernicus.eu/how-to-api)

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 09:55 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/3 "2024-07-25T09:55:58Z")

</div>

Hi Laurens\_Stoop,  
Thank you for your prompt response. I have reviewed and followed the API usage tutorial for the Windows system as per the instructions provided on the website. However, when I attempted to utilize the tutorial for Linux, I encountered an error stating that I was missing a “uid”. Additionally, it appears that the Windows tutorial may be outdated.  
To address this issue, I combined the updated URL with the information from the Windows tutorial and configured the .cdsapirc file as follows:

```auto
url: https://cds-beta.climate.copernicus.eu/api
key: User ID0:Personal Access Token

```

Unfortunately, this configuration did not resolve the problem. I would greatly appreciate any further guidance or assistance you could provide. Please let me know if there are any additional steps I need to take or if there are alternative solutions available.  
Thank you once again for your help. I look forward to your response.

Best,  
Wang

---

<div class="post-metadata">

**Author:** ![Michela](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/m/898d66/32.png) [@Michela](https://forum.ecmwf.int/u/Michela)\
**Post date:** [25 July 2024 10:12 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/4 "2024-07-25T10:12:46Z")

</div>

Hi,  
did you accept the license as mentioned in this post?

> **[The new Climate Data Store Beta (CDS-Beta) is now live!](https://prod.ecmwf-forum-prod.compute.cci2.ecmwf.int/t/the-new-climate-data-store-beta-cds-beta-is-now-live/3315/6)**
>
> Hi, you need to go to the ERA5 pressure levels webform (https://cds-beta.climate.copernicus.eu/datasets/reanalysis-era5-pressure-levels?tab=download) and accepted the Licence to use Copernicus Products Thanks

Thanks

---

<div class="post-metadata">

**Author:** ![Laurens\_Stoop](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/laurens_stoop/32/480_2.png) [@Laurens\_Stoop](https://forum.ecmwf.int/u/Laurens_Stoop)\
**Post date:** [25 July 2024 10:20 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/5 "2024-07-25T10:20:39Z")

</div>

Make sure to login to the CDS-beta system. Both during the making of the request (to accept the license of the dataset) and during the visit to the guide page!  
If you are not logged in, then your personal key won’t show on the ‘How-to’ page.

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 10:36 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/6 "2024-07-25T10:36:36Z")

</div>

![image](https://forum.ecmwf.int/uploads/default/original/1X/a0fea8c9b559deb816d2bed88055cfa6eb6c1dc2.png)

Dear Michela,  
Thank you for your reply. I have obtained the necessary permissions (four in total). The web download is working, but the API is not.  
Best regards,  
Wang

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 10:39 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/7 "2024-07-25T10:39:17Z")

</div>

Hi Laurens\_Stoop,  
Thanks for your response. I’ve logged in and registered on the new site, and used the new key as previously mentioned, but unfortunately, it still failed. I can’t seem to pinpoint the issue.QWQ

---

<div class="post-metadata">

**Author:** ![Laurens\_Stoop](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/laurens_stoop/32/480_2.png) [@Laurens\_Stoop](https://forum.ecmwf.int/u/Laurens_Stoop)\
**Post date:** [25 July 2024 12:12 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/8 "2024-07-25T12:12:07Z")

</div>

No worries, have you explicitely also accepted the license for the pressure level data of ERA5?  
While I accepted the license for ERA5 single level variables, I needed to also accept the presure level data license. It seems that each dataset has its own license (for reasons).

 ![afbeelding](https://forum.ecmwf.int/uploads/default/original/1X/88c03e9dbd336a3d63f19ec1fd3f4b26d2b0105c.png)

For the solution maybe see also your other topic post on this 😉: [https://prod.ecmwf-forum-prod.compute.cci2.ecmwf.int/t/new-website-usage-mistakes/3447/4](https://prod.ecmwf-forum-prod.compute.cci2.ecmwf.int/t/new-website-usage-mistakes/3447/4)

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 12:25 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/9 "2024-07-25T12:25:13Z")

</div>

Yes, I’ve already accepted it. I suspect there might be an issue with the content of the .cdsapirc file. Here’s how I’ve set it up:

```auto
  url: https://cds-beta.climate.copernicus.eu/api
  key: UID (formatted as ********-**** - ****-**** - ************ ):Personal Access Token (I've tried both uppercase and lowercase, but both resulted in failure)

```

Are you also using a Windows system? Could you please help me check if this format is correct?  
Thank you very much~

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 12:26 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/10 "2024-07-25T12:26:43Z")

</div>

![image](https://forum.ecmwf.int/uploads/default/original/1X/34fb5e5229f27dfe53cc6717b1c2a27e9f7960d7.png)  
This is my download website page, it looks the same as yours.

---

<div class="post-metadata">

**Author:** ![Laurens\_Stoop](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/laurens_stoop/32/480_2.png) [@Laurens\_Stoop](https://forum.ecmwf.int/u/Laurens_Stoop)\
**Post date:** [25 July 2024 12:30 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/11 "2024-07-25T12:30:46Z")

</div>

Hi QWQ,

As I mentioned in the other post;

Maybe set your file as follows:

```auto
url: https://cds-beta.climate.copernicus.eu/api
key: [key here]

```

N.B.: The inclusion of your UID within the .cdsapirc file is gone for the CDS-beta system. In the past you indeed needed to list both user id & key, now just the key.

The old one looked like (i.e. DO NOT USE THIS IN CDS-BETA):  
 ![afbeelding](https://forum.ecmwf.int/uploads/default/original/1X/f2d4ecbf4c5f9459aab4ef8818c6a4060c599240.png)  
But the new one looks like (USE THIS):  
 ![afbeelding](https://forum.ecmwf.int/uploads/default/original/1X/68d708edbfe309dc58c232d32d73df8f18be95a7.png)

[The other topic post on this.](https://prod.ecmwf-forum-prod.compute.cci2.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3447/4)

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 12:44 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/12 "2024-07-25T12:44:18Z")

</div>

Hi Laurens,  
Thank you for your suggestion. In fact, I tried this writing method, but Python gave me an error saying that the UID is missing.

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 12:47 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/13 "2024-07-25T12:47:43Z")

</div>

![1721911641717](https://forum.ecmwf.int/uploads/default/original/1X/fb3fa8318c22e4fcc2cfdc541506910421ec471d.png)  
Like this.

---

<div class="post-metadata">

**Author:** ![Laurens\_Stoop](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/laurens_stoop/32/480_2.png) [@Laurens\_Stoop](https://forum.ecmwf.int/u/Laurens_Stoop)\
**Post date:** [25 July 2024 12:50 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/14 "2024-07-25T12:50:43Z")

</div>

Are you using the `cdsapi` version 0.7.0?

Make sure to use the latest version of the cdsapi!

The line in the api.py file is incorrect for the code of version 0.7.0, see line 337 & 354 on:

> <https://github.com/ecmwf/cdsapi/blob/master/cdsapi/api.py>

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 13:05 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/15 "2024-07-25T13:05:59Z")

</div>

![image](https://forum.ecmwf.int/uploads/default/original/1X/8e321c2380f1e91737a4a39348b7712312f7001f.png)  
Thank you for your suggestion. I updated this library at the beginning, and it also shows 0.7.0. It seems there’s no issue? I’ve also tried uninstalling and reinstalling this library, and it’s still the same version.  
Wang

---

<div class="post-metadata">

**Author:** ![Laurens\_Stoop](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/laurens_stoop/32/480_2.png) [@Laurens\_Stoop](https://forum.ecmwf.int/u/Laurens_Stoop)\
**Post date:** [25 July 2024 13:13 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/16 "2024-07-25T13:13:47Z")

</div>

No real ideas anymore, sorry 🥲.

Last wild-card idea: Are you sure the `.cdsapirc` file has no extension (like a hidden file extension in windows)? mine was initially named `.cdsapirc.txt` & got me weird issues on windows.

Fix: open Windows explorer → go to the view tab → check the field of ‘file name extensions’ & then check if the `.cdsapirc` file located at `C:\Users\[your_username]\` is indeed reading `.cdsapirc`.

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 13:26 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/17 "2024-07-25T13:26:39Z")

</div>

![image](https://forum.ecmwf.int/uploads/default/original/1X/c2c48614e92a5bb819c4dc64a1da684f6f9897a7.png)  
Thank you so much for your help. But it seems that the format is also correct (cry.jpg).

---

<div class="post-metadata">

**Author:** ![Michela](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/m/898d66/32.png) [@Michela](https://forum.ecmwf.int/u/Michela)\
**Post date:** [25 July 2024 13:28 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/18 "2024-07-25T13:28:00Z")

</div>

Hi,  
did you try to specify the url and key directly into the request as:

```py
client = cdsapi.Client(url='https://cds-beta.climate.copernicus.eu/api', key='<YOUR-KEY>')

```

Please take the key from this link after you log in: [Climate Data Store](https://cds-beta.climate.copernicus.eu/how-to-api)  
Please also make sure that the required python packages are updated to the latest version.  
Thanks

---

<div class="post-metadata">

**Author:** ![user104](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/user104/32/761_2.png) [@user104](https://forum.ecmwf.int/u/user104)\
**Post date:** [25 July 2024 13:56 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/19 "2024-07-25T13:56:31Z")

</div>

![1721915829379](https://forum.ecmwf.int/uploads/default/original/1X/1ba57a44b6dda2eaf8f39e90b4753b65206f4902.png)

Thank you for your suggestion. I tried it, but it still failed. The Python error message is as shown in the figure.

---

<div class="post-metadata">

**Author:** ![Shubham\_B](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@Shubham\_B](https://forum.ecmwf.int/u/Shubham_B)\
**Post date:** [29 July 2024 08:58 UTC](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448/20 "2024-07-29T08:58:33Z")

</div>

Hi, have you been able to resolve this? I’m facing this exact issue as well.

[Next page](https://forum.ecmwf.int/t/unable-to-download-corresponding-data-using-the-new-api/3448.md?page=2)
