> 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/tailscale.md).

# Tailscale

Manage Tailscale devices, auth keys, and access policy, and react to device approval, join, and key-expiry events.

## Connectors

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

| Connector                    | Authentication |
| ---------------------------- | -------------- |
| Tailscale                    | Credentials    |
| Tailscale (API Access Token) | Credentials    |

### Tailscale

Connect to Tailscale with an OAuth client to manage devices, auth keys, access policy, and webhooks. Access tokens are short-lived (1 hour) and scoped to only what the client is granted, making this the preferred credential for unattended workflows.

#### Set up in Tailscale

1. Prepare the Tailscale account or service that the workflow will access. Grant access to the required resources and operations.
2. **Client ID:** OAuth client ID, created under Settings > OAuth clients in the admin console.

#### Set up in StackAI

1. Open **Settings → Connections**, add a connection, and select **Tailscale**.
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                                                                                                                                                                                                                    |
| ------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Client ID     | Yes                      | OAuth client ID, created under Settings > OAuth clients in the admin console. [Provider instructions](https://tailscale.com/docs/features/oauth-clients).                                                                        |
| Client Secret | Yes                      | OAuth client secret, shown only once at creation. Grant only the scopes this workflow needs (e.g. devices:core, auth\_keys, policy\_file, webhooks). [Provider instructions](https://tailscale.com/docs/features/oauth-clients). |
| Tailnet       | Optional / as applicable | Tailnet to operate on. Leave as '-' for this OAuth client's default tailnet.                                                                                                                                                     |

### Tailscale (API Access Token)

Connect to Tailscale with a personal API access token. These tokens expire 1-90 days after creation and carry the full admin reach of the user who created them. Prefer the Tailscale OAuth client connector for unattended workflows.

#### Set up in Tailscale

1. Prepare the Tailscale account or service that the workflow will access. Grant access to the required resources and operations.
2. **API Access Token:** A personal API access token minted from the admin console Keys page. It expires 1-90 days after creation and carries the full admin reach of the user who created it. Prefer an OAuth client connection for unattended workflows.

#### Set up in StackAI

1. Open **Settings → Connections**, add a connection, and select **Tailscale (API Access Token)**.
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                                                                                                                                                                                                                                                                                 |
| ---------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API Access Token | Yes                      | A personal API access token minted from the admin console Keys page. It expires 1-90 days after creation and carries the full admin reach of the user who created it. Prefer an OAuth client connection for unattended workflows. [Provider instructions](https://tailscale.com/kb/1101/api). |
| Tailnet          | Optional / as applicable | Tailnet to operate on. Leave as '-' for this token owner's default tailnet.                                                                                                                                                                                                                   |

### 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 **Tailscale** 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

### List Devices

List the machines in your Tailscale network, with optional filters for tag, operating system, or approval status. Use this to inventory your fleet, find machines that are still waiting for approval, or check which ones have gone offline.

#### Inputs

| Field                      | Type            | Required | Description                                                                                                                                                                           |
| -------------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tag                        | select (string) | No       | Only return machines carrying this tag, for example tag:production. Leave empty to return every machine. Options load from the selected connection.                                   |
| Approval status            | select (string) | No       | Narrow the list to machines that are already approved, or only the ones still waiting for an admin to approve them. Available values: Any, Approved, Awaiting approval. Default: any. |
| Show advanced options      | boolean         | No       | Show the operating system, full detail, and limit options. Default: false.                                                                                                            |
| Operating system           | string          | No       | Only return machines running this operating system, for example linux, macOS, windows, iOS or android.                                                                                |
| Include all device details | boolean         | No       | Return every field Tailscale knows about each machine, including connectivity and posture details. Leave off for a smaller, faster response. Default: false.                          |
| Maximum machines to return | integer         | No       | Stop after this many machines. Tailscale returns the whole tailnet in one response, so this keeps large fleets from overwhelming your workflow. Default: 100.                         |

#### Outputs

| Field                  | Type          | Description                                                                                                      |
| ---------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------- |
| Devices                | object\_array | The machines that matched your filters.                                                                          |
| Number of devices      | integer       | How many machines were returned.                                                                                 |
| More devices available | boolean       | True when your tailnet has more machines than the limit returned, so the list above is only part of the picture. |

### Get Device Details

Look up everything Tailscale knows about one machine: its Tailscale IP addresses, tags, owner, operating system, when it was last seen, and whether its key is about to expire.

#### Inputs

| Field                      | Type            | Required | Description                                                                                                                                      |
| -------------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Machine                    | select (string) | Yes      | The machine you want details for. Pick it from the list, or type its hostname or Tailscale device ID. Options load from the selected connection. |
| Include all device details | boolean         | No       | Return every field Tailscale knows about the machine, including connectivity and posture details. Default: true.                                 |

#### Outputs

| Field  | Type   | Description                |
| ------ | ------ | -------------------------- |
| Device | object | The machine's full record. |

### Approve Device

Approve a machine that is waiting to join your Tailscale network, or revoke a machine's approval so it loses access. Use this to finish onboarding a new laptop or server automatically.

#### Inputs

| Field               | Type            | Required | Description                                                                                                                                               |
| ------------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Machine             | select (string) | Yes      | The machine to approve. Pick it from the list, or type its hostname or Tailscale device ID. Options load from the selected connection.                    |
| Approve the machine | boolean         | No       | Leave this on to approve the machine. Turn it off to revoke an already-approved machine, which immediately cuts its access to the network. Default: true. |

#### Outputs

| Field     | Type    | Description                          |
| --------- | ------- | ------------------------------------ |
| Device ID | string  | The machine that was updated.        |
| Approved  | boolean | Whether the machine is now approved. |

### Set Device Tags

Label a machine with tags such as tag:production or tag:web-server. Tags are how Tailscale access rules decide what a machine can reach, so tagging is usually the step that grants or changes a machine's access.

#### Inputs

| Field                 | Type            | Required | Description                                                                                                                                                                                       |
| --------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Machine               | select (string) | Yes      | The machine to tag. Pick it from the list, or type its hostname or Tailscale device ID. Options load from the selected connection.                                                                |
| Tags                  | string          | Yes      | The tags to apply, separated by commas, for example production, web-server. The tag: prefix is added for you if you leave it off. Each tag must already be listed in your tailnet's access rules. |
| How to apply the tags | select (string) | No       | Replace swaps the machine's tags for exactly the ones you listed, removing any others. Tailscale does not provide an atomic add operation. Available values: Replace. Default: replace.           |

#### Outputs

| Field     | Type          | Description                       |
| --------- | ------------- | --------------------------------- |
| Device ID | string        | The machine that was tagged.      |
| Tags      | string\_array | The tags the machine now carries. |

### Set Device Key Expiry

Stop a machine's Tailscale key from expiring, so a long-running server, subnet router or CI runner does not silently drop off the network and need someone to sign in again. You can also switch expiry back on.

#### Inputs

| Field                           | Type            | Required | Description                                                                                                                                                                                          |
| ------------------------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Machine                         | select (string) | Yes      | The machine whose key expiry you want to change. Pick it from the list, or type its hostname or Tailscale device ID. Options load from the selected connection.                                      |
| Never expire this machine's key | boolean         | No       | Leave this on so the machine stays connected indefinitely. Turn it off to put the machine back on the normal expiry schedule, which will eventually require someone to sign in again. Default: true. |

#### Outputs

| Field               | Type    | Description                                           |
| ------------------- | ------- | ----------------------------------------------------- |
| Device ID           | string  | The machine that was updated.                         |
| Key expiry disabled | boolean | Whether the machine's key is now set to never expire. |

### Remove Device

Permanently remove a machine from your Tailscale network. Use this when offboarding someone or decommissioning a server. The machine loses access immediately and would have to be enrolled again from scratch.

#### Inputs

| Field   | Type            | Required | Description                                                                                                                                                  |
| ------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Machine | select (string) | Yes      | The machine to remove. Pick it from the list, or type its hostname or Tailscale device ID. This cannot be undone. Options load from the selected connection. |

#### Outputs

| Field     | Type    | Description                                       |
| --------- | ------- | ------------------------------------------------- |
| Device ID | string  | The machine that was removed.                     |
| Removed   | boolean | Confirms the machine is no longer in the network. |

### Create Auth Key

Generate a Tailscale auth key so a new server, container or CI runner can join your network without anyone signing in by hand. The key is shown once when it is created, so capture it in the same workflow run.

#### Inputs

| Field                              | Type    | Required | Description                                                                                                                                                                                                                                     |
| ---------------------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Description                        | string  | No       | A short note about what this key is for, so you can recognise it later in the Tailscale admin console.                                                                                                                                          |
| Tags                               | string  | No       | Tags to stamp on every machine that joins with this key, separated by commas, for example ci-runner. The tag: prefix is added for you. Required when you connect with an OAuth client, and the tags must be ones that client is allowed to own. |
| Let multiple machines use this key | boolean | No       | Leave off for a single-use key, which is the safer choice. Turn on if a fleet of machines needs to join with the same key. Default: false.                                                                                                      |
| Clean up machines automatically    | boolean | No       | Turn on for short-lived machines such as CI jobs or containers, so Tailscale removes them from your network once they go offline. Default: false.                                                                                               |
| Skip admin approval                | boolean | No       | Turn on so machines joining with this key are approved immediately instead of waiting for an admin. Only relevant if your network requires device approval. Default: false.                                                                     |
| Key valid for (days)               | integer | No       | How long the key can be used to join machines before it stops working. Shorter is safer. Default: 90.                                                                                                                                           |

#### Outputs

| Field    | Type     | Description                                                                                                                                         |
| -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Key ID   | string   | The key's identifier, which you can use later to revoke it.                                                                                         |
| Auth key | secret   | The auth key itself. Tailscale shows this only once, so pass it straight to whatever needs it. Anyone holding it can join machines to your network. |
| Expires  | datetime | When the key stops working.                                                                                                                         |

### List Auth Keys

See the auth keys that exist in your Tailscale network and when they expire, so you can spot keys about to lapse or clean up ones nobody uses. Key secrets are never shown here.

#### Inputs

| Field                            | Type    | Required | Description                                                                                                                 |
| -------------------------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| Only keys expiring within (days) | integer | No       | Only return keys that expire in this many days or fewer, so you can act before they lapse. Leave empty to return every key. |
| Maximum keys to return           | integer | No       | Stop after this many keys. Default: 100.                                                                                    |

#### Outputs

| Field               | Type          | Description                                                                                                       |
| ------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------- |
| Auth keys           | object\_array | The auth keys that matched, without their secrets.                                                                |
| Number of keys      | integer       | How many keys were returned.                                                                                      |
| More keys available | boolean       | True when your tailnet has more auth keys than the limit returned, so the list above is only part of the picture. |

### Revoke Auth Key

Invalidate a Tailscale auth key so it can no longer be used to add machines. Use this the moment a key leaks or is no longer needed. Machines that already joined with it stay connected.

#### Inputs

| Field    | Type            | Required | Description                                                                                               |
| -------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| Auth key | select (string) | Yes      | The key to revoke. Pick it from the list, or paste its key ID. Options load from the selected connection. |

#### Outputs

| Field   | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| Key ID  | string  | The key that was revoked.               |
| Revoked | boolean | Confirms the key can no longer be used. |

### Validate Access Policy

Check a Tailscale access policy for mistakes without applying it. Run this before you change the real policy so you find out about a broken rule safely rather than by locking people out.

#### Inputs

| Field         | Type     | Required | Description                                                                                                   |
| ------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| Access policy | textarea | Yes      | The full access policy to check, in Tailscale's policy file format. Comments and trailing commas are allowed. |

#### Outputs

| Field    | Type          | Description                                                                     |
| -------- | ------------- | ------------------------------------------------------------------------------- |
| Valid    | boolean       | Whether the policy would be accepted by Tailscale.                              |
| Problems | string\_array | Errors or failing tests found, so you know what to fix.                         |
| Warnings | string\_array | Non-fatal notices, such as an unsynced SCIM group, that did not fail the check. |

### Update Access Policy

Replace your tailnet's access policy, which decides who and what can reach each machine. This overwrites the whole policy, so the action checks it first and refuses to apply a policy that would be rejected, and it stops if someone else edited the policy while your workflow was running.

#### Inputs

| Field                               | Type     | Required | Description                                                                                                                                                                                                     |
| ----------------------------------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Access policy                       | textarea | Yes      | The complete new access policy, in Tailscale's policy file format. Whatever you put here becomes the entire policy, so include every rule you want to keep. Comments and trailing commas are allowed.           |
| Check the policy before applying it | boolean  | No       | Leave this on so a policy with a mistake is reported back to you instead of being applied to your network. Default: true.                                                                                       |
| Overwrite changes made by others    | boolean  | No       | Leave this off so the update is abandoned if someone edited the policy in the Tailscale console while your workflow was running. Turn it on only when you intend your policy to win regardless. Default: false. |

#### Outputs

| Field          | Type    | Description                      |
| -------------- | ------- | -------------------------------- |
| Applied policy | string  | The policy that is now in force. |
| Applied        | boolean | Confirms the new policy is live. |

## Triggers

A trigger starts a workflow when its configured event occurs. Configure the event and filters before enabling the trigger.

### Device Needs Approval

Starts your workflow when a machine tries to join your Tailscale network and is waiting for an admin to approve it.

This trigger only fires when device approval is enabled for your tailnet (Access controls > Device approval in the admin console). StackAI registers and secures the Tailscale webhook automatically when you enable the trigger.

**Required permissions:** `webhooks`, `webhooks:read`.

#### Event inputs

| Field       | Type   | Required | Description                                                                   |
| ----------- | ------ | -------- | ----------------------------------------------------------------------------- |
| Event type  | string | Yes      | The Tailscale event that fired, always nodeNeedsApproval for this trigger.    |
| Device ID   | string | No       | The machine waiting for approval, ready to pass to the Approve Device action. |
| Device name | string | No       | The machine's name, useful in the approval message you send.                  |
| Tailnet     | string | No       | The Tailscale network the event came from.                                    |
| Full event  | object | Yes      | Everything Tailscale sent about the event.                                    |

#### Outputs

| Field       | Type   | Description                                                                   |
| ----------- | ------ | ----------------------------------------------------------------------------- |
| Event type  | string | The Tailscale event that fired, always nodeNeedsApproval for this trigger.    |
| Device ID   | string | The machine waiting for approval, ready to pass to the Approve Device action. |
| Device name | string | The machine's name, useful in the approval message you send.                  |
| Tailnet     | string | The Tailscale network the event came from.                                    |
| Full event  | object | Everything Tailscale sent about the event.                                    |

### Device Added

Starts your workflow whenever a new machine joins your Tailscale network, so you can tag it, record it in your asset inventory, or tell the team.

This trigger fires for every new machine that registers with your tailnet, whether or not device approval is enabled. StackAI registers and secures the Tailscale webhook automatically when you enable the trigger.

**Required permissions:** `webhooks`, `webhooks:read`.

#### Event inputs

| Field       | Type   | Required | Description                                                           |
| ----------- | ------ | -------- | --------------------------------------------------------------------- |
| Event type  | string | Yes      | The Tailscale event that fired, always nodeCreated for this trigger.  |
| Device ID   | string | No       | The machine that joined, ready to pass to the Set Device Tags action. |
| Device name | string | No       | The name of the machine that joined.                                  |
| Tailnet     | string | No       | The Tailscale network the event came from.                            |
| Full event  | object | Yes      | Everything Tailscale sent about the event.                            |

#### Outputs

| Field       | Type   | Description                                                           |
| ----------- | ------ | --------------------------------------------------------------------- |
| Event type  | string | The Tailscale event that fired, always nodeCreated for this trigger.  |
| Device ID   | string | The machine that joined, ready to pass to the Set Device Tags action. |
| Device name | string | The name of the machine that joined.                                  |
| Tailnet     | string | The Tailscale network the event came from.                            |
| Full event  | object | Everything Tailscale sent about the event.                            |

### Device Key Expiring or Expired

Starts your workflow when a machine's Tailscale key is about to expire or has just expired, so you can keep a critical server online before it drops off the network.

This trigger fires one day before a device's node key expires, and again when it expires. Pair it with the Set Device Key Expiry action to disable expiry on critical machines. StackAI registers and secures the Tailscale webhook automatically when you enable the trigger.

**Required permissions:** `webhooks`, `webhooks:read`.

#### Event inputs

| Field       | Type   | Required | Description                                                               |
| ----------- | ------ | -------- | ------------------------------------------------------------------------- |
| Event type  | string | Yes      | Which of the two events fired: nodeKeyExpiringInOneDay or nodeKeyExpired. |
| Device ID   | string | No       | The affected machine, ready to pass to the Set Device Key Expiry action.  |
| Device name | string | No       | The name of the affected machine.                                         |
| Tailnet     | string | No       | The Tailscale network the event came from.                                |
| Full event  | object | Yes      | Everything Tailscale sent about the event.                                |

#### Outputs

| Field       | Type   | Description                                                               |
| ----------- | ------ | ------------------------------------------------------------------------- |
| Event type  | string | Which of the two events fired: nodeKeyExpiringInOneDay or nodeKeyExpired. |
| Device ID   | string | The affected machine, ready to pass to the Set Device Key Expiry action.  |
| Device name | string | The name of the affected machine.                                         |
| Tailnet     | string | The Tailscale network the event came from.                                |
| Full event  | object | Everything Tailscale sent about the event.                                |

## 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/tailscale.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.
