Skip to main content
Version: Next

ActorEnvVarCollectionClient

Client for managing the collection of environment variables for an Actor version.

Environment variables are key-value pairs that are available to the Actor during execution. This client provides methods to list and create environment variables.

Hierarchy

  • ResourceCollectionClient
    • ActorEnvVarCollectionClient
const client = new ApifyClient({ token: 'my-token' });
const actorClient = client.actor('my-actor-id');
const versionClient = actorClient.version('0.1');

// List all environment variables
const envVarsClient = versionClient.envVars();
const { items } = await envVarsClient.list();

// Create a new environment variable
const newEnvVar = await envVarsClient.create({
name: 'MY_VAR',
value: 'my-value',
isSecret: false
});

Added in 2.1.0

Index

Properties

inheritedapifyClient

apifyClient: ApifyClient

inheritedbaseUrl

baseUrl: string

inheritedhttpClient

httpClient: HttpClient

optionalinheritedid

id?: string

optionalinheritedparams

params?: Record<string, unknown>

inheritedpublicBaseUrl

publicBaseUrl: string

Added in 2.17.0

inheritedresourcePath

resourcePath: string

optionalinheritedsafeId

safeId?: string

inheritedurl

url: string

Methods

create

  • create(actorEnvVar, options): Promise<EnvVar>

list

  • Lists all environment variables of this Actor version.

    The endpoint returns every environment variable in one response, so awaiting the return value (as you would with a Promise) gets the whole list.

    const { items } = await client.list();

    Asynchronous iteration is also supported, and yields the environment variables one by one.

    for await (const singleItem of client.list()) {...}

    Parameters

    Returns Promise<ActorEnvVarListResult> & AsyncIterable<EnvVar, any, any>

    The environment variables, awaitable as a whole list or iterable one by one.