# Unable to run script despite migrating to new CDS API

**URL:** <https://forum.ecmwf.int/t/unable-to-run-script-despite-migrating-to-new-cds-api/5608>\
**Category:** Access and Login\
**Tags:** api\
**Created:** [16 September 2024 18:48 UTC](https://forum.ecmwf.int/t/unable-to-run-script-despite-migrating-to-new-cds-api/5608 "2024-09-16T18:48:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [7 October 2024 12:42 UTC](https://forum.ecmwf.int/t/unable-to-run-script-despite-migrating-to-new-cds-api/5608/2 "2024-10-07T12:42:22Z")

</div>

**Suggestion 1:**

- Update the cdsapi package!

**Suggestion 2:**  
Provide the key in an alternative way:

> [@Sohum\_Chatterjee](#):
>
> The cdsapi key provided is not the correct format, please ensure it conforms to:

This indicates that the key is incorrect. You could try the following within your code (not neat & don’t commit to git, but quick fix):

```auto
import os

# Set the API credentials as environment variables
os.environ['CDSAPI_URL'] = 'https://cds.climate.copernicus.eu/api/v2'
os.environ['CDSAPI_KEY'] = 'your_api_key_here'

```

See also this post on other versions of this suggestion: [https://prod.ecmwf-forum-prod.compute.cci2.ecmwf.int/t/is-there-elsewhere-to-put-the-cdsapirc-file-running-it-on-databricks/956](https://prod.ecmwf-forum-prod.compute.cci2.ecmwf.int/t/is-there-elsewhere-to-put-the-cdsapirc-file-running-it-on-databricks/956)

---

_[View the full topic](https://forum.ecmwf.int/t/unable-to-run-script-despite-migrating-to-new-cds-api/5608)._
