npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pageindex/sdk

v0.6.0

Published

PageIndex SDK - Document processing for AI applications via REST API and MCP

Readme

@pageindex/sdk

TypeScript SDK for PageIndex document processing.

Get your API Key at dash.pageindex.ai. For full API documentation, see docs.pageindex.ai.

Installation

pnpm add @pageindex/sdk

Requires Node.js >= 18.0.0

Quick Start

import { PageIndexClient } from '@pageindex/sdk';

const client = new PageIndexClient({
  apiKey: 'your-api-key',
});

// Upload a document
const { doc_id } = await client.api.submitDocument(fileBuffer, 'report.pdf');

// List recent documents
const recent = await client.tools.recentDocuments();

// Extract document structure
const structure = await client.tools.getDocumentStructure({ docName: 'report.pdf' });

// Extract page content
const pages = await client.tools.getPageContent({ docName: 'report.pdf', pages: '1-5' });

With explicit resource management (TypeScript 5.2+):

await using client = new PageIndexClient({ apiKey: 'your-api-key' });
const recent = await client.tools.recentDocuments();
// connection closed automatically when scope exits

API

Client

const client = new PageIndexClient({
  apiKey: 'your-api-key',
  folderScope: 'folder-id', // optional, restricts all operations to this folder
});

When folderScope is set, all operations are restricted to the specified folder and its descendants. Per-call folderId can narrow within the scope (e.g. target a subfolder) but cannot access folders outside the boundary. Change it at runtime via client.setFolderScope(id).

Tools

All methods via client.tools:

| Method | Description | | ------------------------------------------------------------------------- | ------------------------ | | recentDocuments({ folderId?, cursor?, limit? }) | List recent uploads | | findRelevantDocuments({ query?, limit?, folderId?, cursor? }) | Search documents | | getDocument({ docName, waitForCompletion?, folderId? }) | Get document details | | getDocumentStructure({ docName, part?, waitForCompletion?, folderId? }) | Extract document outline | | getPageContent({ docName, pages, waitForCompletion?, folderId? }) | Extract page content | | getDocumentImage({ imagePath }) | Retrieve embedded image | | removeDocument({ docNames, folderId? }) | Delete documents | | createFolder({ name, description?, parentFolderId? }) | Create folder | | listFolders({ parentFolderId? }) | List folders |

Page specification formats: "5", "3,7,10", "5-10", "1-3,7,9-12"

API

All methods via client.api:

// Submit a document
const result = await client.api.submitDocument(file, 'document.pdf');

// Get document metadata
const doc = await client.api.getDocument(docId);

// List all documents
const docs = await client.api.listDocuments({ limit: 20, offset: 0 });

// Delete a document
await client.api.deleteDocument(docId);

// Chat completions
const chat = await client.api.chatCompletions({
  messages: [{ role: 'user', content: 'Summarize the document' }],
  doc_id: docId,
});

Error Handling

import { PageIndexError } from '@pageindex/sdk';

try {
  await client.tools.getDocument({ docName: 'xxx' });
} catch (e) {
  if (e instanceof PageIndexError) {
    // e.code: 'NOT_FOUND' | 'UNAUTHORIZED' | 'RATE_LIMITED' | 'USAGE_LIMIT_REACHED' | ...
    // e.statusCode: HTTP status code
  }
}

Documentation

Examples

See examples/chat-demo for Next.js + AI SDK integration.

License

MIT