access_scope: environment may hold separate Development, Staging and Production values under the same record identity. Plaintext is encrypted and decrypted in the SDK, CLI, Web app, or local MCP process.
Choose General or By Environment when creating the record. This access_scope cannot change after saving, but authorized users can edit its values and metadata. An Environment record may start incomplete; requesting a missing value returns an error rather than another Environment’s value. General is an access scope, not a fourth Environment. A record with secret_format: env still stores environment-variable content; that format and its target_env field are separate from access_scope.
In the Web app, every record shows its access scope separately from its health state. General or Per environment describes how values are scoped. Healthy, Expiring, Critical, or Expired comes from the record’s due date. Neither indicator replaces or implies the other.
Human access still follows the existing project/record roles and shares: a person who may read the secret can see its Environment values. A PAT or Service Account token adds a narrower selection of general, development, staging, and production scopes. Select at least one when creating the credential; an authorized owner/admin can edit that selection later. Existing credentials without a saved selection are General-only until edited. These token scopes do not grant project membership or bypass RBAC.
For example, one PAT may allow General and Staging. The same PAT reads a General record without environment and a By Environment record with environment: 'staging'; it cannot read that record’s Production value. A Service Account credential may allow Production instead, but it still needs its assigned role, project access and a record or project key wrapper. The AI Agents wizard asks for scopes when it creates a PAT and shows the saved scopes when you select an existing PAT; it does not create a Service Account.
Choose the right surface
- Use the SDK inside an application or script.
- Use the CLI to inject records into a child process without writing a
.envfile. - Use MCP when an agent needs an approved action.
- Use the raw API for metadata and pre-encrypted payloads. Prefer the SDK for values because it performs the required cryptography.
Read one record
SDK
getSecret returns the decrypted value and parsed fields. The decryption happens in your process. Pass secret.fields only to the trusted code that needs it; do not log the value.
Use readRecord when you want selected sections instead of the complete record:
scope accepts fields, meta, owner, access, or full. Requesting fields decrypts the complete field map; it does not select individual field names. Omit environment for General, or pass development, staging, or production to read exactly that value; an absent value never falls back to another scope.
If your application uses an AC_ENVIRONMENT variable, read it in your application and pass it as the SDK’s environment argument. The SDK does not guess from NODE_ENV, the PAT, or the deployment. See SDK examples for a validated TypeScript example. CLI uses --env; MCP uses the environment tool input.
CLI
Print only the secret value:MCP
The MCP server reads the vault passphrase fromAIRCTRL_MCP_VAULT_PASSWORD, never from the prompt.
MCP tool used:
read_recordInject a project into a process
The CLI converts record names to uppercase environment variable names and injects them only into the child process.Database URL becomes DATABASE_URL. control variables are removed before the child starts.
SDK equivalent:
--env staging to airctrl run or environment: 'staging' to getAll. Neither call mixes General and Staging values:
MCP is different
MCP does not inject values into a child process. It returns tool results to the agent. Prefer the CLI when the goal is only to start an application without a.env file. A bulk MCP read exposes decrypted values to the agent, so use it only in an approved context.
When the agent is explicitly allowed to use every accessible value in one project, ask:
MCP tool used:
get_allCreate a record
UsecreateSecret with the fields required by the selected secret format:
plain format; the SDK example above shows the typed database fields. The CLI returns the new record ID:
--target-env is metadata inside the env secret format; it does not select the record’s access scope. Use --env production separately when you want to create or read the Production value of a By Environment record.
For an ENV-format record whose value itself is scoped to Production, pass both flags. This is a different record from the General example above:
One record with separate Environment values
Create a partially filled record and add another value later through the same SDK writer. Both values belong to one record and share its existing project/record access rules:create, not a second record name:
MCP
Supply secret values only when the model is authorized to receive them.MCP tool used:
create_recordGenerate one Staging value with MCP
For an Environment record without putting a secret value in the prompt, ask the local MCP server to generate one variant:MCP tool used:
create_record with generate: true, environment: 'staging', and the SSH host/username generator options.Generate a new secret
can generate supported material locally and store it in one operation. Supported generators include passwords, API keys, TOTP seeds, SSH keys, certificates, webhook secrets, and OAuth client secrets.MCP tool used:
create_record with generate: trueUpdate, rotate and roll back
setSecretsaves a new encrypted value version.rotateRecordcreates a new data key, reciphers current values and stores the prior key encrypted by the client for historical rollback.rollbackRecordToVersionopens an earlier version locally and appends it encrypted under the current data key, without deleting history.updateRecordMetadatachanges name, tags, due date, or rotation interval without changing the value.
set, record rotate, record rollback, and record metadata.
MCP equivalents are set_secret, rotate_record, rollback_record, and update_record_metadata.
Rollback chooses the variant from the historical version ID. It does not take an Environment flag. For example, to restore an earlier Development value while leaving Staging and Production unchanged:
Share and revoke
Sharing encrypts the record key for the recipient. It does not share your vault passphrase.The same pattern exists for Service Accounts and groups. CLI uses
record share-user, share-sa, share-group and their matching revoke-* commands.MCP tools used:
share_record_user, revoke_record_userHistory and audit
Use record versions, record audit, anomalies, activity, alerts, and access feeds to understand changes without exposing plaintext. Project-scoped audit feeds requireaudit:read.
Navigable record audit, alert, and access feeds use stable cursor pagination. Start with limit, then pass the returned pagination.next_cursor as cursor without changing scope, action, actor, or date filters. The cursor is opaque. Legacy offset remains available for existing clients but cannot be combined with cursor. GET /records/{id}/audit keeps its original array response; use GET /records/{id}/audit/events or listRecordAudit() for server-side filtering and stable pagination.
Common failures
403 not_authorized: the caller lacks record access or the required action permission.404 record_not_found: the ID is wrong or unavailable in the active account.409 record_name_exists: another record already uses that name where uniqueness is required.409 project_not_keyed: refresh project key state before retrying the operation.