# API Key

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2F0tMgduvA7wwFF65L6BNH%2Fimage.png?alt=media&#x26;token=c924c470-03c0-4c35-a9ae-e3c5d24f961b" alt="" width="188"><figcaption></figcaption></figure></div>

The API Key service allows your app to securely store sensitive information like API keys, SSH keys, passwords, secrets, etc and access them within your Cloud Flow Web Hooks and Background Tasks.

***

## Profile Settings

{% hint style="success" %}
NOTE: All profile settings are encrypted and stored in Zingy's cloud infrastructure.
{% endhint %}

### Secret

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FTxVBqcBh3bC5KPi57gvJ%2Fimage.png?alt=media&#x26;token=18c34a78-58f1-4293-8e1f-6f9ddb213061" alt="" width="375"><figcaption></figcaption></figure></div>

Paste or enter the API key, SSH key, password, secret, etc here.

### Secret2/Secret3/Secret4 (optional)

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FvpLudHDYt4871qtCsiJD%2Fimage.png?alt=media&#x26;token=935af93f-4a96-4248-8fba-d33386e693e4" alt="" width="375"><figcaption></figcaption></figure></div>

Optionally store up-to 3 other related key/secret values as part of the profile.

***

## Connection Settings

The API Key service does not have any connection specific settings.

***

## Operations/Commands

The [Execute Connection Command](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/execute-connection-command) block is available in both [Page Flow](https://docs.zingy.ai/app-editor/page-flow) and [Cloud Flow](https://docs.zingy.ai/app-editor/cloud-flow). Using this block you can add logic to trigger the operations/commands supported by the API Key service.

{% hint style="success" %}
For security purposes, all operations/commands offered by the API Key service are only available in [Cloud Flow](https://docs.zingy.ai/app-editor/cloud-flow) and cannot be used in [Page Flow](https://docs.zingy.ai/app-editor/page-flow).
{% endhint %}

### Retrieve

Use this command to retrieve the values for the API key, SSH key, password, secret, etc.

#### Input Data

None

#### Output

Object representing the key/secret values:

<table><thead><tr><th width="149">Property</th><th width="95">Type</th><th>Description</th></tr></thead><tbody><tr><td>secret1</td><td><a href="../../page-flow/references/value-types">text</a></td><td>The main secret value</td></tr><tr><td>secret2, secret3, secret4</td><td><a href="../../page-flow/references/value-types">text</a></td><td>Additional secret values</td></tr></tbody></table>

***

## Advanced Functionality

In your app's Cloud Flow Web Hooks and Background Tasks, the [Custom Code](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/custom-code) block can also be used to retrieve keys/secrets stored using this service.

```java
const keyInfo = zingyConn.apikey(connectionName);
```

The `keyInfo` object contains the `secret1` , `secret2` , `secret3` and `secret4` properties for the key/secret values.
