# Check if you are enabled for PagoPA UAT environment

{% hint style="info" %}
PagoPA provides a package of tools to test the environment integration and to run functional tests.&#x20;

This paragraph describes how to test if you are able to call PagoPA APIs.

After the set up of the environments and after the Batch Service installation you will be required to run functional test using resources from the same package.
{% endhint %}

### Get cstar-cli tool

{% hint style="warning" %}
**Make sure** to have the latest version downloaded.
{% endhint %}

* download zip

  ```
  wget -O ./cstar-cli.tar.gz wget https://github.com/pagopa/cstar-cli/releases/latest/download/cstar-cli.tar.gz
  ```
* decompress it

  ```
  tar -xvf cstar-cli.tar.gz
  ```
* move to CSTAR-CLI directory

  ```
  cd cstar-cli-*
  ```

### Step 1. Mutual Authentication certificate validity check UAT

The first step checks the validity of the client certificate, with a call to a dedicated [endpoint](https://api.uat.cstar.pagopa.it/rtd/mauth/check) using your certificate and your private key.

From the cstar-cli project root run the script with the following command:

```
sh ./integration_check/scripts/001-mAuth-check-UAT/script.sh /PATH/TO/COMPANY_NAME.certificate.pem /PATH/TO/COMPANY_NAME.key
```

Note that you have to specify the path to your certificate and to the private key as arguments.

The script will print the result, the correct value is **200 .**

**Example of expected** **result:**

```
--<TIMESTAMP>--  https://api.uat.cstar.pagopa.it/rtd/mauth/check
Resolving api.uat.cstar.pagopa.it (api.uat.cstar.pagopa.it)... 20.86.233.151
Connecting to api.uat.cstar.pagopa.it (api.uat.cstar.pagopa.it)|20.86.233.151|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24 [application/json]
Saving to: ‘STDOUT’
-
  "result": "PASS"
-
```

### Step 2. API Key validity check UAT

The second step checks the validity of the API Key, with a call to a dedicated [endpoint](https://api.uat.cstar.pagopa.it/rtd/api-key/check) using your certificate, your private key and the UAT API Key.

From the cstar-cli project root run the script with the following command:

```
sh ./integration_check/scripts/002-API-key-check-UAT/script.sh /PATH/TO/COMPANY_NAME.certificate.pem /PATH/TO/COMPANY_NAME.key UAT_API_KEY
```

Note that you have to specify the path to your certificat&#x65;**,** the path to the private key and the API key as arguments.

The script will print the result, the correct value is **200 .**

**Example of expected** **result:**

```
--<TIMESTAMP>--  https://api.uat.cstar.pagopa.it/rtd/api-key/check
Resolving api.uat.cstar.pagopa.it (api.uat.cstar.pagopa.it)... 20.86.233.151
Connecting to api.uat.cstar.pagopa.it (api.uat.cstar.pagopa.it)|20.86.233.151|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24 [application/json]
Saving to: ‘STDOUT’
-
  "result": "PASS"
-
```
