> For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://ibee.ai/docs/llms.txt (full text of every page: https://ibee.ai/docs/llms-full.txt). For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://ibee.ai/docs/_mcp/server.

# Manage Secret Manager with the IBEE API

> Automate IBEE Secret Manager with an API token - enable it, list and search secret names, read and change secret settings, manage versions and app credentials. Scopes, roles, every operation, examples with curl, and errors. The API never reads or writes secret values.

The IBEE API manages Secret Manager the way the portal does: enable it for a workspace, list and search secret names, read version history, change a secret's settings, delete, undelete or destroy versions, and create or revoke app credentials. It **never reads or writes a secret value**. Values go only over the [Vault API](/docs/tools/secret-manager/connect-apps) at your workspace's address, with an app credential.

## Before you begin

* An [API token](/docs/tools/api-tokens) with **Secret Manager → Read** (`secret-manager.read`) or **Edit** (`secret-manager.write`), and your workspace ID.
* Every call is `https://api.ibee.ai/v1/secret-manager/…` with `workspace_id` as a query parameter and `Authorization: Bearer <token>`. See [Authentication](/docs/api-reference/authentication).
* The token acts as the person who created it. Each call checks the token's scope **and** that person's current role in the workspace **and**, for changes, the organization's identity verification:

| Calls                                                     | Scope                  | The token owner's role         |
| --------------------------------------------------------- | ---------------------- | ------------------------------ |
| Status, names, search, metadata, history                  | `secret-manager.read`  | Any role with workspace access |
| Enable, change metadata, version actions, delete a secret | `secret-manager.write` | Owner, Admin or Technical      |

```bash
export IBEE_TOKEN="ibee_prod_key_xxxxxxxxxxxx.xxxxxxxx"
WS=710995                                   # your workspace ID
API=https://api.ibee.ai/v1/secret-manager
auth=(-H "Authorization: Bearer $IBEE_TOKEN")
```

## Every operation

| Method and path                                                  | Scope | What it does                                                                                                                           |
| ---------------------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /secret-manager/workspace`                                  | read  | Status: `namespace`, `state`, `endpoint`, `max_versions`, `site_code`                                                                  |
| `POST /secret-manager/workspace/enable`                          | write | Enable Secret Manager. `202` with an operation. See [Enable Secret Manager](/docs/tools/secret-manager/enable#enable-it-with-the-api). |
| `GET /secret-manager/namespaces/{name}/availability`             | read  | Check a namespace name                                                                                                                 |
| `GET /secret-manager/operations/{operation_id}`                  | read  | Follow an enable or app credential change                                                                                              |
| `GET /secret-manager/secrets`                                    | read  | List names in a folder (`prefix`)                                                                                                      |
| `GET /secret-manager/catalog`                                    | read  | Search names (`query`), paged with `cursor`                                                                                            |
| `GET /secret-manager/secret-metadata/{secret_path}`              | read  | A secret's settings and versions                                                                                                       |
| `PUT /secret-manager/secret-metadata/{secret_path}`              | write | Change a secret's settings                                                                                                             |
| `DELETE /secret-manager/secret-metadata/{secret_path}`           | write | Delete the secret and all its versions permanently                                                                                     |
| `GET /secret-manager/secret-history/{secret_path}`               | read  | Version history                                                                                                                        |
| `POST /secret-manager/secret-versions/{secret_path}/delete`      | write | Delete versions (recoverable)                                                                                                          |
| `POST /secret-manager/secret-versions/{secret_path}/undelete`    | write | Undelete versions                                                                                                                      |
| `POST /secret-manager/secret-versions/{secret_path}/destroy`     | write | Destroy versions (permanent)                                                                                                           |
| `GET /secret-manager/app-credentials`                            | read  | List app credentials                                                                                                                   |
| `POST /secret-manager/app-credentials`                           | write | Create an app credential. `202` with an operation.                                                                                     |
| `GET /secret-manager/app-credentials/{credential_id}`            | read  | One app credential                                                                                                                     |
| `POST /secret-manager/app-credentials/{credential_id}/secret-id` | write | Issue a new Secret ID (the old one stops working)                                                                                      |
| `DELETE /secret-manager/app-credentials/{credential_id}`         | write | Revoke an app credential. `202` with an operation.                                                                                     |

`{secret_path}` is the path with plain slashes, for example `/secret-manager/secret-metadata/payments/db`; an encoded `%2F` is answered with a `307` redirect to the plain-slash path. Calls that touch the store (listing, search, metadata, history, version actions, delete) are billed as one operation each; status, operations, the name check and app credential calls aren't. The full request and response schemas are in the [API reference](/docs/api-reference/secret-manager/get-secret-manager-workspace).

## Secrets

### List a folder

```bash
curl -s "${auth[@]}" "$API/secrets?workspace_id=$WS&prefix=payments/"
```

The answer has `keys` (the names in the folder; folders end in `/`) and `items`, one per name, with `current_version`, `retained_versions`, `max_versions` and `updated_time`. Leave out `prefix` for the top level; add `managed=true` to list `ibee-managed/`. A folder lists in one answer; there are no pages.

### Search

```bash
curl -s "${auth[@]}" "$API/catalog?workspace_id=$WS&query=stripe&limit=50"
```

Search matches part of a path or display name, ignoring case. The answer has `items` and `next_cursor`; pass `cursor=<next_cursor>` for the next page (`limit` 1–100, default 50). Secrets written outside the portal can take a few minutes to appear; `indexed: false` means the workspace hasn't been fully indexed yet.

### Read a secret's settings and history

```bash
curl -s "${auth[@]}" "$API/secret-metadata/payments/db?workspace_id=$WS"
curl -s "${auth[@]}" "$API/secret-history/payments/db?workspace_id=$WS"
```

The history answer has `current_version` and `versions`, keyed by version number, each with `created_time`, `deletion_time` (empty unless deleted) and `destroyed`. Add `managed=true` for a secret in `ibee-managed/`.

### Change a secret's settings

```bash
curl -s -X PUT "${auth[@]}" "$API/secret-metadata/payments/db?workspace_id=$WS" \
  -H "Content-Type: application/json" \
  -d '{"max_versions": 5, "cas_required": true, "delete_version_after": "0", "custom_metadata": {"owner": "payments-team"}}'
