Skip to main content
Developers

SDKs: Choosing a Client (TypeScript, .NET, Python)

Official Papyrus SDKs in TypeScript, .NET, and Python. When to use each, what they include, and the install commands.

SDKs: Choosing a Client (TypeScript, .NET, Python)

You don't need an SDK — the API is plain HTTP — but the SDKs save you from re-implementing pagination, retries, signature verification, and type definitions.

Available SDKs

Language Package Status
TypeScript @papyrus-io/sdk GA
.NET (C#) Papyrus.Sdk (NuGet) GA
Python papyrus-sdk (PyPI) Beta
Go Roadmap
Java Roadmap

TypeScript / Node.js

npm install @papyrus-io/sdk
import { PapyrusClient } from '@papyrus-io/sdk';

const client = new PapyrusClient({
  baseUrl: 'https://yourtenant.papyrus.io',
  apiKey: process.env.PAPYRUS_API_KEY!,
  tenantSlug: 'yourtenant'
});

// Upload
const doc = await client.documents.upload({
  file: createReadStream('invoice.pdf'),
  folderId: 'f47...',
  tags: ['invoice', 'q2']
});

// Search
const results = await client.search.query('contracts expiring next quarter');

// Q&A
const answer = await client.search.qa({
  question: 'What is our total exposure with Acme?'
});

// Webhook signature verification
const isValid = client.webhooks.verifySignature(
  request.headers['x-papyrus-signature'],
  request.rawBody,
  webhookSecret
);

.NET (C#)

dotnet add package Papyrus.Sdk
using Papyrus.Sdk;

var client = new PapyrusClient(new PapyrusClientOptions
{
    BaseUrl = "https://yourtenant.papyrus.io",
    ApiKey = Environment.GetEnvironmentVariable("PAPYRUS_API_KEY")!,
    TenantSlug = "yourtenant"
});

// Upload
using var stream = File.OpenRead("invoice.pdf");
var doc = await client.Documents.UploadAsync(new UploadRequest
{
    Stream = stream,
    FileName = "invoice.pdf",
    FolderId = folderId,
    Tags = new[] { "invoice", "q2" }
});

// Search
var results = await client.Search.QueryAsync("contracts expiring next quarter");

// Q&A
var answer = await client.Search.QaAsync(new QaRequest
{
    Question = "What is our total exposure with Acme?"
});

Python

pip install papyrus-sdk
from papyrus_sdk import PapyrusClient

client = PapyrusClient(
    base_url="https://yourtenant.papyrus.io",
    api_key=os.environ["PAPYRUS_API_KEY"],
    tenant_slug="yourtenant"
)

# Upload
with open("invoice.pdf", "rb") as f:
    doc = client.documents.upload(
        file=f,
        folder_id="f47...",
        tags=["invoice", "q2"]
    )

# Search
results = client.search.query("contracts expiring next quarter")

# Q&A
answer = client.search.qa(question="What is our total exposure with Acme?")

What the SDKs handle for you

  • Authentication header injection
  • Tenant header injection
  • Automatic retries with exponential backoff on transient errors (429, 5xx)
  • Cursor-based pagination iterators
  • Webhook signature verification
  • Typed responses (full IntelliSense in TS / C#)
  • Resumable uploads for large files
  • Connection pooling

What you still need to handle

  • Credentials storage (env vars, secret managers — not the SDK's responsibility)
  • Business logic
  • Webhook handler endpoint (you provide the HTTP server)
  • Idempotency keys for mutations you want safely retriable

Source

All SDKs are open-source. Issues and PRs welcome on GitHub at github.com/papyrus-io/sdk-<language>.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.