Automations
Endpoints under /v1/automations. REST endpoints, parameters, and response schemas for the SourceLoop attribution API.
| Endpoint | Method | Path |
|---|---|---|
| List automations List alerts | GET | /v1/automations |
| Create automation Create an alert | POST | /v1/automations |
| Get automation Get an alert and its recent runs | GET | /v1/automations/{id} |
| Update automation Update an alert | PATCH | /v1/automations/{id} |
| Delete automation Delete an alert | DELETE | /v1/automations/{id} |
| Run automation Send an alert now | POST | /v1/automations/{id}/run |
Base URL https://app.sourceloop.ai/api/v1
List automations
List alerts
GET /v1/automations
Any valid API key. No extra scope needed.
The Slack and email alerts on this website (Activation > Alerts in the app), with the event catalog and the templates a new alert can start from (in `meta`). Needs automations:read.
curl -s -X GET "https://app.sourceloop.ai/api/v1/automations?website=acme.com" \
-H "Authorization: Bearer $SOURCELOOP_API_KEY" const res = await fetch(
"https://app.sourceloop.ai/api/v1/automations?website=acme.com",
{
method: "GET",
headers: {
Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
},
},
);
const data = await res.json(); import os, requests
res = requests.get(
"https://app.sourceloop.ai/api/v1/automations?website=acme.com",
headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json() Query parameters
websitestringWebsite domain, e.g. acme.com. Required only when the key covers more than one.
Responses
-
200One row per alert -
400Something was wrong with the request or the credential. -
429Too many requests for this workspace in the current minute (`rate-limit-exceeded`), the monthly allowance used (`quota-exceeded`), or too many analytics queries running at once (`too-many-concurrent`). Wait Retry-After seconds and repeat the request unchanged.
Create automation
Create an alert
POST /v1/automations
Any valid API key. No extra scope needed.
Create an alert from a spec: `trigger` (event, schedule or threshold), `filters` (events), `gather` and `condition` (numbers), `compose`, `deliver` and `pacing`. Start from a template in the list response and edit it. Slack targets need a channel from a Slack workspace connected in the app. Needs automations:write.
curl -s -X POST "https://app.sourceloop.ai/api/v1/automations" \
-H "Authorization: Bearer $SOURCELOOP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New demo booked",
"template_id": "new_lead",
"spec": {
"version": 1,
"trigger": {
"kind": "event",
"events": [
"conversion.created"
]
},
"filters": [
{
"field": "conversion",
"op": "is",
"values": [
"Demo booked"
]
}
],
"compose": {
"template": "new_lead",
"ai": false
},
"deliver": [
{
"channel": "email",
"to": [
"[email protected]"
]
}
],
"pacing": {
"mode": "each"
}
}
}' const res = await fetch(
"https://app.sourceloop.ai/api/v1/automations",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "New demo booked",
"template_id": "new_lead",
"spec": {
"version": 1,
"trigger": {
"kind": "event",
"events": [
"conversion.created"
]
},
"filters": [
{
"field": "conversion",
"op": "is",
"values": [
"Demo booked"
]
}
],
"compose": {
"template": "new_lead",
"ai": false
},
"deliver": [
{
"channel": "email",
"to": [
"[email protected]"
]
}
],
"pacing": {
"mode": "each"
}
}
}),
},
);
const data = await res.json(); import os, requests
res = requests.post(
"https://app.sourceloop.ai/api/v1/automations",
headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
json={
"name": "New demo booked",
"template_id": "new_lead",
"spec": {
"version": 1,
"trigger": {
"kind": "event",
"events": [
"conversion.created"
]
},
"filters": [
{
"field": "conversion",
"op": "is",
"values": [
"Demo booked"
]
}
],
"compose": {
"template": "new_lead",
"ai": False
},
"deliver": [
{
"channel": "email",
"to": [
"[email protected]"
]
}
],
"pacing": {
"mode": "each"
}
}
},
)
data = res.json() Responses
-
200The created alert -
400Something was wrong with the request or the credential. -
429Too many requests for this workspace in the current minute (`rate-limit-exceeded`), the monthly allowance used (`quota-exceeded`), or too many analytics queries running at once (`too-many-concurrent`). Wait Retry-After seconds and repeat the request unchanged.
Get automation
Get an alert and its recent runs
GET /v1/automations/{id}
Any valid API key. No extra scope needed.
curl -s -X GET "https://app.sourceloop.ai/api/v1/automations/{id}" \
-H "Authorization: Bearer $SOURCELOOP_API_KEY" const res = await fetch(
"https://app.sourceloop.ai/api/v1/automations/{id}",
{
method: "GET",
headers: {
Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
},
},
);
const data = await res.json(); import os, requests
res = requests.get(
"https://app.sourceloop.ai/api/v1/automations/{id}",
headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json() Path parameters
idstringpathrequired
Responses
-
200The alert with its last 50 runs and their deliveries -
400Something was wrong with the request or the credential. -
429Too many requests for this workspace in the current minute (`rate-limit-exceeded`), the monthly allowance used (`quota-exceeded`), or too many analytics queries running at once (`too-many-concurrent`). Wait Retry-After seconds and repeat the request unchanged.
Update automation
Update an alert
PATCH /v1/automations/{id}
Any valid API key. No extra scope needed.
Send `name`, `spec` (the whole spec) or `status` ("active" or "paused").
curl -s -X PATCH "https://app.sourceloop.ai/api/v1/automations/{id}" \
-H "Authorization: Bearer $SOURCELOOP_API_KEY" const res = await fetch(
"https://app.sourceloop.ai/api/v1/automations/{id}",
{
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
},
},
);
const data = await res.json(); import os, requests
res = requests.patch(
"https://app.sourceloop.ai/api/v1/automations/{id}",
headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json() Path parameters
idstringpathrequired
Responses
-
200The updated alert -
400Something was wrong with the request or the credential. -
429Too many requests for this workspace in the current minute (`rate-limit-exceeded`), the monthly allowance used (`quota-exceeded`), or too many analytics queries running at once (`too-many-concurrent`). Wait Retry-After seconds and repeat the request unchanged.
Delete automation
Delete an alert
DELETE /v1/automations/{id}
Any valid API key. No extra scope needed.
curl -s -X DELETE "https://app.sourceloop.ai/api/v1/automations/{id}" \
-H "Authorization: Bearer $SOURCELOOP_API_KEY" const res = await fetch(
"https://app.sourceloop.ai/api/v1/automations/{id}",
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
},
},
);
const data = await res.json(); import os, requests
res = requests.delete(
"https://app.sourceloop.ai/api/v1/automations/{id}",
headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json() Path parameters
idstringpathrequired
Responses
-
200Deleted -
400Something was wrong with the request or the credential. -
429Too many requests for this workspace in the current minute (`rate-limit-exceeded`), the monthly allowance used (`quota-exceeded`), or too many analytics queries running at once (`too-many-concurrent`). Wait Retry-After seconds and repeat the request unchanged.
Run automation
Send an alert now
POST /v1/automations/{id}/run
Any valid API key. No extra scope needed.
Builds the alert from the latest data and queues it to its destinations. `test: true` marks the message as a test.
curl -s -X POST "https://app.sourceloop.ai/api/v1/automations/{id}/run" \
-H "Authorization: Bearer $SOURCELOOP_API_KEY" const res = await fetch(
"https://app.sourceloop.ai/api/v1/automations/{id}/run",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
},
},
);
const data = await res.json(); import os, requests
res = requests.post(
"https://app.sourceloop.ai/api/v1/automations/{id}/run",
headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
)
data = res.json() Path parameters
idstringpathrequired
Request body (optional)
testboolean
Responses
-
200Where it was queued -
400Something was wrong with the request or the credential. -
429Too many requests for this workspace in the current minute (`rate-limit-exceeded`), the monthly allowance used (`quota-exceeded`), or too many analytics queries running at once (`too-many-concurrent`). Wait Retry-After seconds and repeat the request unchanged.