Help Center

Run an automation from your own code (HTTP functions)

Any active automation with a Manual or Webhook trigger can be called from your own code as an HTTP endpoint. You send a POST request with an API key, the request body becomes the automation's input, and the response is the run's result.

This turns an automation into a small backend function: your website or another system asks your app to do something, and the automation does it.

What you need

Find your callable automations

Open Tools, choose Data & API and open the API Keys tab. The HTTP functions section lists every automation that can be called, with a button to copy its URL.

You can also list them with the API:

```bash

curl "https://unstack.us/api/v1/functions" \

-H "X-API-Key: usk_your_api_key"

```

Run one

Call it by its id or by its exact name. If the name has spaces, URL-encode it.

```bash

curl -X POST "https://unstack.us/api/v1/functions/AUTOMATION_ID" \

-H "X-API-Key: usk_your_api_key" \

-H "Content-Type: application/json" \

-d '{"customer_email": "dana@example.com", "plan": "weekly"}'

```

The JSON body is passed to the automation, along with a source field set to http. An empty body is allowed.

The response

The request waits while the automation runs, then returns:

```json

{

"automation_id": "5e0c7a1a-...",

"name": "Send welcome pack",

"status": "completed",

"result": { }

}

```

status is completed when the run went through and failed when it did not. A failed run also returns HTTP status 502, with the details in result.

Errors

Tips

The other way to trigger from outside

If the sender cannot set an API key header, for example a form tool that only lets you paste a URL, use a Webhook trigger and its secret URL instead. See Trigger an automation from another service.