> ## 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).
</Note>

## 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](/docs/documentation/platform/gateways/overview) 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.

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

  <Step>
    Scroll to the **Access tokens** section and select **Add access token**.
  </Step>

  <Step>
    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.
    </Note>
  </Step>

  <Step>
    Copy the token and store it securely. Portainer shows it only once.
  </Step>
</Steps>

## 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](/docs/api-reference/endpoints/app-connections/portainer/create) 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`.
</Tip>

<View title="Organization-level">
  <Steps>
    <Step>
      In the sidebar, select **Integrations**, then open the **App Connections** tab.

      <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/general/add-connection.png" alt="App Connections Tab" />
    </Step>

    <Step>
      Select **Add Connection** and choose **Portainer**.
    </Step>

    <Step>
      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](/docs/integrations/app-connections/portainer#step-1-generate-a-portainer-api-token)

      Then, select **Connect to Portainer**.
    </Step>
  </Steps>
</View>

<View title="Project-level">
  <Steps>
    <Step>
      In your Secrets Manager project, select **Integrations** from the sidebar, then open the **App Connections** tab.
    </Step>

    <Step>
      Select **Add Connection** and choose **Portainer**.

      <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/portainer/step-1.png" alt="Select Portainer Connection" />
    </Step>

    <Step>
      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](/docs/integrations/app-connections/portainer#step-1-generate-a-portainer-api-token)

      Then, select **Connect to Portainer**.

      <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/portainer/step-2.png" alt="Portainer Connection Form" />
    </Step>
  </Steps>
</View>

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

<Check>
  Your Portainer app connection is ready to use.
</Check>

<img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/portainer/step-3.png" alt="Portainer Connection Created" />

## Step 3: Configure integrations

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

<Card title="Portainer Secret Sync" icon="refresh-cw" href="/docs/integrations/secret-syncs/portainer">
  Sync secrets from Infisical to the environment variables of a Portainer stack.
</Card>


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