Documentation

REST API reference

Publish and manage HTML documents programmatically. All endpoints accept and return JSON.

Authentication

Every write endpoint requires authentication. There are two options:

curl https://www.repage.app/api/documents \
  -X POST \
  -H "Authorization: Bearer rpg_your_key" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Hello</h1>","title":"My report"}'

Base URL

https://www.repage.app

Always use www.repage.app. Requests to the bare domain are 308-redirected and the Authorization header is stripped by the redirect.

POST/api/documents

Publish a new HTML document. Returns the document ID, shareable URL, and initial version number.

Request body

FieldTypeDescription
htmlstringrequiredThe full HTML to publish. Max 10 MB.
titlestringoptionalHuman-friendly title used for the URL slug. Max 200 chars.
passwordstringoptionalViewer password. When set, visitors must enter this to view the document. Ignored when private is true.
privatebooleanoptionalIf true, only the owner can view the document (no sharing). Overrides password.

Response 200

{
  "id": "abc123",
  "url": "https://www.repage.app/d/abc123",
  "slug": "my-report-xyz",
  "versionNumber": 1
}
GET/api/documents/:id

Fetch the current version's HTML source for a document you own. (Viewers access the rendered page at /d/:id.)

Response 200

{
  "html": "<!DOCTYPE html>...",
  "currentVersionId": "v_abc",
  "visibility": "public"
}
PUT/api/documents/:id

Publish new HTML as a new version of an existing document. The URL stays the same; the old version is kept and can be reverted to.

Request body

FieldTypeDescription
htmlstringrequiredThe new full HTML. Max 10 MB.

Response 200

{
  "id": "abc123",
  "versionNumber": 2
}
GET/api/documents/:id/versions

List the version history of a document. Accessible to anyone who can view the document (not owner-only).

Response 200

{
  "currentVersionId": "v_xyz",
  "versions": [
    {
      "id": "v_abc",
      "versionNumber": 1,
      "byteSize": 4820,
      "createdAt": "2025-01-15T10:30:00.000Z"
    },
    {
      "id": "v_xyz",
      "versionNumber": 2,
      "byteSize": 5100,
      "createdAt": "2025-01-16T09:00:00.000Z"
    }
  ]
}
POST/api/documents/:id/revert

Make an existing version the current one. Owner only.

Request body

FieldTypeDescription
versionIdstringrequiredID of the version to restore.

Response 200

{
  "id": "abc123",
  "currentVersionId": "v_abc"
}

Error responses

All errors return JSON with an error string and the appropriate HTTP status:

StatusMeaning
401Missing or invalid API key / session.
403Authenticated but not the document owner.
404Document or version not found.
413HTML payload exceeds the 10 MB limit.
429Free-tier document limit reached.

Rate limits

There are no hard rate limits currently, but each free account can publish up to 10 documents in total. Updating existing documents does not count toward this limit.

Prefer MCP?

If you're using Claude, Cursor, or another MCP-compatible AI assistant, the MCP server is easier — you don't write any code, just describe what you want.

Get your API key

Sign in to Repage and create a key from your dashboard.

Publish a document