Authentication & API Keys¶
Every request to the Potpie API requires an API key passed via the x-api-key header.
Generate an API key¶
- Sign in to the dashboard at app.potpie.ai.
- Click the account menu in the bottom-left corner and select Settings.
- In the API Key section, click + Generate API Key.
- Copy the key and store it securely.
Warning
Treat your API key like a password. It grants access to your repositories, agents, and conversations. Store it in a secret manager or environment variable — never commit it to source control.
Use the key¶
Pass the key in the x-api-key header on every request:
A convenient pattern is to export it once per shell session:
export POTPIE_API_KEY="sk-..."
curl -X GET http://localhost:8001/api/v2/projects/ \
-H "x-api-key: $POTPIE_API_KEY"
CLI vs. API authentication¶
There are two distinct auth surfaces — don't confuse them:
| Use case | How to authenticate |
|---|---|
Using the potpie CLI / agent harness |
potpie login (browser session) or potpie login --api-key sk-... |
| Calling the REST API directly (curl, scripts, services) | x-api-key header with a key generated in the dashboard |
For CLI login details, see CLI Commands → Authentication.
Next steps¶
- API Reference → Overview — the full endpoint walkthrough
- Tutorials — hands-on usage