Secret
Module for managing E2B secrets and workload identity helpers. Secret values are write-only: they are accepted by Secret.create and Secret.update but never returned by any read surface.Constructors
Returns
Secret
Methods
create()
Parameters
Returns
Promise<SecretInfo>
the secret’s ID, name, current version (1 for a new secret),
metadata, and creation and update times.
destroy()
Parameters
Returns
Promise<boolean>
true if the secret was destroyed, false if it was not found.
exists()
Parameters
Returns
Promise<boolean>
true if the secret exists, false otherwise.
fill()
Parameters
Returns
string
placeholder string resolving to the secret’s value.
Example
getInfo()
Parameters
Returns
Promise<SecretInfo>
the secret’s ID, name, current version, metadata, and creation
and update times.
iamToken()
iam.tokens when creating
a sandbox.
Parameters
Returns
SandboxIamToken
a token definition passable to iam.tokens.
Example
list()
Parameters
Returns
SecretPaginator
paginator over the project’s secrets. Drain it page by page:
while (paginator.hasNext) { const secrets = await paginator.nextItems() }.
Example
update()
Parameters
Returns
Promise<SecretInfo>
the secret’s ID, name, new current version, metadata, and
creation and update times.
SecretPaginator
Paginator for listing secrets.Example
Constructors
Parameters
Returns
SecretPaginator
Accessors
hasNext
Get Signature
Returns
boolean
nextToken
Get Signature
Returns
undefined | string
Methods
nextItems()
Parameters
Returns
Promise<SecretInfo[]>
List of items
Throws
Error if there are no more items to fetch. Call this method only ifhasNext is true.
Interfaces
SecretCreateOpts
Properties
apiHeaders?
apiKey?
Default
domain?
Default
E2B_DOMAIN // environment variable ore2b.app
headers?
Deprecated
UseapiHeaders instead.
httpVersion?
'2' multiplexes streams over shared connections;
'1.1' pins them to HTTP/1.1 with one connection per concurrent
request — for example when an intermediary on the path retires or
mishandles long-lived HTTP/2 connections. Only applies in Node.
Default
E2B_HTTP_VERSION // environment variable or'2'
logger?
Logger interface—for example, console.
metadata?
proxy?
Example
requestTimeoutMs?
Default
retries?
Should-Retry: true,
or 429/502/503/504 responses without that header. Should-Retry: false is
never retried. Waits for a valid Retry-After delta-seconds value, otherwise
exponential backoff with jitter from 100 ms to 10 s. Also retries failures
to establish the connection; network errors after the request is sent are
not retried.
A retry is skipped when its wait would exhaust the request timeout.
Retry waits use a 60-second total limit when request timeouts are disabled.
Set to 0 to disable retries. Defaults to 3 retries.
Default
Throws
InvalidArgumentError if the value is negative or not an integersignal?
AbortSignal that can be used to cancel the in-flight request.
When the signal is aborted, the underlying fetch is aborted and the
returned promise rejects with an AbortError.
validateApiKey?
Deprecated
The API key format is no longer validated on the client side; this option has no effect.SecretInfo
Metadata of a secret. Secret values are write-only and never returned.Properties
createdAt
metadata
name
secretId
updatedAt
version
SecretListOpts
Properties
apiHeaders?
apiKey?
Default
domain?
Default
E2B_DOMAIN // environment variable ore2b.app
headers?
Deprecated
UseapiHeaders instead.
httpVersion?
'2' multiplexes streams over shared connections;
'1.1' pins them to HTTP/1.1 with one connection per concurrent
request — for example when an intermediary on the path retires or
mishandles long-lived HTTP/2 connections. Only applies in Node.
Default
E2B_HTTP_VERSION // environment variable or'2'
limit?
Default
logger?
Logger interface—for example, console.
nextToken?
proxy?
Example
requestTimeoutMs?
Default
retries?
Should-Retry: true,
or 429/502/503/504 responses without that header. Should-Retry: false is
never retried. Waits for a valid Retry-After delta-seconds value, otherwise
exponential backoff with jitter from 100 ms to 10 s. Also retries failures
to establish the connection; network errors after the request is sent are
not retried.
A retry is skipped when its wait would exhaust the request timeout.
Retry waits use a 60-second total limit when request timeouts are disabled.
Set to 0 to disable retries. Defaults to 3 retries.
Default
Throws
InvalidArgumentError if the value is negative or not an integervalidateApiKey?
Deprecated
The API key format is no longer validated on the client side; this option has no effect.SecretUpdateOpts
Properties
apiHeaders?
apiKey?
Default
domain?
Default
E2B_DOMAIN // environment variable ore2b.app
headers?
Deprecated
UseapiHeaders instead.
httpVersion?
'2' multiplexes streams over shared connections;
'1.1' pins them to HTTP/1.1 with one connection per concurrent
request — for example when an intermediary on the path retires or
mishandles long-lived HTTP/2 connections. Only applies in Node.
Default
E2B_HTTP_VERSION // environment variable or'2'
logger?
Logger interface—for example, console.
metadata?
proxy?
Example
requestTimeoutMs?
Default
retries?
Should-Retry: true,
or 429/502/503/504 responses without that header. Should-Retry: false is
never retried. Waits for a valid Retry-After delta-seconds value, otherwise
exponential backoff with jitter from 100 ms to 10 s. Also retries failures
to establish the connection; network errors after the request is sent are
not retried.
A retry is skipped when its wait would exhaust the request timeout.
Retry waits use a 60-second total limit when request timeouts are disabled.
Set to 0 to disable retries. Defaults to 3 retries.
Default
Throws
InvalidArgumentError if the value is negative or not an integersignal?
AbortSignal that can be used to cancel the in-flight request.
When the signal is aborted, the underlying fetch is aborted and the
returned promise rejects with an AbortError.