Netlify personal access tokens are created under Applications → Personal access tokens (app.netlify.com/user/applications#personal-access-tokens) with New access token. You set an expiration, and the token cannot be viewed again after you leave the page. In CI, store it as NETLIFY_AUTH_TOKEN.
Netlify key types
| Type | Prefix | Secret? | Scope | Expiry |
|---|---|---|---|---|
| Personal access token (PAT) Resetting your Netlify password permanently invalidates all PATs and OAuth tokens created before the reset. | — | Yes | Your user's access to Netlify; denied SAML-based team access unless you tick the SAML option when generating | You select an expiration date when generating |
| OAuth application client secret Register under OAuth applications in user settings to get a client key and client secret. Meant for public integrations. | — | Yes | Users authorize your app via OAuth2 | — |
How to create a Netlify key
- Go to Applications → Personal access tokens.
- Select New access token and enter a descriptive name.
- Optionally select Allow access to my SAML-based Netlify team.
- Select an Expiration date, then Generate token.
- Copy the token and store it safely, then select Done.
Limiting what the key can do
Netlify personal access tokens have no scope selector; they act as your user. Narrow exposure by setting a short expiration, and by using a dedicated user for automation. Teams that require SAML SSO deny PATs team access by default unless you select the SAML option while logged in with SSO.
How to rotate a Netlify key
- Generate a new personal access token.
- Update
NETLIFY_AUTH_TOKENin your CI and local environments. - Delete the old token under Personal access tokens → Options → Delete personal token.
Tokens expire on the date you chose, so rotation is also needed before expiry.
How to revoke a Netlify key
- Go to Applications → Personal access tokens.
- Choose Options → Delete personal token for the token.
If your Netlify key leaked
- Delete the exposed token under Personal access tokens.
- Generate a replacement and update CI secrets.
- Resetting your password invalidates all tokens created before the reset, if you cannot identify the exposed one.
Environment variables and CLI
Netlify's SDKs and docs read the key from NETLIFY_AUTH_TOKEN or NETLIFY_SITE_ID.
Netlify CLI (netlify): netlify login opens a browser to authorize Netlify CLI; in CI set NETLIFY_AUTH_TOKEN
Things that catch people out
- The token cannot be viewed again after you leave the generation page.
NETLIFY_SITE_IDis the site's Project ID, found under Project configuration → General → Project details.- A password reset invalidates every earlier PAT and OAuth token, which can silently break CI.
Using your Netlify key with AI agents
A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.
BotPassword works this way. For a Netlify key, these intents fit:
| Intent | What BotPassword does |
|---|---|
list_credentials | Lists the credentials this agent is granted and what it may do with each. Never values. |
run_with | Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output. |
http_request | Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused. |
cli_login | Lets git, Docker, the AWS CLI and kubectl log in through bpw's credential helper, so the token is fetched when the tool needs it and not written into its config. The helper hands the value to the tool, so the grant is always disclosing. Other tools use run_with; OAuth device logins are planned. |
rotate | Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet. |
store_secret | Saves a value the agent already holds as a new vault item. |
Netlify also publishes its own MCP server. Whatever server the agent uses, keep the credential it authenticates with out of the agent's context.
Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents
Frequently asked questions
Where do I find my Netlify personal access token?
You can't view it after creation. Generate one at Applications → Personal access tokens and copy it before leaving the page.
What is NETLIFY_AUTH_TOKEN?
It is the environment variable the Netlify CLI reads in CI, holding a personal access token.
How do I delete a Netlify personal access token?
Under Personal access tokens choose Options → Delete personal token.
Why did my Netlify tokens stop working?
Resetting your Netlify password permanently invalidates all personal access and OAuth tokens created before the reset.
Can an AI agent use my Netlify key without seeing it?
Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a .env file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with list_credentials, run_with, http_request, so the agent gets the result and never the value.