> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Portainer connection

> Learn how to configure a Portainer connection for Infisical.

A Portainer connection authenticates Infisical to Portainer with an [access token](https://docs.portainer.io/api/access), so Infisical can list your environments and stacks and update a stack's environment variables.

The token inherits the permissions of the Portainer user who created it, so Infisical can only reach the environments and stacks that user can.

> [!NOTE]
>
> This guide only authenticates Infisical with Portainer. Once the app connection is ready, you can [use it to set up integrations](#step-3-configure-integrations).

## Prerequisites

* Portainer Community Edition 2.39 or later, or Business Edition 2.42 or later
* A Portainer user whose permissions cover the environments and stacks you want to sync to
* If your Portainer instance isn't reachable from the internet, a [Gateway](https://infisical.com/docs/documentation/platform/gateways/overview.md) with network access to it

## Step 1: Generate a Portainer API token

Infisical needs an access token to call the Portainer API on your behalf.

**Step 1**

Log in to your Portainer instance, select the user icon in the top-right corner, then select **My account**.

**Step 2**

Scroll to the **Access tokens** section and select **Add access token**.

**Step 3**

Enter a **Description** that identifies the token, such as `infisical`, then select **Add access token**.

> [!NOTE]
>
> An access token inherits the permissions of the user that created it, so create it as a user who can read the environments and update the stacks you plan to sync to.

**Step 4**

Copy the token and store it securely. Portainer shows it only once.

## Step 2: Create the app connection

Next, create the app connection in Infisical.

> [!TIP]
>
> To create the connection using the API, use the [Create Portainer Connection](https://infisical.com/docs/api-reference/endpoints/app-connections/portainer/create.md) endpoint. If the instance isn't reachable from the internet, include the ID of a Gateway that can reach it as `gatewayId`, or the ID of a Gateway pool as `gatewayPoolId`.

**Organization-level**

**Step 1**

In the sidebar, select **Integrations**, then open the **App Connections** tab.

![App Connections Tab](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/general/add-connection.png)

**Step 2**

Select **Add Connection** and choose **Portainer**.

**Step 3**

Fill out the form's fields:

* **Name**: A descriptive name for the connection; it must be slug-friendly
* **Description** (optional): A note for future reference
* **Gateway**: The Gateway or Gateway pool to route requests through if your Portainer instance isn't reachable from the internet; otherwise leave it as **Internet Gateway**
* **Method**: **API Token**, the only method the connection supports
* **Portainer Instance URL**: The URL of your Portainer instance, such as `https://portainer.example.com`
* **Portainer API Token**: The token you copied when [generating a Portainer API token](https://infisical.com/docs/integrations/app-connections/portainer.md#step-1-generate-a-portainer-api-token)

Then, select **Connect to Portainer**.

**Project-level**

**Step 1**

In your Secrets Management project, select **Integrations** from the sidebar, then open the **App Connections** tab.

**Step 2**

Select **Add Connection** and choose **Portainer**.

![Select Portainer Connection](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/portainer/step-1.png)

**Step 3**

Fill out the form's fields:

* **Name**: A descriptive name for the connection; it must be slug-friendly
* **Description** (optional): A note for future reference
* **Gateway**: The Gateway or Gateway pool to route requests through if your Portainer instance isn't reachable from the internet; otherwise leave it as **Internet Gateway**
* **Method**: **API Token**, the only method the connection supports
* **Portainer Instance URL**: The URL of your Portainer instance, such as `https://portainer.example.com`
* **Portainer API Token**: The token you copied when [generating a Portainer API token](https://infisical.com/docs/integrations/app-connections/portainer.md#step-1-generate-a-portainer-api-token)

Then, select **Connect to Portainer**.

![Portainer Connection Form](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/portainer/step-2.png)

When you submit the form, Infisical calls the Portainer API with the token to confirm that Portainer accepts it.

> [!TIP]
>
> Your Portainer app connection is ready to use.

![Portainer Connection Created](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/portainer/step-3.png)

## Step 3: Configure integrations

Now that your Portainer app connection is configured, you can use it to set up the following integration:

> **[Portainer Secret Sync](https://infisical.com/docs/integrations/secret-syncs/portainer.md)**
>
> Sync secrets from Infisical to the environment variables of a Portainer stack.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.