Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 2.48 KB

File metadata and controls

87 lines (67 loc) · 2.48 KB
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.

Create a key

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.

Use the key

Pass the key when you create a client:

```python Python from polyvia import Polyvia

client = 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>"
Prefer not to hard-code it? Both SDKs also read the key from the `POLYVIA_API_KEY` environment variable — `export POLYVIA_API_KEY=poly_` and you can drop the `api_key` / `apiKey` argument.

Workspace scoping

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.

Manage & revoke

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.