```

| Field                  | Values                                                                                                                          |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `max_versions`         | 0–1,000 versions to keep; `0` uses the workspace default                                                                        |
| `cas_required`         | `true` makes every write send check-and-set                                                                                     |
| `delete_version_after` | `"0"` (never) or a duration such as `"720h"` (30 days). Deleted versions are still billed.                                      |
| `custom_metadata`      | Up to 32 string pairs (keys up to 128 characters, values up to 512). Replaces the existing pairs. Never put secret values here. |

Calling `PUT` on a path that doesn't exist creates it with settings but no value; the portal shows **Value not saved** until a value is written over the Vault API.

### Delete, undelete and destroy versions

```bash
curl -s -X POST "${auth[@]}" "$API/secret-versions/payments/db/delete?workspace_id=$WS" \
  -H "Content-Type: application/json" -d '{"versions": [3]}'
```

Send 1–100 version numbers. Use `/undelete` to bring deleted versions back and `/destroy` to erase them permanently.

### Delete a secret

```bash
curl -s -X DELETE "${auth[@]}" "$API/secret-metadata/payments/db?workspace_id=$WS"
```

This removes the secret, every version and its settings. It can't be undone.

## App credentials

Create a read-only credential for the `payments` folder. Send an `Idempotency-Key` (8–128 characters: letters, digits, `.`, `_`, `:` and `-`):

```bash
curl -s -X POST "${auth[@]}" "$API/app-credentials?workspace_id=$WS" \
  -H "Idempotency-Key: payments-api-credential-001" \
  -H "Content-Type: application/json" \
  -d '{"name": "payments-api", "access": "read", "folder": "payments"}'
```

The answer is `202` with `credential` (its `id`, `name`, `access`, `folder`, `state`) and an `operation`. Poll `GET /secret-manager/operations/{id}` until `status` is `completed`, then issue the Secret ID:

```bash
curl -s -X POST "${auth[@]}" "$API/app-credentials/$CREDENTIAL_ID/secret-id?workspace_id=$WS"
```

```json
{
  "role_id": "8f1c…",
  "secret_id": "3b9e…",
  "namespace": "acme-payments",
  "mount": "approle",
  "endpoint": "https://secrets.ibee.ai"
}
```

The `secret_id` is returned once and can't be read again; store it straight away. Calling this again issues a new Secret ID and the previous one stops working at once. If the credential is still being set up, the call answers `409` `app_credential_pending`; wait and retry.

* `access` is `read` (default) or `read_write`. `folder` is optional; leave it out for every secret.
* `GET /secret-manager/app-credentials` returns `items` (never Secret IDs) and the workspace's `limit` (50).
* `DELETE /secret-manager/app-credentials/{id}` revokes the credential: `202` with an operation. Apps lose access within seconds.

## Errors

Errors come back as JSON:

```json
{ "error": "namespace_taken", "message": "This namespace name is already taken", "request_id": "…" }
```

| Status        | `error`                                                                                                    | Meaning                                                                           |
| ------------- | ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| `402`         | `billing_denied`                                                                                           | Billing refused the enable; see `billing_reason`                                  |
| `403`         | `insufficient_scope`                                                                                       | The token lacks the `required_scope`                                              |
| `403`         | (other codes)                                                                                              | The token owner's workspace role doesn't allow the call                           |
| `403`         | `access_denied`                                                                                            | The secret store refused the request for this role                                |
| `403`         | `verification_required`                                                                                    | The organization's identity verification isn't complete                           |
| `403`         | `workspace_restricted` / `workspace_suspended`                                                             | The workspace is read-only or suspended                                           |
| `404`         | `workspace_not_enabled`                                                                                    | Secret Manager isn't enabled in this workspace                                    |
| `404`         | `secret_not_found`, `not_found`, `app_credential_not_found`, `operation_not_found`                         | Nothing at that path or ID                                                        |
| `409`         | `workspace_pending`, `lifecycle_pending`                                                                   | Setup or a workspace change is in progress; retry shortly                         |
| `409`         | `app_credential_limit`, `app_credential_name_taken`, `app_credential_pending`, `app_credential_revoked`    | See [App credentials](/docs/tools/secret-manager/app-credentials#troubleshooting) |
| `409`         | `idempotency_conflict`                                                                                     | The `Idempotency-Key` was used for a different request                            |
| `413`         | `secret_too_large`                                                                                         | Over the size limit                                                               |
| `422`         | `invalid_request`, `invalid_path`, `invalid_metadata`, `invalid_version`, `invalid_name`, `invalid_cursor` | The request breaks a rule; see [Limits](/docs/tools/secret-manager/limits)        |
| `503` / `504` | `secret_manager_unavailable`, `secret_manager_timeout`, `billing_unavailable`                              | Try again shortly                                                                 |

Every error is listed in [Troubleshooting](/docs/tools/secret-manager/troubleshooting).

## Related pages

* [Secret Manager API reference](/docs/api-reference/secret-manager/get-secret-manager-workspace)
* [API tokens](/docs/tools/api-tokens)
* [Read secrets from your app](/docs/tools/secret-manager/connect-apps)