> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# Create an Automation Action

`POST https://api.pagerduty.com/automation_actions/actions`

Create a Script, Process Automation, or Runbook Automation action

## Authorization

- **api_key** (apiKey) — `Authorization` header. The API Key with format `Token token=<API_KEY>`

## Header parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Accept` | string | yes | The `Accept` header is used as a versioning header. Default: `application/vnd.pagerduty+json;version=2`. |

## Request body (`application/json`) — required

| Field | Type | Required | Description |
|---|---|---|---|
| `action` | one of: object \| object | yes |  |
| `action.name` | string | yes | (option 1) Max length: 255. |
| `action.description` | string | yes | (option 1) Max length: 1024. |
| `action.action_classification` | string \| null |  | (option 1) One of: `diagnostic`, `remediation`. |
| `action.action_type` | string | yes | (option 1) One of: `script`, `process_automation`. |
| `action.runner` | string |  | (option 1) Max length: 36. |
| `action.services` | array of object |  | (option 1) |
| `action.services[].id` | string | yes | Read-only. |
| `action.services[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.services[].type` | string | yes | One of: `service_reference`. |
| `action.services[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.services[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.teams` | array of object |  | (option 1) |
| `action.teams[].id` | string | yes | Read-only. |
| `action.teams[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.teams[].type` | string | yes | One of: `team_reference`. |
| `action.teams[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.teams[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.only_invocable_on_unresolved_incidents` | boolean |  | (option 1) If true, the action can only be invoked against an unresolved incident. Default: `false`. |
| `action.allow_invocation_manually` | boolean |  | (option 1) If true, the action can only be invoked manually by a user. Default: `true`. |
| `action.allow_invocation_from_event_orchestration` | boolean |  | (option 1) If true, the action can only be invoked automatically by an Event Orchestration. Default: `true`. |
| `action.map_to_all_services` | boolean |  | (option 1) If true, the action will be associated with every service. Default: `false`. |
| `action.action_data_reference` | object | yes | (option 1) |
| `action.action_data_reference.script` | string | yes | Body of the script to be executed on the Runner. To execute it, the Runner will write the content of the property into a temp file, make the file executable and execute it. It is assumed that the Runner has a properly configured environment to run the script as an executable file. This behaviour can be altered by providing the `invocation_command` property. The maxLength value is specified in bytes. Max length: 16777215. |
| `action.action_data_reference.invocation_command` | string |  | The command to executed a script with. With the body of the script written into a temp file, the Runner will execute the `<invocation_command> <temp_file>` command. The maxLength value is specified in bytes. Max length: 65535. |
| `action.name` | string | yes | (option 2) Max length: 255. |
| `action.description` | string | yes | (option 2) Max length: 1024. |
| `action.action_classification` | string \| null |  | (option 2) One of: `diagnostic`, `remediation`. |
| `action.action_type` | string | yes | (option 2) One of: `script`, `process_automation`. |
| `action.runner` | string |  | (option 2) Max length: 36. |
| `action.services` | array of object |  | (option 2) |
| `action.services[].id` | string | yes | Read-only. |
| `action.services[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.services[].type` | string | yes | One of: `service_reference`. |
| `action.services[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.services[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.teams` | array of object |  | (option 2) |
| `action.teams[].id` | string | yes | Read-only. |
| `action.teams[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.teams[].type` | string | yes | One of: `team_reference`. |
| `action.teams[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.teams[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.only_invocable_on_unresolved_incidents` | boolean |  | (option 2) If true, the action can only be invoked against an unresolved incident. Default: `false`. |
| `action.allow_invocation_manually` | boolean |  | (option 2) If true, the action can only be invoked manually by a user. Default: `true`. |
| `action.allow_invocation_from_event_orchestration` | boolean |  | (option 2) If true, the action can only be invoked automatically by an Event Orchestration. Default: `true`. |
| `action.map_to_all_services` | boolean |  | (option 2) If true, the action will be associated with every service. Default: `false`. |
| `action.action_data_reference` | object | yes | (option 2) |
| `action.action_data_reference.process_automation_job_id` | string | yes | Max length: 36. |
| `action.action_data_reference.process_automation_job_arguments` | string |  | Arguments to pass to the Process Automation job. The maxLength value is specified in bytes. Max length: 1024. |
| `action.action_data_reference.process_automation_node_filter` | string |  | Node filter for the Process Automation job. The maxLength value is specified in bytes. Filter syntax: https://docs.rundeck.com/docs/manual/11-node-filters.html#node-filter-syntax. Max length: 1024. |

Example: request

