1. Create a key for your app
Open API Keys in your workspace and create a key with a name you’ll recognize, such as My app backend. Copy it when it appears.
Think of this key as access to your workspace: anyone who has it can make the requests it permits. Store it in your backend’s environment or secret settings. In the example below, replace API_KEY and list the actions. A successful response tells you the key is working.
curl --request GET "https://api.uselongrun.app/v1/actions" \
--header "Authorization: Bearer ${API_KEY}"2. Know what the key is for
Your app uses the key to send processing requests and retrieve results from your workspace. You’ll still use the LongRun app to manage account settings and connections.
For example, first create a workflow in the builder and publish it. Then your backend can use its API key to run that workflow with new inputs.
3. Keep the key behind your app
If you’re building a website, send the user’s request to your backend and let that backend call LongRun. Don’t include the key in JavaScript delivered to the browser.
If a key is accidentally shared, revoke it in API Keys and replace it in your backend. The old key should no longer be used.