TypeScript SDK for the Paragraph API. Used to interact with Paragraph posts, users, coins, & more.
yarn add @paragraph-com/sdkimport { ParagraphAPI } from "@paragraph-com/sdk";
// For public endpoints
const api = new ParagraphAPI();
const post = await api.posts.get({ id: "postId" });
// For protected endpoints (creating posts, managing subscribers)
const apiWithAuth = new ParagraphAPI({ apiKey: "your-api-key" });
const newPost = await apiWithAuth.posts.create({
title: "My Post",
markdown: "# Hello World",
});Several endpoints require an API key, which identifies your publication. Pass it when creating the client:
const api = new ParagraphAPI({ apiKey: "your-api-key" });
// Get your publication info
const publication = await api.me.get();
// List your drafts
const { items: drafts } = await api.posts.list({ status: "draft" });
// Update a post
await api.posts.update({
id: "postId",
title: "Updated Title",
markdown: "## New content",
status: "published",
});
// Delete a post
await api.posts.delete({ id: "postId" });See the API reference for detailed documentation & a playground.
See autogenerated TypeScript docs for all available methods.