Authentication and your secret keys

When you trigger a task from your backend code, you need to set the TRIGGER_SECRET_KEY environment variable.

Each environment has its own secret key. You can find the value on the API keys page in the dashboard:

How to find your secret key

Automatically Configuring the SDK

To automatically configure the SDK with your secret key, you can set the TRIGGER_SECRET_KEY environment variable. The SDK will automatically use this value when calling API methods (like trigger).

export TRIGGER_SECRET_KEY=tr_dev_…

You can do the same if you are self-hosting and need to change the default URL by using TRIGGER_API_URL.


The default URL is

Manually Configuring the SDK

If you prefer to manually configure the SDK, you can call the configure method:

import { configure } from "";
import { myTask } from "./trigger/myTasks";

  secretKey: "tr_dev_1234", // WARNING: Never actually hardcode your secret key like this
  baseURL: "", // Optional

async function triggerTask() {
  await myTask.trigger({ userId: "1234" }); // This will use the secret key and base URL you configured