> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lekalao.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Automations

> Put someone into a journey from your own application.

Two ways to start an automation from your code.

## Add a tag

The most flexible one. Create an automation triggered by **A tag is added**, then add the tag:

```bash theme={null}
curl -X POST https://lekalao.example.com/api/v1/subscribers/$SUBSCRIBER/tags \
  -H "Authorization: Bearer $LEKALAO_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{ "add": ["abandoned-basket"] }'
```

The tag stays visible on the record, serves segments, and taking it off again (`"remove"`) can be the goal that ends the journey.

## Put someone in directly

When the event makes no sense as a tag, call the automation itself. Find its `id` first:

```bash theme={null}
curl "https://lekalao.example.com/api/v1/automations?status=active" \
  -H "Authorization: Bearer $LEKALAO_TOKEN" -H "Accept: application/json"
```

```json theme={null}
{
  "data": [
    { "id": "7a1c…", "name": "Abandoned basket reminder", "status": "active", "trigger": "manual", "list": "9d5c…", "activated_at": "2026-09-10T08:00:00+00:00", "created_at": "2026-09-09T16:12:40+00:00" }
  ],
  "links": { … },
  "meta": { … }
}
```

Then put the person in:

```bash theme={null}
curl -X POST https://lekalao.example.com/api/v1/automations/$AUTOMATION/trigger \
  -H "Authorization: Bearer $LEKALAO_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{ "email": "ada@example.com", "first_name": "Ada" }'
```

This call works **whatever the trigger** of the automation is.

1. If the address is not on the automation's list, it is subscribed there, **without a confirmation e-mail**.
2. The person enters the journey, and the first actions run at once.

| Code  | Answer                                                                                       |
| ----- | -------------------------------------------------------------------------------------------- |
| `201` | `{"message": "The automation has started.", "started": true}`                                |
| `409` | The automation is not running, or the person is already on the journey (`"started": false`). |
| `422` | Invalid or blocked address.                                                                  |

<Warning>
  Since the person is subscribed without confirmation, call this route only
  for people who have agreed to hear from you.
</Warning>

## And without a token?

The **A webhook is called** trigger gives the automation a secret address, usable from a no-code tool (Zapier, Make, n8n). See [Triggers](/automations/triggers#a-webhook-is-called). From your own server, prefer the API: a token is revoked, a secret address has to be changed.
