To launch workflows programmatically, for example, in a Github Action, you can use the API endpoint at https://nucleus.latch.bio/sdk/wf. The endpoint accepts a POST request with a JSON payload containing both the ID of the workflow as well as the parameter values to use when launching the workflow.

Prerequisites

The endpoint is authenticated using your SDK token (located in ~/.latch/token). See instructions on how to set up your SDK token below:

  1. Make sure you’re in the workspace in which the workflow will be launched console.latch.bio

  1. Then go down to account settings on the bottom of the avatar menu.

  1. Then go to Developer > Access Tokens > API and copy the API key listed.
  1. Then on your local computer’s terminal open the file called token in the ~/.latch directory either through vim ~/.latch/token or nano ~/.latch/token.

If the file does not exist, you can create it first by typing touch ~/.latch/token.


  1. And then, paste the API key and save the file.

Launching a Workflow Using the curl Endpoint

A curl to the workflow’s endpoint would look like below:

curl -X POST \
    https://nucleus.latch.bio/sdk/wf  \
    -H 'Content-Type: application/json'  \
    -H 'Authorization: Latch-SDK-Token <TOKEN>' \
    -d '{"workflow_id": <WORKFLOW_ID>,"params": <PARAMS>}'

Note: It is not recommended to construct this command manually. Instead, in the workflow parameters page in Latch Console, fill out the parameter values you would like to launch with, then copy the autogenerated command in the bottom of the right sidebar.