> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/duo-security.md).

# Duo Security

Connect to Duo Security to manage MFA user lifecycle: create and update users, manage group membership, remove devices, and send enrollment emails.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector    | Authentication |
| ------------ | -------------- |
| Duo Security | Secret Key     |

#### Duo Security

Connect to the Duo Admin API to manage user lifecycle: create and update users, manage group membership, remove MFA devices, and send enrollment emails. Requires an Admin API application with the 'Grant read resource' and 'Grant write resource' permissions, on an Essentials, Advantage, or Premier plan (or an active trial).

**Set up in Duo Security**

1. Prepare the Duo Security account or service that the workflow will access. Grant access to the required resources and operations.
2. **Secret Key:** The 'Secret key' (skey) of the same Admin API application, shown in full only when the application is created (use 'Reset Secret key' on the application page if you no longer have it).

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Duo Security**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field   | Required | What to enter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Integration Key | Yes      | The 'Integration key' (ikey) of a Duo Admin API application. In the Duo Admin Panel open Applications > Add application, search 'Admin API', and click Protect; then on the application's page grant it the 'Read' and 'Write' resource permissions. The Integration key, Secret key, and API hostname are all shown on that page. Requires a Duo edition that includes the Admin API (Essentials, Advantage, or Premier, or an active trial). [Provider instructions](https://duo.com/docs/adminapi). |
| Secret Key      | Yes      | The 'Secret key' (skey) of the same Admin API application, shown in full only when the application is created (use 'Reset Secret key' on the application page if you no longer have it). [Provider instructions](https://duo.com/docs/adminapi).                                                                                                                                                                                                                                                       |
| API Hostname    | Yes      | The 'API hostname' shown on the Admin API application's page. Paste it as shown (e.g. 'api-XXXXXXXX.duosecurity.com') or just the 'XXXXXXXX' part. [Provider instructions](https://duo.com/docs/adminapi).                                                                                                                                                                                                                                                                                             |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Duo Security** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Create User

Create a new user in your Duo directory so they can enroll in multi-factor authentication.

**Inputs**

| Field     | Type            | Required | Description                                                                             |
| --------- | --------------- | -------- | --------------------------------------------------------------------------------------- |
| Username  | string          | Yes      | The unique username for the new user (often their directory or email login).            |
| Email     | string          | No       | The user's email address. Required later if you send them an enrollment email.          |
| Full name | string          | No       | The user's display name.                                                                |
| Status    | select (string) | No       | The user's account status. Available values: Active, Disabled, Bypass. Default: active. |
| Notes     | string          | No       | Free-form notes stored on the user.                                                     |

**Outputs**

| Field    | Type   | Description            |
| -------- | ------ | ---------------------- |
| User ID  | string | The new user's Duo id. |
| Username | string | The username.          |
| Email    | string | The user's email.      |
| Status   | string | The user's status.     |

#### Update User

Change a user's status (for example disable or set to bypass) or update their profile details.

**Inputs**

| Field     | Type            | Required | Description                                                                     |
| --------- | --------------- | -------- | ------------------------------------------------------------------------------- |
| User      | select (string) | Yes      | The user to update. Options load from the selected connection.                  |
| Status    | select (string) | No       | The new account status. Available values: Active, Disabled, Bypass, Locked Out. |
| Email     | string          | No       | Update the user's email.                                                        |
| Full name | string          | No       | Update the user's display name.                                                 |
| Notes     | string          | No       | Update the notes on the user.                                                   |

**Outputs**

| Field    | Type   | Description                         |
| -------- | ------ | ----------------------------------- |
| User ID  | string | The user's Duo id.                  |
| Username | string | The username.                       |
| Status   | string | The user's status after the update. |

#### Add User to Group

Add a user to a Duo group so group-based MFA policy applies to them.

**Inputs**

| Field | Type            | Required | Description                                                              |
| ----- | --------------- | -------- | ------------------------------------------------------------------------ |
| User  | select (string) | Yes      | The user to add to the group. Options load from the selected connection. |
| Group | select (string) | Yes      | The group to add the user to. Options load from the selected connection. |

**Outputs**

| Field    | Type    | Description                           |
| -------- | ------- | ------------------------------------- |
| User ID  | string  | The user's Duo id.                    |
| Group ID | string  | The group's Duo id.                   |
| Added    | boolean | Whether the user is now in the group. |

#### List User Phones

List the phones (authenticator devices) attached to a user.

**Inputs**

| Field       | Type            | Required | Description                                                                        |
| ----------- | --------------- | -------- | ---------------------------------------------------------------------------------- |
| User        | select (string) | Yes      | The user whose phones you want to list. Options load from the selected connection. |
| Page cursor | integer         | No       | Continue from a previous page. Minimum: 0.                                         |

**Outputs**

| Field            | Type          | Description                                              |
| ---------------- | ------------- | -------------------------------------------------------- |
| Phones           | object\_array | The phones (authenticator devices) attached to the user. |
| Next page cursor | integer       | Cursor for the next page, if any.                        |

#### Remove User Phone

Remove a phone from a user, for example when they lose a device.

**Inputs**

| Field | Type            | Required | Description                                                                         |
| ----- | --------------- | -------- | ----------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | The user whose phone you want to remove. Options load from the selected connection. |
| Phone | select (string) | Yes      | The phone to remove from this user. Options load from the selected connection.      |

**Outputs**

| Field    | Type    | Description                    |
| -------- | ------- | ------------------------------ |
| Removed  | boolean | Whether the phone was removed. |
| User ID  | string  | The user's Duo id.             |
| Phone ID | string  | The removed phone's id.        |

#### Send Enrollment Email

Email a user a self-enrollment link so they can set up their own MFA device.

**Inputs**

| Field                   | Type            | Required | Description                                                                                            |
| ----------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| Username                | select (string) | Yes      | The username to enroll. Options load from the selected connection.                                     |
| Email                   | string          | Yes      | The email address to send the enrollment link to.                                                      |
| Link validity (seconds) | integer         | No       | How long the enrollment link stays valid, in seconds (up to 30 days). Leave blank for the Duo default. |

**Outputs**

| Field    | Type   | Description                     |
| -------- | ------ | ------------------------------- |
| Username | string | The username enrolled.          |
| Email    | string | The email the link was sent to. |

#### List Users

List the users in your Duo directory, with their id, username, and status.

**Inputs**

| Field       | Type    | Required | Description                                                         |
| ----------- | ------- | -------- | ------------------------------------------------------------------- |
| Username    | string  | No       | Return only the user with this exact username. Leave blank for all. |
| Page cursor | integer | No       | Continue from a previous page. Minimum: 0.                          |

**Outputs**

| Field            | Type          | Description                                                     |
| ---------------- | ------------- | --------------------------------------------------------------- |
| Users            | object\_array | The directory users, each with id, username, email, and status. |
| Next page cursor | integer       | Cursor for the next page, if any.                               |

#### List Groups

List the groups in your Duo account, with their id, name, and description.

**Inputs**

| Field       | Type    | Required | Description                                |
| ----------- | ------- | -------- | ------------------------------------------ |
| Page cursor | integer | No       | Continue from a previous page. Minimum: 0. |

**Outputs**

| Field            | Type          | Description                                      |
| ---------------- | ------------- | ------------------------------------------------ |
| Groups           | object\_array | The groups, each with id, name, and description. |
| Next page cursor | integer       | Cursor for the next page, if any.                |

#### Create Group

Create a Duo group that users can be added to for group-based MFA policy.

**Inputs**

| Field       | Type   | Required | Description                            |
| ----------- | ------ | -------- | -------------------------------------- |
| Name        | string | Yes      | The name of the group to create.       |
| Description | string | No       | An optional description for the group. |

**Outputs**

| Field       | Type   | Description                      |
| ----------- | ------ | -------------------------------- |
| Group ID    | string | The new group's Duo id.          |
| Name        | string | The group's name.                |
| Description | string | The group's description, if set. |

#### Delete Group

Delete a Duo group. Members are not deleted, only their membership in it.

**Inputs**

| Field | Type            | Required | Description                                                     |
| ----- | --------------- | -------- | --------------------------------------------------------------- |
| Group | select (string) | Yes      | The group to delete. Options load from the selected connection. |

**Outputs**

| Field    | Type    | Description                         |
| -------- | ------- | ----------------------------------- |
| Group ID | string  | The deleted group's Duo id.         |
| Deleted  | boolean | Whether the group no longer exists. |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/duo-security.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