```json
{
  "action": {
    "name": "Restart apache",
    "description": "Restarts apache on the us-west-2-shopping-cart host",
    "action_type": "script",
    "action_data_reference": {
      "script": "java --version"
    },
    "teams": [
      {
        "id": "PQ9K7I8",
        "type": "team_reference"
      }
    ],
    "services": [
      {
        "id": "PRDRWUJ",
        "type": "service_reference"
      }
    ]
  }
}
```

## Response 201

Action information

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `action` | one of: object \| object | yes |  |
| `action.id` | string | yes | (option 1) Read-only. |
| `action.summary` | string \| null |  | (option 1) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.type` | string | yes | (option 1) A string that determines the schema of the object. This must be the standard name for the entity, suffixed by `_reference` if the object is a reference. Read-only. |
| `action.self` | string \| null (url) |  | (option 1) the API show URL at which the object is accessible. Read-only. |
| `action.html_url` | string \| null (url) |  | (option 1) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.name` | string | yes | (option 1) |
| `action.description` | string |  | (option 1) |
| `action.action_type` | string | yes | (option 1) One of: `script`, `process_automation`. |
| `action.action_classification` | string \| null |  | (option 1) One of: `diagnostic`, `remediation`. |
| `action.runner` | string |  | (option 1) Max length: 36. |
| `action.runner_type` | string |  | (option 1) sidecar -- The runner is backed by an external sidecar that polls for invocations. runbook -- The runner communicates directly with a runbook instance. One of: `sidecar`, `runbook`. |
| `action.services` | array of object |  | (option 1) |
| `action.services[].id` | string | yes | Read-only. |
| `action.services[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.services[].type` | string | yes | One of: `service_reference`. |
| `action.services[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.services[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.privileges` | object |  | (option 1) |
| `action.privileges.permissions` | array of string | yes |  |
| `action.metadata` | object |  | (option 1) |
| `action.creation_time` | string (date-time) | yes | (option 1) The date/time. |
| `action.modify_time` | string (date-time) | yes | (option 1) The date/time. |
| `action.last_run` | string (date-time) |  | (option 1) The date/time. |
| `action.last_run_by` | one of: object \| object \| object |  | (option 1) |
| `action.last_run_by.id` | string | yes | (option 1) Read-only. |
| `action.last_run_by.summary` | string \| null |  | (option 1) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.last_run_by.type` | string | yes | (option 1) One of: `user_reference`. |
| `action.last_run_by.self` | string \| null (url) |  | (option 1) the API show URL at which the object is accessible. Read-only. |
| `action.last_run_by.html_url` | string \| null (url) |  | (option 1) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.last_run_by.id` | string | yes | (option 2) |
| `action.last_run_by.type` | string | yes | (option 2) |
| `action.last_run_by.id` | string | yes | (option 3) Read-only. |
| `action.last_run_by.summary` | string \| null |  | (option 3) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.last_run_by.type` | string | yes | (option 3) One of: `account_reference`. |
| `action.last_run_by.self` | string \| null (url) |  | (option 3) the API show URL at which the object is accessible. Read-only. |
| `action.last_run_by.html_url` | string \| null (url) |  | (option 3) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.only_invocable_on_unresolved_incidents` | boolean |  | (option 1) If true, the action can only be invoked against an unresolved incident. Default: `false`. |
| `action.allow_invocation_manually` | boolean |  | (option 1) If true, the action can only be invoked manually by a user. Default: `true`. |
| `action.allow_invocation_from_event_orchestration` | boolean |  | (option 1) If true, the action can only be invoked automatically by an Event Orchestration. Default: `true`. |
| `action.map_to_all_services` | boolean |  | (option 1) If true, the action will be associated with every service. Default: `false`. |
| `action.action_data_reference` | object | yes | (option 1) Same fields as `action.action_data_reference` above. |
| `action.teams` | array of object |  | (option 1) |
| `action.teams[].id` | string | yes | Read-only. |
| `action.teams[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.teams[].type` | string | yes | One of: `team_reference`. |
| `action.teams[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.teams[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.id` | string | yes | (option 2) Read-only. |
| `action.summary` | string \| null |  | (option 2) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.type` | string | yes | (option 2) A string that determines the schema of the object. This must be the standard name for the entity, suffixed by `_reference` if the object is a reference. Read-only. |
| `action.self` | string \| null (url) |  | (option 2) the API show URL at which the object is accessible. Read-only. |
| `action.html_url` | string \| null (url) |  | (option 2) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.name` | string | yes | (option 2) |
| `action.description` | string |  | (option 2) |
| `action.action_type` | string | yes | (option 2) One of: `script`, `process_automation`. |
| `action.action_classification` | string \| null |  | (option 2) One of: `diagnostic`, `remediation`. |
| `action.runner` | string |  | (option 2) Max length: 36. |
| `action.runner_type` | string |  | (option 2) sidecar -- The runner is backed by an external sidecar that polls for invocations. runbook -- The runner communicates directly with a runbook instance. One of: `sidecar`, `runbook`. |
| `action.services` | array of object |  | (option 2) |
| `action.services[].id` | string | yes | Read-only. |
| `action.services[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.services[].type` | string | yes | One of: `service_reference`. |
| `action.services[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.services[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.privileges` | object |  | (option 2) Same fields as `action.privileges` above. |
| `action.metadata` | object |  | (option 2) |
| `action.creation_time` | string (date-time) | yes | (option 2) The date/time. |
| `action.modify_time` | string (date-time) | yes | (option 2) The date/time. |
| `action.last_run` | string (date-time) |  | (option 2) The date/time. |
| `action.last_run_by` | one of: object \| object \| object |  | (option 2) |
| `action.last_run_by.id` | string | yes | (option 1) Read-only. |
| `action.last_run_by.summary` | string \| null |  | (option 1) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.last_run_by.type` | string | yes | (option 1) One of: `user_reference`. |
| `action.last_run_by.self` | string \| null (url) |  | (option 1) the API show URL at which the object is accessible. Read-only. |
| `action.last_run_by.html_url` | string \| null (url) |  | (option 1) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.last_run_by.id` | string | yes | (option 2) |
| `action.last_run_by.type` | string | yes | (option 2) |
| `action.last_run_by.id` | string | yes | (option 3) Read-only. |
| `action.last_run_by.summary` | string \| null |  | (option 3) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.last_run_by.type` | string | yes | (option 3) One of: `account_reference`. |
| `action.last_run_by.self` | string \| null (url) |  | (option 3) the API show URL at which the object is accessible. Read-only. |
| `action.last_run_by.html_url` | string \| null (url) |  | (option 3) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `action.only_invocable_on_unresolved_incidents` | boolean |  | (option 2) If true, the action can only be invoked against an unresolved incident. Default: `false`. |
| `action.allow_invocation_manually` | boolean |  | (option 2) If true, the action can only be invoked manually by a user. Default: `true`. |
| `action.allow_invocation_from_event_orchestration` | boolean |  | (option 2) If true, the action can only be invoked automatically by an Event Orchestration. Default: `true`. |
| `action.map_to_all_services` | boolean |  | (option 2) If true, the action will be associated with every service. Default: `false`. |
| `action.action_data_reference` | object | yes | (option 2) Same fields as `action.action_data_reference` above. |
| `action.teams` | array of object |  | (option 2) |
| `action.teams[].id` | string | yes | Read-only. |
| `action.teams[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `action.teams[].type` | string | yes | One of: `team_reference`. |
| `action.teams[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `action.teams[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |

Example: Response Example

```json
{
  "action": {
    "action_data_reference": {
      "script": "java --version"
    },
    "action_type": "script",
    "type": "action",
    "creation_time": "2022-11-08T14:54:02.267989Z",
    "description": "Restarts apache on the us-west-2-shopping-cart host",
    "id": "01DA2MLYN0J5EFC1LKWXUKDDKT",
    "modify_time": "2022-11-08T14:54:02.267989Z",
    "name": "Restart apache",
    "only_invocable_on_unresolved_incidents": false,
    "allow_invocation_manually": true,
    "allow_invocation_from_event_orchestration": true,
    "map_to_all_services": false,
    "privileges": {
      "permissions": [
        "read",
        "update",
        "delete",
        "invoke"
      ]
    },
    "services": [
      {
        "id": "PRDRWUJ",
        "type": "service_reference"
      }
    ],
    "teams": [
      {
        "id": "PQ9K7I8",
        "type": "team_reference"
      }
    ]
  }
}
```

## Response 400

Caller provided invalid arguments. Please review the response for error details. Retrying with the same arguments will *not* work.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 401

Caller did not supply credentials or did not provide the correct credentials.
If you are using an API key, it may be invalid or your Authorization header may be malformed.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 402

Account does not have the abilities to perform the action. Please review the response for the required abilities.
You can also use the [Abilities API](#resource_Abilities) to determine what features are available to your account.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 403

Caller is not authorized to view the requested resource.
While your authentication is valid, the authenticated user or token does not have permission to perform this action.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 404

The requested resource was not found.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 429

Too many requests have been made, the rate limit has been reached.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 500

Internal Server Error the PagerDuty server experienced an error.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Developer Agreement

Your access to and use of the PagerDuty Developer Services is governed by the [PagerDuty Developer Agreement](https://docs.pagerduty.com/developer/pagerduty-developer-agreement).
