Authentication
You must authenticate your requests using a “Public Access Token” when using the SDK in your frontend application. To create a Public Access Token, you can use theauth.createPublicToken function in your backend code:
auth.configure function or the auth.withAuth function:
Scopes
By default a Public Access Token has limited permissions. You can specify the scopes you need when creating a Public Access Token:Expiration
By default, Public Access Token’s expire after 15 minutes. You can specify a different expiration time when creating a Public Access Token:- If
expirationTimeis a string, it will be treated as a time span - If
expirationTimeis a number, it will be treated as a Unix timestamp - If
expirationTimeis aDate, it will be treated as a date
Auto-generated tokens
When triggering a task from your backend, thehandle received from the trigger function now includes a publicAccessToken field. This token can be used to authenticate requests in your frontend application:
trigger function expire after 15 minutes and have a read scope for that specific run, and any tags associated with it. You can customize the expiration of the auto-generated tokens by passing a publicTokenOptions object to the trigger function:
batchTrigger function:
Available SDK functions
Currently the following functions are available in the frontend SDK:runs.retrieve
Theruns.retrieve function allows you to retrieve a run by its ID.
runs.retrieve function in the runs.retrieve doc.
runs.subscribeToRun
Theruns.subscribeToRun function allows you to subscribe to a run by its ID, and receive updates in real-time when the run changes.
runs.subscribeToRunsWithTag
Theruns.subscribeToRunsWithTag function allows you to subscribe to runs with a specific tag, and receive updates in real-time when the runs change.

