Skip to main content

Getting Started

SDK@techwriter/sdk-corev3.2.0STABLE

Getting started with the SDK

The TechWriter SDK is a typed, batteries-included client for managing documentation programmatically. It wraps the public REST API with idiomatic helpers in nine languages, retries and pagination handled for you, and a single configuration surface across runtimes.

In production it powers content pipelines that publish thousands of articles a day — but the same library is just as comfortable in a tiny script that exports your knowledge base for backup. This page walks you through installation, configuration, the core domain model, and your first successful request.

Pick your language in the panel on the right. Every code block on this page rerenders for the package manager you choose, so the install command, the client initialization, and the first call always match your stack.

Requirements

The SDK supports nine runtimes. Older versions may work but are not officially tested.

RuntimeMin versionNotes
Node.js18.0ES modules and CommonJS both supported. Bundled TypeScript types.
Python3.9Sync and async clients ship in the same package.
Ruby3.0Frozen-string-literal compatible. Thread-safe by default.
PHP8.1PSR-7 / PSR-18 HTTP client adapters supported.
Java11Reactor and CompletableFuture variants available.
Go1.21Context-aware. No external dependencies beyond the standard library.
.NET6.0Targets net6.0 and net8.0. NuGet package signed.

Quickstart

Five steps from a clean checkout to your first authenticated call.

#StepWhat to do
1Install the packagePick your language on the right and run the install command.
2Set the API keyAdd TECHWRITER_API_KEY to your environment. Never commit keys to source control.
3Initialize the clientCreate one client per process and reuse it — the SDK pools connections internally.
4Make your first requestList articles, fetch a template, or create an article — see the quick example to the right.
5Wire up errors and retriesWrap calls in try / catch. Inspect err.code for actionable error types like rate_limited or unauthorized.

Client configuration

Every option below is named consistently across languages. Optional values fall back to safe production defaults.

OptionTypeRequiredDescription
apiKeystringrequiredWorkspace API key from Settings → Integrations. Always read this from an environment variable.
regionstringoptionalData residency region: us-east-1, eu-central-1, or ap-southeast-2. Defaults to us-east-1.
baseURLstringoptionalOverride the API host. Useful for self-hosted deployments and integration tests.
timeoutnumberoptionalPer-request timeout in milliseconds. Default: 30,000.
retriesnumberoptionalHow many times to retry transient errors (5xx, 429, network) with exponential backoff. Default 3.
loggerfunctionoptionalPlug in a structured logger to capture request IDs, latency, and retry counts.
fetchfunctionoptionalInject a custom fetch implementation for proxies, mocking, or edge runtimes.

Core concepts

A short tour of the domain model. Every SDK call maps onto one of these resources.

ConceptDescription
WorkspaceA logical container that scopes API keys, users, roles, and content. One SDK client always operates inside a single workspace.
DocumentA versioned content unit. Documents move through Draft → In Review → Published, with full version history preserved at every stage.
TemplateA reusable starting point for new articles. Templates live in Template Folders and can be shared with groups.
AssetBinary attachments — images, PDFs, and downloadable files — uploaded once and referenced from documents by a stable CDN URL.
Group & RoleGroups bundle users; roles bundle privileges. Combine the two to grant scoped access without per-user setup.
DeploymentA snapshot of one or more articles published to a portal. Every deployment is immutable and rollback-capable.

What ships in the box

You don't have to glue these features together yourself — they're built into every language binding.

FeatureWhat it does
Automatic retriesBuilt-in exponential backoff on 5xx, 429, and network errors. Honors the Retry-After header automatically.
Cursor pagination helpersIterate full result sets with for-await loops or async iterators — no manual page-token bookkeeping.
Typed request & response modelsTypeScript definitions, Python dataclasses, Java POJOs, .NET records — all generated from the same OpenAPI spec.
Webhook signature verificationConstant-time HMAC-SHA256 verification helper. Rejects replays older than five minutes by default.
Request batchingGroup up to 25 document writes into a single transactional request to reduce round trips.
Streaming uploadsUpload large assets directly from a stream. The SDK handles multipart, chunking, and resume on retry.
Idempotency keysPass an Idempotency-Key on any write to safely retry without creating duplicates.
Sandbox modeSwitch between live and test data with a single flag. Sandbox usage never counts against your rate limit or billing.

Where to go next

Was this section helpful?

1. Install

npm install @techwriter/sdk-core

2. Initialize the client

import { TechWriterClient } from ;

const client = new TechWriterClient({
  apiKey: process.env.TECHWRITER_API_KEY,
  region: ,  "color: ">#8b949e">// Choose your data residency
  timeout: 5000,           "color: ">#8b949e">// Request timeout in milliseconds
  retries: 3               "color: ">#8b949e">// Auto-retry transient failures
});

3. Make your first call

"color: ">#8b949e">// List the first page of projects in your workspace
async function listProjects() {
  try {
    const page = await client.projects.list({ top: 20 });
    console.log(`Found ${page.totalCount} projects.`);
    page.items.forEach((p) =>
      console.log(`- ${p.name} (${p.id})`)
    );
  } catch (err) {
    console.error(, err.code, err.message);
  }
}

listProjects();

Pro tip

Read your API key from an environment variable and load it once at startup. Hard-coding the key — even in dev — is the most common cause of accidental exposure on public repos.