Developers should store credentials for a LinkedIn profile API the same way they store a database password: outside the code, in an environment variable or a secret manager, loaded by the process that makes the call. For ProfileHunt the only credential is a workspace API key (ph_live_…), so the job is keeping one string out of repositories, images, logs and shared workflows, and knowing what to do the day it leaks. This post goes place by place: local development, production, CI, containers and no-code tools. For what the API does with the key, start with what a LinkedIn profile API is.
Key takeaways
- One variable name everywhere. Read the key from
PROFILEHUNT_KEYin every environment, so code never changes when the storage does. - Local: a
.envfile listed in.gitignore. Commit a.env.examplewith the name and no value. - Production: your platform's secret store. A secret manager or your host's encrypted environment variables, injected at runtime.
- No-code tools: one key per tool. n8n keeps it in a Header Auth credential; in Make, Zapier and Clay it sits in a header that the workflow's editors can see.
- After a leak: revoke first. Deleting the commit doesn't un-leak a key. Revoking it on the Keys page does, from the next request on.
What you are protecting
A ProfileHunt key starts with ph_live_. It authenticates requests for one workspace and spends that workspace's shared credits. It can't sign in to the dashboard, change members or buy credits; those need a signed-in owner or admin.
Add ph_live_ as a pattern to your secret scanner, pre-commit hook or log filter to catch a key that slips into a diff or a log line. The mechanics of sending the key, Authorization: Bearer or x-api-key, are covered in how to authenticate with an API key.
Local development: .env and .gitignore
For local work, keep the key in a .env file at the project root and make sure git never sees it.
# .env (never committed)
PROFILEHUNT_KEY=ph_live_...
# .gitignore
.env
.env.*
!.env.example
# .env.example (committed, no value)
PROFILEHUNT_KEY=
Your code reads the variable and nothing else, for example os.environ["PROFILEHUNT_KEY"] in Python or process.env.PROFILEHUNT_KEY in Node.js. Add .env to .gitignore before the first commit; a file that git already tracks keeps being tracked even after you ignore it.
Use a key named dev here, never the production key, so a lost laptop costs one revocation.

Production: where the key should live
In production, the key comes from a secret store and lands in the process environment at runtime. Which store depends on where you run.
| Where you run | Store the key in | Watch out for |
|---|---|---|
| A cloud VM or container platform | The provider's secret manager (AWS Secrets Manager, Google Cloud Secret Manager, Azure Key Vault) or HashiCorp Vault | Grant read access to the service's identity only |
| Vercel, Netlify, Render and similar | The project's environment variables | Never give the variable a public prefix that the build inlines into client code |
| Docker | Runtime injection: docker run --env-file, or your orchestrator's secrets | ENV and ARG in a Dockerfile, or a copied .env, end up in image layers |
| A cron job or script on a server | An environment file readable only by the job's user | Shell history, if you export the key by hand |
The OWASP Secrets Management Cheat Sheet goes deeper on access control and auditing for secret stores. The architecture around the key, a backend proxy and one key per environment, is in the secure API authentication pattern.
CI pipelines
CI systems have their own encrypted secrets. In GitHub Actions, add PROFILEHUNT_KEY as a repository or environment secret and map it into the step that needs it:
- name: Enrichment smoke test
env:
PROFILEHUNT_KEY: ${{ secrets.PROFILEHUNT_KEY }}
run: |
curl -s -o /dev/null -w "%{http_code}\n" -X POST \
https://api.profilehunt.dev/v1/profile \
-H "Authorization: Bearer $PROFILEHUNT_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://www.linkedin.com/in/williamhgates" }'
That smoke test prints 200 when the key is valid and 401 when it isn't. It uses one credit only when the profile is found, $0.0005 a run. Give CI its own key named ci, map the secret only into the steps that use it, and never echo it.
No-code tools: n8n, Make, Zapier and Clay
In automation tools, the key goes into the request header the tool sends. Where that header is stored differs by tool.
| Tool | Where the key goes | Who can see it |
|---|---|---|
| n8n | HTTP Request node, Authentication: Generic Credential Type, Header Auth, Name Authorization, Value Bearer <key> | Stored as a credential, separate from the workflow itself |
| Make | HTTP "Make a request" module, a header Authorization: Bearer <key> | Anyone who can edit the scenario |
| Zapier | Webhooks by Zapier POST step, under Headers | Anyone who can edit the Zap |
| Clay | HTTP API enrichment, a header Authorization: Bearer <key> | Anyone who can edit the table's column |
In n8n the workflow references the credential instead of holding the key. In the other three the key is part of the step's settings, so treat every editor of that scenario, Zap or table as someone who holds the key.
The rule for all four is the same: one key per tool, named after it. If a shared Make scenario leaks its key, you revoke make and nothing else breaks. The n8n, Make, Zapier and Clay guides have the full setup for each.
What Most Guides Get Wrong About Storing API Keys
"Removing the key from the repo fixes the leak." Git history, forks, clones and CI caches keep the old commit. Once a key has been pushed anywhere shared, revoke it. Cleaning history is tidy-up, not the fix.
"Secrets in environment variables can't leak." They leak through logs. Error trackers and HTTP debug logging often capture request headers. Redact Authorization and x-api-key in your logger, and scan logs for ph_live_.
"One key for everything is simpler." It is simpler until the day you revoke it. Keys are free to create, and every key draws from the same workspace credits, so one per environment and tool costs nothing.
Myth vs Reality
| Myth | Reality |
|---|---|
| A private repository is a safe place for a key. | Private repos get cloned to laptops, CI runners and contractors' machines. Keep the key out of every repo. |
| Base64-encoding the key protects it. | Base64 is an encoding, not encryption. Anyone can decode it. |
| You must save the key somewhere the moment you create it, or lose it. | Workspace owners and admins can copy a ProfileHunt key again from the Keys page. A password manager is fine; a sticky note in the repo isn't. |
| A leaked key means a leaked LinkedIn account. | ProfileHunt never uses a LinkedIn account, so a leaked key exposes credits, not a LinkedIn login. See enrichment without login credentials. |
| Keys need regular scheduled rotation to stay safe. | Fast revocation matters more than a calendar. Rotate on events: a leak, a departure, a retired system. |

