API key
An API key is a unique secret string an application sends with each API request to identify itself and prove it is allowed to use the service.
Also called: API token, secret key, access key, private app token
An API key is a secret string an app sends with each request to identify itself and prove it's allowed to call an API. Enrichment providers, sequencers, email verifiers and AI models mostly hand you a key on signup. It's the simplest way to authenticate, and also the easiest to leak, which is why how you store and scope keys matters as much as the integration itself.
How it works
You generate a key in the provider's dashboard. Your workflow sends it with every request, usually in a header:
Authorization: Bearer <key>- or a custom header such as
x-api-key: <key>
The provider looks up the key, confirms it's active, checks what it's allowed to do and bills usage to your account. Some providers let you set scopes (read only, specific endpoints), IP allowlists or expiry dates. Others issue one all-powerful key per account.
Unlike OAuth, an API key usually isn't tied to a person and doesn't expire on its own. That makes it convenient for server-side jobs and dangerous when copied somewhere public. Anyone holding the key can act as you until you revoke it.
Example
Say your enrichment API account holds 50,000 data credits at $0.10 each (assumption). That key is effectively a $5,000 gift card. If it lands in a public repo or a shared doc and someone scripts against it, the balance can drain in hours.
Now say you'd issued separate keys per workflow: one for inbound enrichment, one for the weekly account refresh, one for the outbound list builder. When credits spike, you see which key did it, revoke just that one and the other two workflows keep running. Five minutes of setup turns a full outage into a single, traceable fix.
How to manage API keys
- One key per integration. Name it after the workflow that uses it so usage is traceable.
- Least privilege. Pick read-only or narrow scopes where the provider allows it.
- Store keys in a vault. Use your automation tool's credential store, environment variables or a secrets manager. Reference them; never paste them into steps.
- Keep keys out of version control. Add env files to
.gitignoreand scan repos for secrets. - Rotate on a schedule and whenever someone with access leaves.
- Set spend alerts on credit-based tools so abuse shows up fast.
API key vs OAuth
Use an API key for machine-to-machine jobs where the vendor offers nothing else, such as enrichment, verification or model calls. Use OAuth for connecting user accounts like CRMs, inboxes and calendars, where scoped, revocable, identity-linked access matters. Some CRMs offer a middle path, such as private app tokens, which behave like scoped API keys.
Common mistakes
- Sharing one key across every workflow and teammate.
- Pasting keys into Slack threads, Notion pages or spreadsheet cells.
- Calling a paid API straight from website JavaScript, which exposes the key to every visitor.
- Committing a key to Git, then deleting it in a later commit while it stays in history.
- Never rotating keys after a contractor or employee leaves.
FAQ
Where should you store API keys?
Store them in a secrets manager, your hosting platform's environment variables, or the credential vault inside your automation tool. Never paste them into spreadsheets, Slack, shared docs, front-end code or a Git repository.
What should you do if an API key leaks?
Revoke or rotate the key immediately in the provider's dashboard, then update every workflow that used it. Afterward, check usage logs and credit balances for unexpected activity and find out how it leaked so it doesn't happen again.
Are API keys secure?
They're secure enough when stored properly, scoped narrowly and rotated, but they're bearer secrets: whoever holds the key can use it. That's why OAuth is preferred for user-level access and why a leaked key needs to be revoked right away.
Related
Used in these articles
- ArticleAI Agent Guardrails: How to Let GTM Agents Act Without Burning Your Pipeline
- ArticleClaude Code for Marketers: A Hands-On Guide to the Terminal Agent
- ArticlePython for GTM Engineers: The Scripts That Cover 80% of the Job
- ArticleVibe Coding for Marketers: What to Build, What to Skip and How to Stay Safe
- ArticleAPIs for GTM Teams: What You Need to Know Before You Build
- ArticleWebhooks for Marketers: A Plain-English Guide