configure() API binds the SDK to one set of credentials per process. When a single process needs to talk to more than one Trigger.dev project, environment, or preview branch, use new TriggerClient({...}) for each target instead. Each instance owns its own auth, baseURL, and preview branch, and concurrent calls across instances stay isolated.
Configuration
TriggerClient accepts the same fields as configure():
Fields not passed to the constructor fall back to the matching env var (and then to a sensible default for
baseURL). Explicit constructor values always win, so you can mix env-var-backed clients and fully explicit clients in the same process.
accessToken resolves from either the constructor or env vars, the first API call throws an ApiClientMissingError with a clear message.
What’s on a TriggerClient instance
Each instance exposes the management surface as namespaced properties:tasks, runs, batch, schedules, envvars, queues, deployments, prompts, and auth.
tasks.triggerAndWait, tasks.batchTriggerAndWait, tasks.triggerAndSubscribe, batch.triggerAndWait, batch.triggerByTaskAndWait, and the task-definition helpers (schedules.task, prompts.define).
Isolation contract
When you make a call through aTriggerClient instance, the SDK does not look at the process-wide global config, env vars (other than the constructor-time fallback), or the ambient task context. Two instances pointing at different projects can run in the same process — including in parallel under Promise.all — without interfering with each other.
That isolation also means a call from inside a task does not automatically inherit the surrounding task’s parentRunId, lockToVersion, or test flag. If you specifically want a call to inherit those (rare — usually you want a clean external trigger), opt in with inheritContext: true:
When to use what
See Authentication for the underlying token types and the
auth.withAuth helper.
