# Smart Action Definitions

Define filter-based actions that reviewers can apply to certifications results with a matching attribute or status.

Reviewers can view and apply custom actions from the Review interface by clicking **Smart Action** > **Prepared Actions**.

* [Add smart action definition](#add-smart-action-definition)
  * [Mutable fields and mutable filters](#mutable-fields-and-mutable-filters)
* [Remove a smart action definition](#remove-a-smart-action-definition)
* [List smart action definitions](#list-smart-action-definitions)
* [Update a smart action definition](#update-a-smart-action-definition)

### Add smart action definition

Create a smart action definition, globally or for a single Workflow.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media>" path="/api/preview/awf/smart\_action\_definitions" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media)
{% endopenapi %}

A certification [result](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/workflows/getaccesscertresult) includes all source and destination node properties discovered or added by Veza. You can specify a SCIM filter to select the results to affect, for example:

Example request:

```bash
curl -X POST "https://{{veza_url}}/api/preview/awf/smart_action_definitions" \
-H 'authorization: Bearer {{access_token}}' \
-d '{
  "apply_to_all_rows": "false",
  "description": "Reject users where the user `is active` value is not `true`",
  "filter": "source.is_active ne \"true\"",
  "mutable_fields": {
    "decision": "RESULT_DECISION_REJECTED"
  },
  "mutable_filter": "",
  "name": "Reject inactive users",
  "workflow_id": ""
}'
```

The filter can apply to any source or destination node property.

When `apply_to_all_rows` is `true` and no other filter criteria is specified, the action will run on all certification results.

#### Mutable fields and mutable filters

Mutable fields contain result attributes that are not sourced from Access Graph metadata. Use `mutable_fields` to apply changes to a result, and `mutable_filter` to filter results based on decision or sign-off state:

```json
{
  "apply_to_all_rows": "false",
  "description": "Sign off on all rejected rows",
  "filter": "",
  "mutable_fields": {
    "signed_off_state": "SIGNED_OFF"
  },
  "mutable_filter": "decision eq \"RESULT_DECISION_REJECTED\"",
  "name": "Sign off rejected rows",
  "workflow_id": ""
}
```

| Mutable field      | Value                                                                                                                                            |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `decision`         | One of: "RESULT\_DECISION\_UNKNOWN" "RESULT\_DECISION\_NONE" "RESULT\_DECISION\_ACCEPTED" "RESULT\_DECISION\_REJECTED" "RESULT\_DECISION\_FIXED" |
| `notes`            | string                                                                                                                                           |
| `signed_off_state` | One of: "UNKNOWN" "NOT\_SIGNED\_OFF" "SIGNED\_OFF"                                                                                               |

### Remove a smart action definition

Delete a prepared action by definition `id`.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media>" path="/api/preview/awf/smart\_action\_definitions/{id}" method="delete" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### List smart action definitions

Returns an array of smart action definitions. By default, this endpoint lists all definitions. If a `workflow_id` is specified, only definitions for that workflow are included in the response.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media>" path="/api/preview/awf/smart\_action\_definitions" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Update a smart action definition

Alter a smart action definition by specifying the `id` and an array of `values` to change.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media>" path="/api/preview/awf/smart\_action\_definitions" method="put" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-78f548f68894fbfb26b0fd9627c7e562be046dfa%2Fopenapi.yaml?alt=media)
{% endopenapi %}
