Skip to main content
The snippets use an initialized airctrl client and IDs loaded from your application configuration. Methods return the API’s typed snake_case data unless noted otherwise.

Prepare the examples

The catalog uses these shared values. Validate required environment variables when the process starts; do not let undefined reach a credential or resource field.
Other names such as credentialId, tokenId, userId and groupId are IDs returned by earlier reads or creates. Values such as sourcePassword and replacementPassword must come from a trusted local source. Never replace them with a literal production secret in source code. Each section shows the smallest useful call. SDK methods contains the full signature, identity boundary, input rules, result rules and common error handling.

Accounts and projects

List accessible accounts

Returns accounts available to the human PAT.
SDK method: listAccounts()

List projects

SDK method: listProjects()

View a project

SDK method: getProject()

Create a project

The result contains project_id.
SDK method: createProject()

Update a project

This replaces the editable project values.
SDK method: updateProject()

Archive or restore a project

The first call archives; the second restores.
SDK method: setProjectArchiveState()

Record reading and creation

List accessible record metadata

Returns safe metadata across accessible scope.
SDK method: listRecords()

List records in one project

SDK method: listProjectRecords()

Read a complete record

secret.fields contains locally decrypted fields. Do not log it.
SDK method: getSecret()

Read selected record sections

Returns only the requested sections. fields contains the complete decrypted field map; scope values are section names, not individual field names. Omit environment for General, or pass development, staging, or production to select exactly that value. A missing value never falls back to another scope.
For an application that selects its Environment from configuration, use the documented AC_ENVIRONMENT convention. The application reads this variable and passes it to the SDK; the SDK does not infer an Environment from its own process or from the PAT:
SDK method: readRecord()

Load all project records

Use this only when the process needs every accessible project record.
To load only values from one Environment, pass it explicitly. This does not include General records or other Environment values:
SDK method: getAll()

Create an encrypted record

Returns { recordId }.
For one record with separate values, create an Environment record and add a missing variant later through the same writer. See Records and secrets for the complete SDK, CLI and MCP examples.
SDK method: createSecret()

Create a generated record

Generation and encryption happen locally.
SDK method: createGeneratedRecord()

Create or replace record fields

Returns updated: true for an existing record. Human mode can also upsert by projectId, name and secretFormat. A by-ID update replaces the complete field map, so include unchanged fields you need to retain. changedFields labels the audit event; it is not a partial-update instruction.
SDK method: setSecret()

Record lifecycle and sharing

Update record details

SDK method: updateRecordMetadata()

Archive or restore a record

Pass false to restore.
SDK method: setRecordArchiveState()

Transfer record ownership

Confirm both IDs before transferring.
SDK method: transferRecordOwnership()

View record version history

SDK method: getRecordVersions()

Review one record’s audit history

SDK method: getRecordAudit()

Restore a previous record version

The SDK opens the selected version locally, encrypts it under the current record key, and appends a new current version. Older versions stay in history.
SDK method: rollbackRecordToVersion()

Rotate a record

The SDK rotates the record data key and ciphertext locally.
SDK method: rotateRecord()

Share a record with a user

SDK method: shareRecordWithUser()

Share a record with a Service Account

SDK method: shareRecordWithServiceAccount()

Share a record with a group

SDK method: shareRecordWithGroup()

Remove a user’s record access

SDK method: revokeRecordFromUser()

Remove a Service Account’s record access

SDK method: revokeRecordFromServiceAccount()

Remove a group’s record access

Each revoke removes only the selected grant.
SDK method: revokeRecordFromGroup()

Groups

Use a human PAT, account context and the required Team+ entitlement and RBAC permissions. These examples reuse the existing SDK and local vault; they do not create another authorization or crypto flow. See the access model.

List context groups

SDK method: listGroups()

Read available groups and roles

Returns available groups, delegable roles and permissions; use returned role IDs for grants.
SDK method: getGroupCatalog()

Read a record’s group grants

SDK method: getRecordGroupCatalog()

Create a group

Creation does not grant a project role.
SDK method: createGroup()

Rename a group

This replaces both fields; omit description only to clear it.
SDK method: updateGroup()

Delete a group

Removes this group’s paths only. Review remaining sources and pending re-keying.
SDK method: deleteGroup()

List group members and candidates

SDK method: listGroupMembers()

Add a group member

The member must be onboarded. Existing group grants apply; encrypted material may remain pending.
SDK method: addGroupMember()

Remove a group member

Other group, project or direct record paths remain effective.
SDK method: removeGroupMember()

Grant a project role to a group

Choose roleId from getGroupCatalog; the API checks delegation.
SDK method: grantProjectGroup()

Revoke one project role from a group

