# Flexmail — Email Marketing API: connection

> Canonical URL: https://developers.apideck.com/apis/email-marketing/flexmail/connection

# How to Connect to Flexmail

To connect Flexmail, you enter two values from your own Flexmail account in Apideck Vault: your
numeric **Account ID** and a **Personal Access Token**. You then tell Vault which Flexmail custom
field holds company names, because Flexmail contacts have no built-in company field.

## Prerequisites

- A Flexmail account on a plan that includes API access.
- Access to **Settings > API > Personal access tokens** in Flexmail, so you can create a token.
- **A custom field for company name.** Before you connect, make sure your Flexmail account has a
  custom field that stores (or will store) the company name of your contacts, for example a text
  field called `Company`. Vault asks you to pick this field during setup, and the list only shows
  custom fields that already exist in your account.

## Step 1: Create a Personal Access Token

1. Log in to Flexmail.
2. Open **Settings > API > Personal access tokens** and create a new token. Give it a name you will
   recognise later, for example `Apideck`.
3. Copy the token and store it somewhere safe. Treat it like a password. If the token is only
   shown once in your account, create a new one should you lose it.

Flexmail documents where tokens are managed in its
[email marketing API documentation](https://api.flexmail.eu/documentation/).

## Step 2: Find your Account ID

Your Account ID is a **number**. It is not your email address and not your Flexmail login name.

It is typically shown in your Flexmail account settings; if you cannot find it, check
**Settings > General** or ask Flexmail support.

## Step 3: Connect in Apideck Vault

1. In Vault, select Flexmail and open the connection settings.
2. Fill in the fields:

   | Field | Required | What to enter |
   |-------|----------|---------------|
   | **Account ID** | Yes | Your numeric Flexmail account ID from Step 2. |
   | **Personal Access Token** | Yes | The token you created in Step 1 (not your Flexmail login password). |
   | **Contact source** | No | The Flexmail source that is recorded on contacts created through this connection. The list is loaded from the sources in your Flexmail account. |

3. Click **Save**. Apideck checks the connection by listing contacts from your Flexmail account.

## Step 4: Choose the company-name custom field

For both the **Contacts** and the **Leads** resource, Vault shows a required dropdown called
**Custom Field for Company name**. The options are loaded live from the custom fields in your
Flexmail account.

1. For **Contacts**, select the custom field that holds the company name (for example `Company`).
2. For **Leads**, select the same field (or another one, if you store it elsewhere for leads).
3. Save your settings.

Once set, Apideck writes the company name into that custom field when it creates or updates a
contact or lead, and reads the company name back from the same field.

## Notes

- **Account ID versus email.** Flexmail's API login uses the numeric Account ID as the username.
  Entering your email address instead is the most common reason a connection fails.
- **Token versus password.** The token from **Settings > API > Personal access tokens** is what
  Vault needs. Your Flexmail login password does not work here.

## Troubleshooting

**The connection fails with an authentication error (HTTP 401).**
The Account ID or token is wrong. Check that:

- the **Account ID** field contains your numeric account ID, not your email address;
- the **Personal Access Token** field contains the token, not your login password;
- neither value has leading or trailing spaces.

The 401 section of Flexmail's
[troubleshooting article](https://en.support.flexmail.eu/article/1373-transactional-email-troubleshooting) describes the same Account ID and token checks.
If the values look right and the error persists, create a new token and try again.

**A request fails with "not included in your current plan" (HTTP 403).**
Your Flexmail plan does not include the data or feature being requested. Check your plan with
Flexmail, or upgrade to a plan that includes it.

**The Custom Field for Company name dropdown is empty.**
Vault lists the custom fields that exist in your Flexmail account, so an empty list usually means
the account has no custom fields yet. Create one in Flexmail (for example a text field called
`Company`), then reopen the connection settings in Vault and select it. The list may appear empty
without an error message, so check your Flexmail custom fields first.

**The Contact source dropdown is empty.**
This setting is optional. The list shows the sources in your Flexmail account; if there are none,
you can leave it blank and still connect.

For anything else, contact [Apideck Support](https://help.apideck.com/en/articles/7774658).


[API reference](https://developers.apideck.com/apis/email-marketing/reference.md) · [Coverage matrix](https://developers.apideck.com/apis/email-marketing/coverage)
