Skip to Content
API ReferenceOverview

API Reference

Base URL: https://api.reforg.io — all public endpoints are versioned under /v1.

The full interactive reference — every request/response schema, try-it-out included — is generated from the API itself and lives at api.reforg.io/api/v1 . This page is the map; that page is the territory.

Authentication

Every request needs an x-api-key header. There are two key types:

KeyPrefixWhereAccess
Secret keysk_live_Server onlyFull organization access
Public keypk_live_BrowserScoped to one end user; requires extra headers

Public-key requests must additionally send a browser Origin on your allowed domains list, plus x-user-id and x-user-hash (HMAC-SHA256 of the user ID with your signing secret — see the frontend guide).

Rate limit

100 requests per minute per API key. Exceeding it returns 429 Too Many Requests.

Endpoints

Rendering

Method & pathWhat it does
POST /v1/renderRender a published template with { templateId, data, format }{ documentId, status, downloadUrl, fileSizeBytes, renderTimeMs }
GET /v1/downloads/:id302 redirect to a fresh short-lived presigned URL for a completed document

Templates

Method & pathWhat it does
POST /v1/templatesCreate a template (requires name, formats: ('pdf'|'xlsx')[], and at least one entry in sections)
GET /v1/templatesList non-archived templates (secret key: whole org; public key: that user’s)
GET /v1/templates/:idGet one template with sections and variables
PATCH /v1/templates/:idUpdate fields — every update records a new version
DELETE /v1/templates/:idArchive (soft delete) — hidden from lists, no longer renderable
GET /v1/templates/:id/versionsVersion history, newest first
POST /v1/templates/:id/publishSet status to published, making the template renderable

Assets (read-only)

Method & pathWhat it does
GET /v1/assetsList the organization’s uploaded assets
GET /v1/assets/:idAsset metadata

Usage

Method & pathWhat it does
GET /v1/usageUsage grouped by template + format for a month (?year=&month=; secret key may filter ?externalUserId=)
GET /v1/usage/trendDocuments per month, last 6 months

Public-key callers always see only their own usage; secret-key callers see the whole organization.

Account

Method & pathWhat it does
POST /v1/auth/rotate-keysRegenerate public key, secret key, and signing secret. Secret key required — old credentials die immediately
GET /v1/orgsThe organization behind the API key (sensitive keys masked)

Errors

Non-2xx responses carry a JSON body with a message; both SDK clients turn it into a thrown ReforgioError { message, statusCode }. See the error catalog for every exact message and how to handle it.