@runloop/api-client - v1.10.3
    Preparing search index...

    Object-oriented interface for working with Secrets.

    The Secret class provides a high-level, object-oriented API for managing secrets. Secrets are encrypted key-value pairs that can be securely stored and used in Devboxes as environment variables. Secrets are identified by their globally unique name.

    import { RunloopSDK } from '@runloop/api-client-ts';

    const runloop = new RunloopSDK();

    // Create a secret
    const secret = await runloop.secret.create({
    name: 'MY_API_KEY',
    value: 'secret-value',
    });

    // Use the secret in a devbox
    const devbox = await runloop.devbox.create({
    name: 'my-devbox',
    secrets: { 'API_KEY': secret }, // Can use Secret object directly
    });

    // Get secret info
    const info = await secret.getInfo();
    console.log(`Secret: ${info.name}, ID: ${info.id}`);
    Index

    Accessors

    Methods

    Accessors

    • get id(): string | undefined

      Get the secret ID.

      Returns string | undefined

      The secret ID, or undefined if not yet fetched from API

    • get name(): string

      Get the secret name.

      Returns string

      The secret name (globally unique identifier)

    Methods

    • Get the complete secret data from the API. This retrieves the full SecretView including id, name, create_time_ms, and update_time_ms.

      Note: The secret value is never returned for security reasons.

      Parameters

      • Optionaloptions: RequestOptions<unknown>

        Request options

      Returns Promise<SecretView>

      The secret data (value is not included)

      const info = await secret.getInfo();
      console.log(`Secret: ${info.name}, ID: ${info.id}, Created: ${info.create_time_ms}`);
    • Update this secret's value.

      Parameters

      • params: SecretUpdateParams

        Parameters for updating the secret

      • Optionaloptions: RequestOptions<unknown>

        Request options

      Returns Promise<RunloopSDK.Secret>

      The updated Secret instance

      const updated = await secret.update({
      value: 'new-secret-value',
      });
      console.log(`Updated at: ${(await updated.getInfo()).update_time_ms}`);