# How to access the CDC API using POSTMAN?

**URL:** <https://forum.ecmwf.int/t/how-to-access-the-cdc-api-using-postman/1479>\
**Category:** API\
**Tags:** api, c3s\
**Created:** [30 November 2021 11:31 UTC](https://forum.ecmwf.int/t/how-to-access-the-cdc-api-using-postman/1479 "2021-11-30T11:31:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petru\_Bogdan\_Petresc](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/p/a3d4f5/32.png) [@Petru\_Bogdan\_Petresc](https://forum.ecmwf.int/u/Petru_Bogdan_Petresc)\
**Post date:** [30 November 2021 11:31 UTC](https://forum.ecmwf.int/t/how-to-access-the-cdc-api-using-postman/1479/1 "2021-11-30T11:31:49Z")

</div>

## 1.&nbsp;Create an account and accept the terms of usage

Created an account on the&nbsp;[https://cds.climate.copernicus.eu/](https://cds.climate.copernicus.eu/)&nbsp;page using the [Login/register](https://cds.climate.copernicus.eu/user/login?destination=%2F%23!%2Fhome) section.

An email will be sent to the indicated email account in which the user is asked to set-up a password.

Using the email address and the password, the user can log in.&nbsp;As a result, the user-detail page (where one can see the&nbsp; **UID** &nbsp;and&nbsp; **API Key** ) becomes available.

Warning!

The account is not yet fully functional, the user must first agree with the terms of the licence by reading and submitting it on the&nbsp;[licence-to-use-copernicus-products](https://cds.climate.copernicus.eu/cdsapp/#!/terms/licence-to-use-copernicus-products) page.

## 2. Use the&nbsp; **UID** &nbsp;and&nbsp; **API Key** to authenticate on Postman

The&nbsp; **UID** &nbsp;and&nbsp; **API Key** &nbsp;can be used in two different ways in order to provide authentication.

### 2.1. Authenticate using the Authorization tab

Create a request and on the **Authorization** tab, choose the **Basic Auth** type and input&nbsp;the&nbsp; **UID** &nbsp;(as **username** ) and the&nbsp; **API Key** &nbsp;(as **password** ),&nbsp; as follows:

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

### 2.2. Authenticate using a request header

Otherwise, using the&nbsp; **UID** &nbsp;and&nbsp; **API Key** ,&nbsp;a basic-authentication token can be generated,&nbsp; as follows:  
 opening a browser page (Chrome, Edge, etc) and then the Developer Tools (by pressing the F12 key or by pressing the mouse right-button and then selecting "Inspect"), on the "Console" tab, by typing in (or copy/paste) the following content (replacing the uid and apiKey strings with the real values obtained above) and pressing "Enter".

```
encodedData = "Basic " + window.btoa('uid:apiKey')
```

The result should be something similar to the following image:

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

On the Headers tab, using the generated token, add a new entry, as shown below:

| Authorization | Basic dWlkOmFwaUtleQ== |
| --- | --- |

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

## 3. Create a request

Open Postman and create a new request, i.e.&nbsp;_reanalysis-era5-pressure-levels-preliminary-back-extension_, using the token above as an authorization header:

[https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-pressure-levels](https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-pressure-levels)

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

The body of the request is a JSON payload as shown in the&nbsp;[body.json](https://confluence.ecmwf.int/download/attachments/242083151/body.json?version=1&modificationDate=1638274067021&api=v2)&nbsp;file.

This content was created by running the same request in the [web-application](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels-preliminary-back-extension?tab=form).

 ![](https://forum.ecmwf.int/uploads/default/original/1X/3603aff1c71c0f65f96d9092bf3415b61ddf6c0d.png) ![](https://forum.ecmwf.int/uploads/default/original/1X/385b5f39ed561b59455af7a3e98a9b431f96dff9.png) ![](https://forum.ecmwf.int/uploads/default/original/1X/8364c66ab0086876fbcf31995cbf30a7e2eb013f.png) ![](https://forum.ecmwf.int/uploads/default/original/1X/595aac388603c3f1ba1a45a5bd2b50a5eba7818b.png)

Consulting, then, the "Network" tab of the Developer Tools, both the request payload and response are visible.

 ![](https://forum.ecmwf.int/uploads/default/original/1X/3838d8a75920ed3c6c41db8b0e459982ee59f8fb.png) ![](https://forum.ecmwf.int/uploads/default/original/1X/5c670c7e810259721109fc6af0229e4c44b70840.png)
