> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decimal.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Secrets

> Store API keys and OAuth client credentials once, and let your custom tools use them with authentication handled for you.

Secrets let your custom tools call APIs that need authentication, without anyone pasting a credential into a tool. You store an API key or a set of OAuth client credentials once under a **key**, and tools reference it by that key. Decimal fills in the real value when the tool runs.

For example, a tool that looks up a customer's orders in your billing system needs the billing API's key. Save it as `BILLING_API_KEY`, and the tool sends `Bearer {{secrets.BILLING_API_KEY}}`. The key itself never appears in the tool, and when you rotate it, every tool that uses it picks up the new value.

Secrets are for custom tools only. To connect a tool Decimal already integrates with, like [Zendesk](https://docs.decimal.app/integrations/zendesk.md), [GitHub](https://docs.decimal.app/integrations/github.md), or [Stripe](https://docs.decimal.app/integrations/stripe.md), use its page in [**Settings → Integrations**](https://app.getdecimal.ai/settings/integrations). Credentials entered there belong to that integration and don't appear in Secrets. The [integrations list](https://docs.decimal.app/integrations/overview.md) has the full catalog.

## How secrets work

* **Tools reference a secret by key, not by value.** A tool's URL, headers, or JSON body can include `{{secrets.KEY}}`. Decimal swaps in the value server-side on every request.
* **Values are write-only.** After you save a secret, Decimal never shows the value again. If you've lost the original, generate a new one in the third-party tool and rotate it in.
* **Agents never see the value.** Secret values are masked in test results and stripped from API responses before an agent reads them.
* **OAuth tokens are handled for you.** For an OAuth secret, Decimal exchanges the client ID and secret for an access token, refreshes it before it expires, and retries once with a fresh token if an API returns `401`.
* **Old secrets are flagged.** A secret whose value hasn't changed in 90 days is marked in the list so you know it's due for rotation.

Only workspace admins can create, rotate, or delete secrets.

## Create a secret

**1. Open Secrets**

Go to [**Settings → Secrets**](https://app.getdecimal.ai/settings/secrets) and click **New secret**.

**2. Choose a type and fill in the details**

> [tab] Value
>
> Use this for a static API key, token, or password.
>
> * **Key** (required) - the name tools use to reference the secret, for example `BILLING_API_KEY`. Uppercase letters, numbers, and underscores, starting with a letter. Decimal uppercases what you type.
> * **Value** (required) - paste the credential.
> * **Description** (optional) - "What this secret is for". Note where the credential came from and who owns it, so the next admin knows where to rotate it.

> [tab] OAuth client credentials
>
> Use this when the API issues short-lived access tokens through the OAuth 2.0 client credentials grant, the machine-to-machine variant of OAuth with no browser sign-in. Decimal mints and refreshes access tokens for you.
>
> * **Key** (required) - same rules as a value secret.
> * **Token URL** (required) - the provider's OAuth token endpoint, for example `https://auth.example.com/oauth/token`. Must start with `https://`.
> * **Client ID** and **Client secret** (required) - from the OAuth app or API client you registered with the provider.
> * **Audience** (optional) - only if the provider requires one.
> * **Scope** (optional) - space-separated scopes to request, for example `read:users`.
> * **Send credentials as** (required) - how the provider expects the client ID and secret in the token request: **JSON body** (the default), **Form body**, or **Basic auth header**. Check the provider's API documentation.
> * **Description** (optional) - what the secret is for.

**3. Create**

Click **Create secret**. For an OAuth secret, Decimal requests an access token right away. If the provider refuses, the secret isn't saved and the error names the host and status, for example `auth.example.com · 401 invalid_client`.

Creating a secret with a key that already exists replaces that secret's value. Tools using the key switch to the new value on their next call.

## Use a secret in a custom tool

In a custom tool's URL, headers, or JSON body, type `{{` and pick the secret from the list, or write the reference yourself:

```text theme={null}
Authorization: Bearer {{secrets.BILLING_API_KEY}}
```

For an OAuth secret, `{{secrets.KEY}}` resolves to the current **access token**, not the client secret. Put it in the `Authorization` header with the `Bearer` prefix.

If a tool references a key that doesn't exist, the editor shows **Add KEY in Secrets**, and runs fail with "The secret KEY doesn't exist. Add it in Settings, Secrets."

## Rotate a secret

Open the menu at the end of the secret's row.

* **Value secret** - click **Rotate value**, paste the new value, and click **Save**.
* **OAuth secret** - click **Edit secret** and paste the new **Client secret**. The field shows "Unchanged"; leave it blank to keep the stored secret while you edit other fields.

Decimal doesn't keep previous values, so the old credential stops being used the moment you save. To rotate without downtime:

1. Create the new credential in the third-party tool, leaving the old one active.
2. Rotate it in Decimal.
3. Test a custom tool that uses the secret.
4. Revoke the old credential in the third-party tool.

### When to rotate

We recommend rotating each secret at least every 90 days, and right away if the value may have been exposed or someone who had it leaves your team.

Decimal tracks the 90 days for you. Once a secret's value is older than that, its row gets an **Unchanged** badge with the number of days (hover for the date it last changed), and a banner above the list counts how many secrets are overdue. Select **Over 90 days** in the banner to filter the list to just those.

Only a new value resets the count. For an OAuth secret, that means a new client secret: editing the scope or audience, or refreshing the access token, doesn't count as a rotation.

If your security policy sets a shorter window, rotate on that schedule. The badge still appears only at 90 days.

## OAuth access tokens

Each OAuth secret's row shows when its current access token expires, for example "Access token expires in 58m". Decimal refreshes the token shortly before that, so you don't need to do anything while it's working.

When Decimal can't get a token, the row shows **Couldn't get access token** in red, with when it last failed. The most common cause is a client secret that expired or was revoked in the third-party tool: generate a new one and paste it into **Edit secret**.

To check a fix, or to pick up permission changes made in the third-party tool, click **Refresh access token** in the row's menu. Decimal requests a new token immediately.

## Delete a secret

Click **Delete secret** in the row's menu and confirm. Tools that reference the key fail until you create a secret with the same key. This can't be undone.

## Gotchas and troubleshooting

> [accordion] Saving an OAuth secret fails with "Couldn't get an access token"
>
> Decimal tests the credentials before saving them. Check the client ID and secret first. If they're right, try a different **Send credentials as** option: providers disagree on whether credentials go in a JSON body, a form body, or a Basic auth header. A `400 invalid_scope` or `access_denied` means the **Scope** or **Audience** doesn't match what the client is allowed to request.

> [accordion] "can't be reached from Decimal"
>
> The token URL resolves to a private network address, which Decimal won't call. Use the provider's public token endpoint.

> [accordion] HTTPS is required for token URLs
>
> The **Token URL** must start with `https://`. Plain `http://` endpoints are rejected.

> [accordion] A tool call fails with 401
>
> For a value secret, the stored value is wrong or was revoked: rotate it. For an OAuth secret, Decimal already retried with a fresh token, so check the row for **Couldn't get access token** and confirm the API accepts tokens from that client.

> [accordion] A tool call fails with 403
>
> The credential works but doesn't have permission for that request. Grant the permission or scope in the third-party tool. For an OAuth secret, click **Refresh access token** afterwards so the new token carries it.

> [accordion] Secrets can be replaced but never viewed
>
> There is no way to reveal a stored value. If you've lost the original, generate a new one in the third-party tool and rotate it in.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.