| title | How to get API key |
|---|---|
| description | Create, use, and manage your Polyvia API key |
| icon | key |
Every request to the Polyvia API is authenticated with an API key. Here's how to create one, use it, and keep it scoped correctly.
Open the **Polyvia Platform** and sign up or log in. Click **API** in the sidebar, then **Create API Key**, give it a name, and optionally set an expiry date. The key is shown **only once** — copy it now and store it somewhere safe. All keys start with `poly_`. Keep your API key secret. Never commit it to a repo or expose it in client-side code. If a key leaks, revoke it on the **API** page and mint a new one.Pass the key when you create a client:
```python Python from polyvia import Polyviaclient = Polyvia(api_key="poly_")
```ts TypeScript
import { Polyvia } from "polyvia";
const client = new Polyvia({ apiKey: "poly_<key>" });
curl https://app.polyvia.ai/api/v1/usage \
-H "Authorization: Bearer poly_<key>"Each key is bound to one workspace at the moment you create it — your personal workspace or a specific organization — and only ever reads and writes that workspace's data.
- Mint a key in your personal workspace → it sees your personal documents, groups, and chats only.
- Mint a key in an organization → it sees that org's shared documents and groups; any teammate's key minted in the same org reads the same data.
To work across workspaces, switch workspace and create a separate key for each.
Switching your *active* workspace in the UI later does not change what an existing key can access — the binding is permanent. Revoke and re-mint to change scope.Return to the API page any time to see your keys, their names and expiry, and to delete (revoke) a key. Revocation takes effect immediately.
Have your key? Ingest your first batch and query it in a couple of minutes.