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

# Connect AgentMail with API Key – StackOne Hub

> Link a AgentMail account in the StackOne Hub using API Key. End-user guide to authorize the integration and start using AgentMail actions.

## Generating an API key

An AgentMail API key lets StackOne act on your AgentMail organization's inboxes, messages and domains.

**1. Sign in to AgentMail**

Sign in to your [AgentMail account](https://console.agentmail.to/sign-in).

<ul>
  <li>Enter your **Email address** and click **Continue**, or sign in with **Google**.</li>
</ul>

![The AgentMail Console Sign in page with the Email address field and Continue button highlighted](https://mintcdn.com/stackone-60/YguWIuQZDU06Nn_w/connectors/agentmail/images/api-key-config-sign-in.png?fit=max\&auto=format\&n=YguWIuQZDU06Nn_w\&q=85\&s=f05eb57e5c97801c8133eeeff1706094)

**2. Open API Keys**

In the sidebar, click **API Keys**.

![The AgentMail Console dashboard with API Keys highlighted in the sidebar](https://mintcdn.com/stackone-60/YguWIuQZDU06Nn_w/connectors/agentmail/images/api-key-config-open-api-keys.png?fit=max\&auto=format\&n=YguWIuQZDU06Nn_w\&q=85\&s=57e0294fde7c2d9cfa5880f644e2c33a)

**3. Start a new key**

On the **API Keys** page, click **Create API Key**.

![The API Keys page with the Create API Key button highlighted](https://mintcdn.com/stackone-60/YguWIuQZDU06Nn_w/connectors/agentmail/images/api-key-config-create-api-key.png?fit=max\&auto=format\&n=YguWIuQZDU06Nn_w\&q=85\&s=aff0698b602213356ab90e9653e586ff)

**4. Configure and create the key**

In the **Create API key** dialog, name the key and keep its default scope and access.

<ul>
  <li>Name: `StackOne Integration`</li>
  <li>Leave **Expiration** set to **Never** so the key works until you delete it.</li>
  <li>Keep **Scope** set to **Entire organization** and **Access** set to **Full access within scope**, so StackOne can manage every inbox and domain in the organization.</li>
  <li>Click **Create**.</li>
</ul>

![The Create API key dialog with the Scope and Access summary and the Create button highlighted](https://mintcdn.com/stackone-60/YguWIuQZDU06Nn_w/connectors/agentmail/images/api-key-config-create-dialog.png?fit=max\&auto=format\&n=YguWIuQZDU06Nn_w\&q=85\&s=fbea04c5da27f6eea43f91c42bd9dcc4)

**5. Copy the key**

In the **API key created** dialog, click **Copy**, then paste the key into the **API Key** field in StackOne Hub.

<ul>
  <li>The key is only shown once and cannot be retrieved later. Store it securely for use later.</li>
  <li>Format: `am_us_` followed by 64 characters</li>
</ul>

![The API key created dialog with the Copy button highlighted and the key value hidden](https://mintcdn.com/stackone-60/YguWIuQZDU06Nn_w/connectors/agentmail/images/api-key-config-copy-key.png?fit=max\&auto=format\&n=YguWIuQZDU06Nn_w\&q=85\&s=1d65a8a1874e41cbd06d883f37a1cc5b)

## Select your API region

AgentMail runs separate US and EU environments. The **API Region** field in StackOne Hub tells StackOne which one your organization uses.

<ul>
  <li>Select **US (api.agentmail.to)** for organizations on the standard AgentMail service. Keys created there start with `am_us_`.</li>
  <li>Select **EU (api.agentmail.eu)** only if your organization was set up in AgentMail's EU environment, which is offered on the Enterprise plan.</li>
</ul>

## Linking the Account from the Hub

**1. Navigate to the Hub**

Use one of the three [Linking Account Methods](https://docs.stackone.com/connect/managing-connectors/linking-accounts.md) to access the Hub.

**2. Fill out the fields**

Fill out the following fields using details from your provider:

<ul>
  <li>**API Key**</li>
  <li>**API Region**</li>
</ul>

**3. Connect**

<ul>
  <li>Click **Connect**</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup</li>
</ul>

If the account linking is successful, you will see the newly linked account on your [Accounts](https://app.stackone.com/accounts) page.

## Next Steps

> **[Webhooks setup](https://docs.stackone.com/connectors/agentmail/guides/webhook-setup.md)**
>
> Configure receiving Events for AgentMail into StackOne.


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