Removes only this assignment, not other roles or direct record shares.
SDK method: revokeProjectGroup()

Complete pending encrypted access

Run as an authorized key holder. Project IDs limit projects, not pending direct group-record repairs. attemptedProjectIds records attempts; verify recipient access separately.
SDK method: reconcileGroupAccess()

Record audit feeds

Page and filter one record’s audit history

SDK method: listRecordAudit()

Find unusual record activity

SDK method: listRecordAnomalies()

Review daily record activity

The day uses UTC YYYY-MM-DD.
SDK method: listRecordActivity()

Review record alerts

SDK method: listRecordAlerts()

Review secret access events

SDK method: listRecordAccess()

Providers and gateways

List supported AI providers

SDK method: listProviders()

List provider credentials

The result contains metadata, never provider secret values.
SDK method: listProviderCredentials()

Add a provider credential

SDK method: createProviderCredential()

List models for a credential

Each result includes the provider capabilities, the subset supports, and airctrlSupport as supported, partial, or unsupported. Unsupported entries remain visible for discovery but cannot be bound to a gateway.
SDK method: listProviderCredentialModels()

Replace a provider key

SDK method: rotateProviderCredential()

Rename a provider credential

SDK method: updateProviderCredentialLabel()

Revoke a provider credential

Check dependent gateways before revocation.
SDK method: revokeProviderCredential()

List gateways

SDK method: listGateways()

View a gateway

SDK method: getGateway()

Create a gateway

SDK method: createGateway()

Update a gateway

SDK method: updateGateway()

Delete a gateway

Deletion disables the gateway and revokes its tokens.
SDK method: deleteGateway()

Attach a provider credential

SDK method: attachGatewayCredential()

Detach one model

This keeps the provider credential and its other model bindings attached.
SDK method: detachGatewayCredentialModel()

Detach a provider credential

Detach does not revoke the provider credential.
SDK method: detachGatewayCredential()

Change gateway limits and behavior

SDK method: updateGatewaySettings()

Gateway tokens

List gateway tokens

SDK method: listGatewayTokens()

Create a gateway token

The plaintext appears only in this result.
SDK method: createGatewayToken()

Rename a gateway token

SDK method: renameGatewayToken()

Revoke a gateway token

SDK method: revokeGatewayToken()

Delete a gateway token

SDK method: deleteGatewayToken()

Usage and observability

Review gateway requests

SDK method: listGatewayLogs()

Inspect one gateway request

This may contain stored request and response bodies.
SDK method: getGatewayLogDetail()

Review provider-key access

SDK method: listGatewayKeyAccess()

Review project usage logs

SDK method: listUsageLogs()

Inspect one project usage log

SDK method: getUsageLogDetail()

Review project spend

SDK method: getUsageSpend()

Review project usage metrics

SDK method: getUsageMetrics()

View OpenTelemetry settings

Stored header values are never returned.
SDK method: getGatewayOtelExport()

Change OpenTelemetry settings

SDK method: updateGatewayOtelExport()

Service Account metadata

List Service Accounts

SDK method: listServiceAccounts()

View a Service Account

These methods expose safe metadata to a human PAT. Service Account lifecycle remains dashboard-only.
SDK method: getServiceAccount()

Error handling

Every API-backed method throws AirctrlError. Read status, code, message and details. Do not retry validation, permission or missing-resource failures unchanged. Reuse the same idempotency key only for the same intended write.

Connect a confidential OAuth partner

The example assumes redirectUri, state, provider/external-key values, idempotency keys, and the partner-owned encryptedTokenStore, encryptedRuntimeTokenStore, and refreshLock are initialized in the confidential backend.
Use only scopes shown in the OAuth app registration and current server metadata. The provider key is sent only from the confidential backend over TLS. validates it before any write, encrypts it at rest and never returns it. Retry an uncertain provision with the same idempotency key and identical request; changing the request under that key returns 409. Serialize refreshes per installation. Omit OTel headers on PATCH to preserve them; send null or {} to clear them. An older lifecycle idempotency key returns idempotency_operation_superseded after a newer runtime-token operation wins. OAuthPartnerClient throws AirctrlOAuthError with status, error, and optional description:
SDK method: authorizationUrl()SDK method: exchangeCode()SDK method: refresh()SDK method: revoke()SDK method: listProvisioningProviders()SDK method: discoverProvisioningProviderModels()SDK method: preflightProtection()SDK method: provisionProtection()SDK method: listProtections()SDK method: getProtection()SDK method: updateProtection()SDK method: listProtectionLogs()SDK method: getProtectionSpend()SDK method: rotateProtectionProviderKey()SDK method: rotateProtectionRuntimeToken()SDK method: revokeProtection()SDK method: reactivateProtection()