Reference
JavaScript SDK (@arovi/pagekit-core)
Install:
bash
pnpm add @arovi/pagekit-core
typescript
import { Pagekit } from "@arovi/pagekit-core";
const blog = new Pagekit({
apiKey: process.env.PAGEKIT_API_KEY!,
});
Configuration
typescript
const blog = new Pagekit({
apiKey: process.env.PAGEKIT_API_KEY!,
baseUrl: "https://api.pagekit.app/v1", // override when self-hosting
timeout: 30000,
fetch: customFetch, // for tests / non-standard runtimes
headers: { "X-Custom": "value" },
});
Resources
typescript
await blog.posts.list({ status: "published", sort: "-published_at" });
await blog.posts.get("post_123");
await blog.posts.getBySlug("building-ai-agents");
await blog.posts.create({ title: "Hello", content: "# Hi" });
await blog.posts.update("post_123", { status: "published" });
await blog.posts.delete("post_123");
await blog.authors.list();
await blog.authors.getBySlug("jane-doe");
await blog.authors.create({ name: "Jane Doe", bio: "Editor" });
await blog.authors.update("author-id", { bio: "Senior editor" });
await blog.categories.list();
await blog.categories.getBySlug("engineering");
await blog.tags.list();
await blog.media.list();
await blog.media.create({ url: "...", filename: "...", mimeType: "image/png", size: 1024 });
await blog.media.delete("media-id");
Errors
typescript
import { PagekitError } from "@arovi/pagekit-core";
try {
await blog.posts.get("missing");
} catch (error) {
if (error instanceof PagekitError) {
error.status; // 404
error.code; // "not_found"
error.isAuthError; // false
error.isRateLimited; // false
error.isServerError; // false
}
}
The client uses the global fetch — Node 18+, Bun, Deno, and browsers all work.
Pass timeout (default 30s) or a custom fetch implementation if needed.
Python Equivalent
See pagekit-core on PyPI for the Python client:
python
from pagekit import Pagekit
client = Pagekit(api_key="pk_live_...")
page = client.posts.list(status="published")