What to do after a key leaks
When a key shows up somewhere it shouldn't, work through these four steps in order. An owner or admin of the workspace does them on the dashboard.
Step 1: Revoke the leaked key
On the Keys page, click Revoke next to the key. It fails with 401 from the next request on. Do this first, before cleaning anything up.
Step 2: Create and deploy a replacement
Create a new key with the same role in its name, update the secret store or tool that held the old one, and redeploy. If several systems shared the leaked key, give each its own key now.
Step 3: Review what the key did
Open the Usage page. It lists every request from the last 30 days with its status, and each request's detail shows which key made it. Look for traffic from the leaked key that your systems didn't send. If something looks wrong, email the request IDs (req_…) to support@profilehunt.dev.
Step 4: Clean up the source
Remove the key from wherever it leaked: the commit, the log, the shared workflow, the chat message. Then add the ph_live_ pattern to your scanner so the same path is caught next time. Anything done with a key is the workspace's responsibility under the Terms, which is why revocation comes first.
Advanced: Keeping Keys Out of Places Nobody Checks
Experienced teams find leaked keys in the same handful of unexpected places. Check these once your basics are in order.
- Shell history. A key typed into
exportby hand stays in your shell history. Load it from a file. - Notebooks. A Jupyter cell that prints a request object stores the header in the notebook's saved output. Clear outputs before committing.
- AI agent transcripts. If a model ever sees the key, it can repeat it. Keep the key in the agent's HTTP tool configuration and let the model supply only the profile URL; see AI agents.
- HTTP client collections. Postman and Insomnia collections exported with the key inline carry it to everyone they're shared with. Use a collection variable and leave its value out of the export.
- Container images.
docker historyshowsENVandARGvalues. Rebuild any image that ever had the key baked in, and revoke that key.
Where ProfileHunt Fits
ProfileHunt is a LinkedIn Profile API: a public LinkedIn profile URL in, JSON out. There is exactly one credential to store, a workspace API key, with any number of named keys per workspace, a ph_live_ format scanners can match, per-key usage history and one-click revocation on the Keys page. ProfileHunt never uses your LinkedIn account, cookie or Sales Navigator seat, so there is no LinkedIn session to protect.
Getting Started
Sign in to get a workspace with a Default key and free credits: 100 with a work email, 10 with a personal one. Create one named key per environment and tool and keep the authentication docs handy. To see how the key fits the rest of the API, read what a LinkedIn profile API is.
Frequently asked questions
Where should I store my API key in a Node.js or Python project?
In a .env file that is listed in .gitignore for local work, read through process.env.PROFILEHUNT_KEY or os.environ["PROFILEHUNT_KEY"]. In production, load the same variable from your platform's secret manager or encrypted environment variables.
Is it safe to put an API key in a .env file?
Yes for local development, as long as .env is in .gitignore before your first commit and the key is a development key. For production, use a secret manager or your host's encrypted environment variables instead of a file on disk.
How do I store an API key in n8n?
Create a Header Auth credential in the HTTP Request node with Name Authorization and Value Bearer followed by your key. The workflow references the credential, so the key isn't part of the workflow itself. The n8n integration guide has the full setup.
What should I do if my API key was pushed to GitHub?
Revoke it on the ProfileHunt Keys page right away, create a new key and deploy it, then check the Usage page for requests you didn't make. Removing the commit afterwards is clean-up; revoking is what stops the key working.
Can someone access my LinkedIn account with a leaked profile API key?
Not with a ProfileHunt key. ProfileHunt never uses a LinkedIn account, so a leaked key can only run profile lookups against your workspace's credits until you revoke it.


