What Is an API Key? A Beginner's Guide to Using and Protecting One
What is an API key? It is a secret code that lets an app or tool use another service on your behalf. When an automation platform sends a prompt to an AI model, reads your spreadsheet or posts to your CRM, it often uses an API key to prove who is asking and who should be billed. As more small businesses connect AI and automation tools, API keys have become everyday objects, and leaked keys have become a common, costly mistake. This guide explains what keys are, where you will use them, what they cost, and how to keep them safe.
APIs and keys in plain English
- An API (application programming interface) is a doorway that lets software talk to other software.
- An API key is the badge you show at that doorway.
When your tool makes a request, it includes the key. The service checks it, decides what you are allowed to do and records the usage for billing.
Where you will meet API keys
- AI models: connecting automation tools or apps to AI providers.
- Automation platforms: linking services that do not have built-in connections.
- Website tools: maps, forms, analytics and payment integrations.
- Data services: email marketing, CRMs and spreadsheets.
Many automation platforms handle connections with a simple sign-in instead of a key, but for some services, especially AI APIs, you will paste a key.
What is an API key going to cost you?
Creating a key is usually free. What costs money is usage through it. AI APIs typically charge per token, the units of text sent and received, with different prices for different models. For example, DeepSeek's API documentation lists per-million-token prices that differ by model and time of day.
Because usage is billed to whoever owns the key, a leaked key can let someone else run up your bill.
How to keep API keys safe
- Treat keys like passwords. Never share them in emails, chat messages or public documents.
- Never publish keys in website code, public repositories or screenshots.
- Use separate keys for different tools, so you can revoke one without breaking everything.
- Set spending limits or alerts in the provider's dashboard where available.
- Limit permissions if the service lets you restrict what a key can do.
- Store keys securely, for example in your automation platform's credential manager or a password manager.
- Rotate keys periodically and when someone with access leaves.
If a key leaks
- Revoke or rotate it immediately in the provider's dashboard.
- Create a new key and update the tools that use it.
- Check usage logs for unexpected activity.
- Contact the provider if you see fraudulent usage.
- Find the cause, such as a shared document or code commit, and fix it.
API keys in automation workflows
When you build workflows that call AI models, store the key in the platform's credentials section rather than pasting it into individual steps. That keeps it hidden and makes rotation easier. For platform choices, see our Zapier vs Make vs n8n comparison, and for a hands-on start, our n8n tutorial for beginners. For an AI-heavy example, see our guide to building an AI agent with n8n.
API keys vs subscriptions
A consumer AI subscription, such as a monthly chat plan, is separate from API access. API usage is usually billed separately, per use. If you only chat in an app, you do not need an API key. You need one when connecting tools or building your own workflows. For budgeting, see what AI automation costs.
Team practices
- One owner for each key and service.
- A simple register of keys: service, purpose, owner and where it is used, never the key itself.
- Remove access when people leave.
- Review usage monthly.
Example: connecting an AI model to an automation
A small agency wants new support emails summarized and tagged automatically:
- The owner creates an API key in the AI provider's dashboard and names it after the workflow.
- They set a monthly spending limit and an email alert in the dashboard.
- In their automation platform, they add the key once in the credentials section.
- The workflow sends each new email to the AI model for a summary and tag, then posts the result to the team's chat.
- Each month, they check usage and confirm it matches expectations.
If the key ever leaks, they revoke it, create a new one, and update only that credential.
Common mistakes
- Pasting keys into shared documents or team chats.
- Using one key everywhere, so a leak affects every tool.
- No spending limits, so a leak or bug creates a large bill.
- Forgetting old keys for tools you no longer use.
- Putting keys in website code, where anyone can view them.
Questions to ask before creating a key
Which tool needs it, and why? Who owns it? What is the spending limit? Where will it be stored? When will it be reviewed? Answering these five questions keeps keys under control as your business adds more tools.
API keys and AI agents
AI agents and coding tools sometimes ask for API keys to connect to other services. Be cautious: an agent with a powerful key can take actions you did not intend if it is misled by malicious content. Give agents keys with the narrowest permissions possible, set spending limits, and require approval for sensitive actions such as sending money or deleting data.
Free tiers and trial credits
Some providers offer free trial credits or free tiers on their APIs. They are useful for testing, but set limits before connecting a key to an automation that runs constantly, since usage can climb quickly once a workflow is live.
FAQ
What is an API key in simple terms?
It is a secret code that identifies you or your app when using a service's API, so the service knows who is making requests and who to bill.
Is an API key the same as a password?
It works similarly: anyone who has it can act as you on that service. Treat it with the same care as a password.
Why do automation tools ask for an API key?
To connect to another service on your behalf, such as sending prompts to an AI model or reading data from an app.
Do API keys cost money?
The key itself is free, but usage through it may be billed. AI APIs usually charge per token, so a leaked key can create unexpected bills.
What should I do if my API key leaks?
Revoke or rotate it immediately in the provider's dashboard, create a new key, update your tools and check usage for unexpected activity.
Conclusion
What is an API key? A secret badge that lets tools use other services on your behalf, and a direct line to your bill. Store keys securely, never share or publish them, set spending alerts, use separate keys per tool, and rotate them immediately if anything leaks.
Sources and methodology
Explainer based on common API practice. The per-token pricing example refers to DeepSeek's API pricing documentation (https://api-docs.deepseek.com/quick_start/pricing), verified 14 October 2026. No statistics are claimed.