# ESP APIs

ESP APIs provide authentication flows via SPID, CIE, CNS, and EIDAS. Use these endpoints to obtain a session key, initiate a login, and retrieve a JWT containing the user's identity attributes.

Version: 26.0.0
License: Apache 2.0

## Servers

Development and testing environment
```
https://esp-saas.test.namirialtsp.com
```

Production environment
```
https://esp-saas.namirialtsp.com
```

## Security

### ApiKeyAuth

Type: apiKey
In: header
Name: Esp-Api-Key

### sslCertificate

Mutual TLS (mTLS) authentication. A client SSL certificate issued by Namirial during the assessment phase is required. The certificate must be presented during the TLS handshake.

Type: apiKey
In: header
Name: X-SSL-Client-Cert

## Download OpenAPI description

[ESP APIs](https://docs.namirial.app/_bundle/products/esp/openapi.yaml)

## Get Key

Returns a session key (`authnKey`) to initiate an authentication flow with SPID, CIE, or EIDAS.

### Get a authn key to start an authentication flow

 - [GET /api/secure/{environment_name}/getKey](https://docs.namirial.app/products/esp/openapi/get-key/getkey.md)

### Get a authn key to start an authentication flow (deprecated)

 - [GET /sslprotected/{environment_name}/getKey.php](https://docs.namirial.app/products/esp/openapi/get-key/getkeydeprecatedphp.md)

### Get a authn key to start an authentication flow (deprecated)

 - [GET /sslprotected/{environment_name}/getKey](https://docs.namirial.app/products/esp/openapi/get-key/getkeydeprecated.md)

## Login

Initiates the authentication flow with SPID/EIDAS, CIE, or CNS.

### Login with SPID/EIDAS with a browser

 - [GET /{environment_name}/spidlogin](https://docs.namirial.app/products/esp/openapi/login/spidlogin.md)

### Login with CIE with a browser

 - [GET /{environment_name}/cielogin](https://docs.namirial.app/products/esp/openapi/login/cielogin.md)

### Login with CNS with a browser

 - [GET /{environment_name}/cnslogin](https://docs.namirial.app/products/esp/openapi/login/cnslogin.md)

### Login with SPID with a browser (deprecated)

 - [GET /{environment_name}/spidlogin.php](https://docs.namirial.app/products/esp/openapi/login/spidlogindeprecatedphp.md)

### Login with CIE with a browser (deprecated)

 - [GET /{environment_name}/cielogin.php](https://docs.namirial.app/products/esp/openapi/login/cielogindeprecatedphp.md)

## Logout

Initiates the SPID logout flow. Not required for Level 2 authentications.

### Logout for SPID

 - [GET /{environment_name}/logout](https://docs.namirial.app/products/esp/openapi/logout/logout.md): Initiates the SPID logout flow. Not required for Level 2 authentications.

## Get user

Exchanges the session `id` and `key` (returned after login) for a JWT containing the user's identity attributes.

### Get a user JWT

 - [GET /api/secure/{environment_name}/getUser](https://docs.namirial.app/products/esp/openapi/get-user/getuser.md)

### Get a user JWT (deprecated)

 - [GET /sslprotected/{environment_name}/getUser.php](https://docs.namirial.app/products/esp/openapi/get-user/getuserdeprecatedphp.md)

### Get a user JWT (deprecated)

 - [GET /sslprotected/{environment_name}/getUser](https://docs.namirial.app/products/esp/openapi/get-user/getuserdeprecated.md)

