Admin API
Programmatically create and list workspaces with your account secret key.
Use @galya/admin when you need to provision workspaces from a script or CI pipeline—not from the dashboard UI.
Prerequisites
- Sign in to the Galya dashboard.
- Open Settings and copy your account secret key (
galya_sk_…). - Deploy Convex and galya-api with admin routes enabled (same deployment as production API).
Admin routes accept only account secret keys. Workspace keys and publishable keys are rejected.
Install
npm install @galya/adminCreate a workspace
import { GalyaAdminClient } from "@galya/admin";
const admin = new GalyaAdminClient({
apiKey: process.env.GALYA_ACCOUNT_SECRET_KEY!, // galya_sk_…
});
const ws = await admin.createWorkspace({ name: "Acme Travel" });
console.log(ws.public_id); // ws_…
console.log(ws.workspace_api_key); // galya_… — shown once; store securely
console.log(ws.turbopuffer_namespace);createWorkspace schedules Turbopuffer namespace provisioning server-side so you can index content shortly after creation.
List workspaces
const { workspaces } = await admin.listWorkspaces();
for (const w of workspaces) {
console.log(w.public_id, w.name, w.api_key_prefix);
}Upload catalog content
After creating a workspace, use @galya/agents to index entities. Either pass the workspace API key returned at creation, or reuse your account secret with the workspace id:
import { GalyaApiClient } from "@galya/agents";
// Option A — workspace key from createWorkspace
const api = new GalyaApiClient({ apiKey: ws.workspace_api_key });
// Option B — account secret + workspace public id
// const api = new GalyaApiClient({
// apiKey: process.env.GALYA_ACCOUNT_SECRET_KEY!,
// workspaceId: ws.public_id,
// });
await api.index({
type: "image",
content: { url: "https://example.com/hero.jpg" },
});See Agents for search, clusters, and batch indexing.
HTTP reference
| Method | Path | Auth |
|---|---|---|
POST | /v1/admin/workspaces | X-API-Key: galya_sk_… |
GET | /v1/admin/workspaces | X-API-Key: galya_sk_… |
No X-Galya-Workspace-Id header on admin routes. Full schemas are in openapi.yaml under the Admin tag.