How to collect API keys from clients securely

Every automation project starts with the same awkward message: can you send me your API key? It arrives in Slack or by email, and from then on a credential that can read your client's CRM sits in a chat history neither of you controls.

Updated · 5 minute read

What goes wrong with Slack and email

  • The key is copied into message history, notifications, backups and any forward
  • Everyone later added to the channel or the thread can read it
  • Nobody can say who has seen it, so nobody knows when it must change
  • One compromised inbox exposes every key ever sent to it
  • When the engagement ends, the key stays where it was pasted

None of this is exotic. It is simply what happens to a secret once it is written into a tool built for keeping messages.

Four ways to collect a credential

Ways to collect a client credential, compared
MethodStrengthsLimits
A one-time secret linkQuick, and nothing lingers in a chat. Password managers such as 1Password and Bitwarden can create links that expire.No record of what you hold, and you still paste the key into your tool by hand
A shared vault in a password managerA real inventory, with control over who can see whatThe client has to adopt it or be given a guest account, and workflows still need the key copied in
An OAuth connectionNo key changes hands, access is scoped and the client can revoke itOnly where both the service and your automation tool support it
A vault in the client portalThe client pastes the key once where they already sign in, and workflows read it when they runA portal has to exist, and the client has to log in to it

Use OAuth wherever it is offered. For everything else, the question is whether you hold a handful of keys, in which case a password manager is enough, or keys for many clients that workflows need at run time, in which case a vault your workflows can read from saves the copying.

Ask for the smallest key that works

  • A key or token scoped to what the workflow does, not full account access
  • A dedicated integration user where the service supports one, not the owner's own login
  • Never the account password
  • A key issued for your agency alone, so it can be revoked without breaking anything else

Store it encrypted and fetch it when needed

Wherever the key ends up, it should be encrypted at rest with an authenticated mode such as AES-256-GCM, with the encryption key kept apart from the data. After it is saved, screens should show a masked preview, never the value.

Have workflows read the key from that one place when they run, rather than pasting it into the credentials of every workflow that needs it. Then a rotation is one change, and the question “where is this key used?” has an answer.

Plan the day it has to change

A key should be replaced when someone with access leaves either company, after any suspected exposure, and on whatever schedule the client’s own policy sets. When the engagement ends:

  1. 1

    Delete every copy you hold

    The vault entry, and anything pasted into a tool along the way.

  2. 2

    Ask the client to revoke the key on their side

    Deleting your copy does not disable the key. Only the service that issued it can do that.

  3. 3

    Have your integration user removed

    If the client created a user for you, it should go too.

  4. 4

    Confirm it in writing

    One sentence saying what was deleted and when protects both of you later.

What to tell a security-conscious client

Answer five questions before they are asked: what you need and why, where it will be stored, who on your side can see it, how they change it, and how they take it away. A client who gets those in the first message tends not to ask a sixth.

Do not claim a certification you do not hold. Saying plainly which safeguards are in place and which are not is more convincing than a vague promise, and it is the answer you can still stand behind after an incident.

How RelayDeck handles it

In RelayDeck you list the credentials a client needs to provide, they paste each one into their portal, and it is encrypted with AES-256-GCM and shown only as a masked preview such as pat-••••8f2a afterwards. On Pro and Scale, workflows fetch a key from the vault when they run. What it does and does not do is set out in the client API key vault.

Give your clients a portal of their own.

No monthly fee for up to 3 clients. Invite your first client today.