# Automations
Automations and the connections they use. Read only.
**Common tasks**
- [List automations](#get-organizations-organization-automations)
**Only in the app:** Creating and changing automations.
**How it works in the app:** [help article](https://infranest.io/docs/automations).
**Scopes:** Read with `monitoring.read`. See [Tokens and scopes](../tokens-and-scopes.md#scopes).
[Automation connections](#automation-connections) 1 · [Automations](#automations) 3
Every endpoint below takes a token in the `Authorization: Bearer` header and answers JSON. Errors use the shared format in [Errors](../errors.md). Base address: `https://api.infranest.io/api`.
## Automation connections
### List automation connections {#get-organizations-organization-automation-connections}
`GET` `/organizations/{organization}/automation-connections`
**Scope:** `monitoring.read` · **Changes data:** no
The accounts automations can act through, such as GitHub, Jira or PagerDuty, with each one’s status, whether it is paused and whether its triggers can fire.
| Field | Type | Notes |
|---|---|---|
| `organization_id`
path · required | integer | Your organization's ID. |
**Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request**
```sh
curl "https://api.infranest.io/api/organizations/42/automation-connections" \
-H "Authorization: Bearer $INFRANEST_TOKEN" \
-H "Accept: application/json"
```
**Response** · 200
```json
[
{
"id": 1,
"provider": "pagerduty",
"kind": "oauth",
"label": "Northwind on-call",
"meta": {
"service_name": "Platform — production",
"account": "northwind",
"auth": "oauth",
"region": "us",
"authorized_by": {
"name": "Alex Rivera",
"email": "demo@example.com"
},
"webhook_subscription_id": "PD3WHS1"
},
"status": "active",
"paused": false,
"triggers_on": false,
"created_at": "2026-01-15T12:00:00+00:00"
},
{
"id": 2,
"provider": "github",
"kind": "github_app",
"label": "northwind-cloud",
"meta": {
"installation_id": "20000001",
"account": "northwind-cloud"
},
"status": "active",
"paused": false,
"triggers_on": false,
"created_at": "2026-01-15T12:00:00+00:00"
}
]
```
## Automations
### List automations {#get-organizations-organization-automations}
`GET` `/organizations/{organization}/automations`
**Scope:** `monitoring.read` · **Changes data:** no
Every automation, newest first, with its tags and run statistics: runs in the last 30 and 7 days, success rate, average duration and the last run’s status. Test runs are not counted.
| Field | Type | Notes |
|---|---|---|
| `organization_id`
path · required | integer | Your organization's ID. |
**Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request**
```sh
curl "https://api.infranest.io/api/organizations/42/automations" \
-H "Authorization: Bearer $INFRANEST_TOKEN" \
-H "Accept: application/json"
```
**Response** · 200
```json
[
{
"id": 1,
"organization_id": 1,
"name": "Release published → announce on status page",
"trigger_event": "github.release",
"conditions": [
{
"op": "eq",
"field": "action",
"value": "published"
},
{
"op": "eq",
"field": "prerelease",
"value": "false"
}
],
"actions": [
{
"action": "create_status_announcement",
"config": {
"body": "{{name}}.",
"title": "Released: {{tag}}",
"status_page_id": 1
}
}
],
"enabled": true,
"cooldown_seconds": 0,
"consecutive_failures": 0,
"disabled_reason": null,
"last_triggered_at": null,
"created_by": 1,
"created_at": "2026-01-15T12:00:00.000000Z",
"updated_at": "2026-01-15T12:00:00.000000Z",
"condition_match": "all",
"run_as": "owner",
"trigger_kind": "event",
"schedule": null,
"trigger_events": null,
"deleted_at": null,
"purge_after": null,
"purge_reminder_sent_at": null,
"deleted_by_id": null,
"deleted_by_label": null,
"deletion_reason": null,
"disabled_detail": null,
"template_key": null,
"tags": [],
"runs_30d": 0,
"runs_7d": 0,
"success_rate": null,
"avg_duration_ms": null,
"last_status": null,
"last_run_at": null,
"spark": [
{
"total": 0,
"failed": 0
},
{
"total": 0,
"failed": 0
}
]
},
{
"id": 2,
"organization_id": 1,
"name": "PR merged to main → run deploy workflow",
"trigger_event": "github.pull_request",
"conditions": [
{
"op": "eq",
"field": "merged",
"value": "true"
},
{
"op": "eq",
"field": "base_branch",
"value": "main"
}
],
"actions": [
{
"action": "require_approval",
"config": {
"note": "Production deploy"
}
},
{
"action": "github_trigger_workflow",
"config": {
"ref": "main",
"repo": "northwind-cloud/app",
"workflow": "deploy.yml",
"connection_id": 2
}
}
],
"enabled": true,
"cooldown_seconds": 0,
"consecutive_failures": 0,
"disabled_reason": null,
"last_triggered_at": null,
"created_by": 1,
"created_at": "2026-01-15T12:00:00.000000Z",
"updated_at": "2026-01-15T12:00:00.000000Z",
"condition_match": "all",
"run_as": "owner",
"trigger_kind": "event",
"schedule": null,
"trigger_events": null,
"deleted_at": null,
"purge_after": null,
"purge_reminder_sent_at": null,
"deleted_by_id": null,
"deleted_by_label": null,
"deletion_reason": null,
"disabled_detail": null,
"template_key": null,
"tags": [],
"runs_30d": 5,
"runs_7d": 5,
"success_rate": 40,
"avg_duration_ms": 3000,
"last_status": "awaiting_approval",
"last_run_at": "2026-01-15T09:00:00.000000Z",
"spark": [
{
"total": 1,
"failed": 1
},
{
"total": 0,
"failed": 0
}
]
}
]
```
---
### Get an automation {#get-organizations-organization-automations-automationrule}
`GET` `/organizations/{organization}/automations/{automationRule}`
**Scope:** `monitoring.read` · **Changes data:** no
One automation with its trigger, conditions, actions and tags, plus its 20 most recent runs and their steps.
| Field | Type | Notes |
|---|---|---|
| `organization_id`
path · required | integer | Your organization's ID. |
| `automationRule_id`
path · required | integer | The automationRule's ID. |
**Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request**
```sh
curl "https://api.infranest.io/api/organizations/42/automations/1" \
-H "Authorization: Bearer $INFRANEST_TOKEN" \
-H "Accept: application/json"
```
**Response** · 200
```json
{
"id": 1,
"organization_id": 1,
"name": "Release published → announce on status page",
"trigger_event": "github.release",
"conditions": [
{
"op": "eq",
"field": "action",
"value": "published"
},
{
"op": "eq",
"field": "prerelease",
"value": "false"
}
],
"actions": [
{
"action": "create_status_announcement",
"config": {
"body": "{{name}}.",
"title": "Released: {{tag}}",
"status_page_id": 1
}
}
],
"enabled": true,
"cooldown_seconds": 0,
"consecutive_failures": 0,
"disabled_reason": null,
"last_triggered_at": null,
"created_by": 1,
"created_at": "2026-01-15T12:00:00.000000Z",
"updated_at": "2026-01-15T12:00:00.000000Z",
"condition_match": "all",
"run_as": "owner",
"trigger_kind": "event",
"schedule": null,
"trigger_events": null,
"deleted_at": null,
"purge_after": null,
"purge_reminder_sent_at": null,
"deleted_by_id": null,
"deleted_by_label": null,
"deletion_reason": null,
"disabled_detail": null,
"template_key": null,
"tags": [],
"runs": []
}
```
---
### List an automation’s runs {#get-organizations-organization-automations-automationrule-runs}
`GET` `/organizations/{organization}/automations/{automationRule}/runs`
**Scope:** `monitoring.read` · **Changes data:** no
The automation’s run history with each run’s steps, newest first, 25 per page. Filter with `status` and the dates `from` and `to`. Unless you may edit automations, what triggered each run is left out and `details_hidden` is true.
| Field | Type | Notes |
|---|---|---|
| `organization_id`
path · required | integer | Your organization's ID. |
| `automationRule_id`
path · required | integer | The automationRule's ID. |
**Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request**
```sh
curl "https://api.infranest.io/api/organizations/42/automations/1/runs" \
-H "Authorization: Bearer $INFRANEST_TOKEN" \
-H "Accept: application/json"
```
**Response** · 200
```json
{
"details_hidden": false,
"current_page": 1,
"data": [],
"first_page_url": "http://localhost/api/organizations/1/automations/1/runs?page=1",
"from": null,
"last_page": 1,
"last_page_url": "http://localhost/api/organizations/1/automations/1/runs?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"page": null,
"active": false
},
{
"url": "http://localhost/api/organizations/1/automations/1/runs?page=1",
"label": "1",
"page": 1,
"active": true
}
],
"next_page_url": null,
"path": "http://localhost/api/organizations/1/automations/1/runs",
"per_page": 25,
"prev_page_url": null,
"to": null,
"total": 0
}
```