docpin
View as Markdown

REST API

Publish and manage pages from scripts, CI and your own apps.

Pages are identified by id (a UUID) in paths. GET /v1/pages lists them, and publishing returns doc.id.

Publish a page

POST /v1/pages

Upload one HTML file, several files, or a .zip (up to 25 MB) as multipart/form-data, or send HTML as JSON.

FieldTypeNotes
filefile(s)index.html, other files, or one .zip. Multipart only.
htmlstringThe whole HTML document. JSON only.
titlestringDefaults to the document's <title>.
slugstringThe page's address, e.g. sales → /sales. Reusing a slug publishes a new version of that page: same link, earlier versions kept.
boardstringBoard slug to publish into.
unlistedbooleanOnly the short link opens it, and it stays off listings.
accessobjectWho can open it: {"kind":"public"}, {"kind":"password","password":"…"}, or {"kind":"people","people":["sam@acme.com","@acme.com"]}. Private kinds need Pro. In multipart, send it as a JSON string.
curl https://api.docpin.app/v1/pages -H "Authorization: Bearer $DOCPIN_API_KEY" \
  -F file=@index.html -F slug=q4-report

curl https://api.docpin.app/v1/pages -H "Authorization: Bearer $DOCPIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html": "<!doctype html><title>Hello</title><h1>Hello</h1>", "slug": "hello"}'

Response (201 for a new page, 200 for a new version):

{
  "created": true,
  "url": "https://acme.docpin.it/hello",
  "prettyUrl": "https://acme.docpin.it/hello",
  "shortUrl": "https://docpin.it/Ab3dE7",
  "doc": { "id": "61fb0253-…", "title": "Hello", "slug": "hello", "board": null, "unlisted": false, "access": { "kind": "public" } },
  "version": { "id": "…", "files": 1, "bytes": 52 }
}

url is the link to share.

Pages

MethodPathBodyDescription
GET/v1/pagesLists pages, newest first: id, title, slug, board, prettyUrl, shortUrl, access, views, updated, archived.
PATCH/v1/pages/{id}title, slug, board, unlisted, listed, archivedChanges a page. A new slug changes the link; the old link redirects.
DELETE/v1/pages/{id}Deletes the page, its files, versions and data.
PUT/v1/pages/{id}/accessan access object (above), or {"kind":"inherit"}Changes who can open it, without changing the link.
GET/v1/pages/{id}/viewsView counts by day, and named viewers for people-only pages.

Page data

A JSON object per page that the published page reads with docpin.data(). See Page data.

MethodPathBodyDescription
GET/v1/pages/{id}/data{ "data": {…}, "updatedAt": "…" | null }
PATCH/v1/pages/{id}/dataJSON objectMerges top-level keys; null removes a key. Returns the full data.
PUT/v1/pages/{id}/dataJSON objectReplaces everything. Returns the full data.

Up to 1 MB per page, measured as JSON text.

Versions

Every publish to the same slug is kept.

MethodPathDescription
GET/v1/pages/{id}/versionsNewest first, with number, publishedAt, via, by, and current.
POST/v1/pages/{id}/versions/{versionId}/preview{ "url": "…" }: a private preview link that works for an hour.
POST/v1/pages/{id}/versions/{versionId}/restoreMakes that version live again behind the same links. Newer versions are kept.

Boards

Boards group pages under one landing page, like /team-updates.

MethodPathBodyDescription
GET/v1/boardsLists boards.
POST/v1/boardstitle, optional slug, descriptionCreates a board.
PATCH/v1/boards/{slug}title, slug, descriptionChanges a board.
PUT/v1/boards/{slug}/accessan access objectWho can open the board and its pages.
DELETE/v1/boards/{slug}Deletes the board. Its pages are kept unless you add ?pages=delete.

Status codes

StatusMeaning
200 / 201OK / created.
400Something in the request is wrong; the message says what.
401Missing or invalid key, or the key's creator left the workspace.
403Not allowed: a Pro feature on Free, an owner-only action, or a taken-down page.
404Not found in this workspace.
409Conflict, e.g. a slug already in use.
413Too large.
415Unsupported content type for publishing.
429Rate limited. Wait a minute.