# Credentials

> A credential stores the secret of an external service once, encrypted. Nodes pick it by id and the orchestrator resolves it on the server when the node runs, so secrets never appear in a workflow, an expression or Git.

Source: https://docs.sommatic.ai/en/security/credentials/ (updated 2026-11-26)

Workflows call external services: an HTTP API, a mailbox, a database, a storage account. Each of those needs a secret.
In Sommatic AI you store that secret once, as a **credential** of your organization, and nodes refer to it by id. The
secret is resolved on the server at the moment the node runs. Your workflow definition, its exports and your Git
repository only ever contain the id.

## Credential types

| Type                | Typical use                                                                            |
| ------------------- | -------------------------------------------------------------------------------------- |
| `api-key`           | A single key or token. Also the type of the read token of a Git repository connection. |
| `basic-auth`        | User name and password.                                                                |
| `oauth2`            | OAuth 2.0 tokens.                                                                      |
| `service-account`   | A cloud service account.                                                               |
| `certificate`       | A certificate and its key.                                                             |
| `connection-string` | A database or storage connection string.                                               |
| `object`            | A structured secret, for example a set of custom headers.                              |
| `custom`            | Anything else.                                                                         |

A credential also records a `provider` (for example HTTP / REST, Microsoft Outlook, PostgreSQL, MongoDB, GitHub), a
name, a description and tags.

## Create a credential

### Open Credentials

In the portal, go to **Platform infrastructure → Credentials** and create a credential.

### Choose the type and provider

Pick the type that matches what the service expects, and the provider.

### Enter the secret

The secret is encrypted when you save it. From then on, Sommatic AI only shows a masked preview, such as the first and last
characters of a key or the user name of a basic-auth pair.

Credentials can also be managed through the API; see the [Credentials API reference](https://docs.sommatic.ai/en/api/reference/credentials.md).
Reading a credential returns its metadata and `masked_preview`, never the secret.

## Use a credential in a node

Nodes that talk to external services have a credential field, usually `connection_id`, shown in the studio as a
**connection picker**. The picker lists only the credential types the node accepts. For example,
[`io.http`](https://docs.sommatic.ai/en/nodes/io.http.md) accepts `api-key`, `basic-auth`, `oauth2` and `object`.

```json
{
  "operator_slug": "io.http",
  "config": {
    "connection_id": "pi-credential-xxxxxxxxxxxxxxx",
    "method": "POST",
    "url": "https://api.example.com/tickets",
    "body": { "subject": "{{ $json.body.subject }}" }
  }
}
```

When the node runs, the orchestrator resolves the credential on the server and uses the secret for that call. The
workflow definition, its versions and its exports keep only the id.

Other nodes with a connection picker include the Outlook connectors
([`connectors.microsoft.outlook.mail`](https://docs.sommatic.ai/en/nodes/connectors.microsoft.outlook.mail.md)), the database integrations
([`integrations.mongodb.operation`](https://docs.sommatic.ai/en/nodes/integrations.mongodb.operation.md),
[`integrations.postgresql.query`](https://docs.sommatic.ai/en/nodes/integrations.postgresql.query.md)) and the I/O nodes such as
[`io.smtp`](https://docs.sommatic.ai/en/nodes/io.smtp.md) and [`io.ftp`](https://docs.sommatic.ai/en/nodes/io.ftp.md).

## Rules

- **Never put a secret in a node's configuration**, a header, a URL or an expression. Use the node's credential field.
- **Never put a secret in Git.** In a repository, the credential id is an environment variable
  (`"connection_id": "@@env.CRM_CREDENTIAL_ID@@"`), because each installation has its own credentials. See
  [Environments and tokens](https://docs.sommatic.ai/en/git-sync/environments-and-tokens.md).
- **One credential per purpose.** Separate credentials per service and per environment make rotation and revocation
  simple and keep the audit readable.
- **Least privilege.** Give each credential only the scopes its workflows need. A Git repository connection only needs
  read access.

> **Note: Resolution is recorded**
>
> Every resolution is logged with the credential id, the organization, the credential type and the service that asked
> for it. See [Audit](https://docs.sommatic.ai/en/security/audit.md).

## Next steps

- [Audit](https://docs.sommatic.ai/en/security/audit.md): What Sommatic AI records for every run.
- [Credentials API reference](https://docs.sommatic.ai/en/api/reference/credentials.md): Create, read, update and delete credentials.
