PageHub History API
A site's revision timeline, what changed in each version, and restoring one to the draft.
A site's revision timeline, what changed in each version, and restoring one to the draft.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/pagehub-dev:pagehub-dev-history-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: PageHub History API
version: 1.0.0
description: 'The public REST API of PageHub, called with a `ph_` API key (`Authorization: Bearer ph_...`), plus the one webhook the platform calls on a white-label tenant''s server (`fetchPage`).
A site is HTML + Liquid files: its pages are files (`pages/*.liquid`), written through the files API; the page routes manage each page''s record (name, slug, SEO, access). Writes land in the site''s draft; `PUT /api/v1/sites/{id}` with `published: true` makes the draft live.
The headless content API (`/api/v1/content/...`) is described by its own document (`GET /api/v1/content/openapi.json`); `GET /api/openapi.json` serves this document with it merged in.
The routes also accept the dashboard''s session cookie from the dashboard itself; only the API key is the public contract.
Every operation carries two extension fields. `x-auth` says who may call it: `api-key` (a `ph_` key), `session-or-key` (the dashboard''s own session, or a key), `optional-key` (public, a key widens what you see), `admin-key` (a platform admin''s key), `session` (the dashboard session only; an API key is refused) or `public`. `x-rate-limit` names the rate-limit rule (see the rate-limiting guide) when the route has one; most routes limit per user, public routes per IP.'
contact:
name: PageHub
url: https://pagehub.dev/developers
servers:
- url: https://pagehub.dev
description: PageHub
security:
- bearerAuth: []
tags:
- name: History
description: A site's revision timeline, what changed in each version, and restoring one to the draft.
paths:
/api/v1/sites/{id}/history:
get:
tags:
- History
summary: List a site's revisions
description: 'The timeline, newest first: one row per editing session, publish or restore. `restorable` is false for a version saved before the HTML editor (it can be listed, not diffed or restored). `retention` is the site owner''s plan cap. Needs write access to the site (owner, editor, agency).'
operationId: listSiteHistory
parameters:
- $ref: '#/components/parameters/SiteId'
- name: page
in: query
required: false
schema:
type: integer
minimum: 1
description: Page number.
- name: pageSize
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 25
description: Rows per page.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
revisions:
type: array
items:
type: object
properties:
id:
type: string
version:
type: integer
trigger:
type: string
enum:
- save
- publish
- restore
author:
type: string
source:
type:
- string
- 'null'
description: '`editor`, `mcp`, `ai`, `api` or null.'
summary:
type: string
createdAt:
type: string
format: date-time
restorable:
type: boolean
pages:
type: array
items:
type: object
properties:
pageNodeId:
type: string
name:
type: string
pagination:
type: object
additionalProperties: true
retention:
type: object
properties:
plan:
type: string
cap:
type: integer
allowance:
type: object
additionalProperties: true
required:
- revisions
- pagination
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
x-auth: session-or-key
/api/v1/sites/{id}/history/{revId}:
parameters:
- $ref: '#/components/parameters/SiteId'
- name: revId
in: path
required: true
schema:
type: string
description: A revision's `id` from the history list.
get:
tags:
- History
summary: Read one revision, optionally with what changed
description: 'With `diff=prev` (or another revision''s id) the answer groups the changes by page: added, removed, changed and moved elements, with class changes as token sets. Capped at 500 changes (`truncated`, `totalChanges`). 409 `LEGACY_REVISION` for a version saved before the HTML editor.'
operationId: getSiteRevision
parameters:
- name: diff
in: query
required: false
schema:
type: string
description: '`prev`, or the id of the revision to compare against.'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
revision:
type: object
additionalProperties: true
baseline:
type:
- object
- 'null'
additionalProperties: true
groups:
type: array
items:
type: object
additionalProperties: true
stats:
type:
- object
- 'null'
additionalProperties: true
truncated:
type: boolean
totalChanges:
type: integer
required:
- revision
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
description: 'LEGACY_REVISION: saved before the HTML editor, so it cannot be compared.'
x-auth: session-or-key
/api/v1/sites/{id}/history/{revId}/restore:
parameters:
- $ref: '#/components/parameters/SiteId'
- name: revId
in: path
required: true
schema:
type: string
description: A revision's `id` from the history list.
post:
tags:
- History
summary: Restore a revision into the draft
description: 'Writes the revision''s files forward into the DRAFT and records a `restore` revision, so a restore is itself undoable; the live release is never touched, publish to make it live. A full `pre-restore` backup is taken first: if it fails the answer is 500 `PRE_RESTORE_BACKUP_FAILED` and nothing changes. `scope: "page"` restores one page (needs `pageNodeId`). Owner, editor and agency; a client or viewer cannot.'
operationId: restoreSiteRevision
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
scope:
type: string
enum:
- site
- page
default: site
pageNodeId:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
ok:
type: boolean
scope:
type: string
restoredPages:
type: array
items:
type: string
fromVersion:
type: integer
newVersion:
type:
- integer
- 'null'
revisionId:
type:
- string
- 'null'
summary:
type: string
required:
- ok
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
description: 'LEGACY_REVISION or BLOBS_MISSING: this version cannot be restored.'
'429':
$ref: '#/components/responses/RateLimited'
'500':
description: The pre-restore backup could not be taken; nothing was changed.
content:
application/json:
schema:
type: object
properties:
error:
type: string
code:
type: string
'503':
$ref: '#/components/responses/Maintenance'
x-auth: session-or-key
x-rate-limit: dashboard_settings_save
components:
parameters:
SiteId:
name: id
in: path
required: true
schema:
type: string
description: The site's id.
responses:
Unauthorized:
description: Missing, malformed or invalid `ph_` API key.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
BadRequest:
description: The request is malformed or refused (`error`, often `message`).
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
Forbidden:
description: The key's user lacks the role this needs, or a plan limit applies.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
NotFound:
description: No such site, or the key has no access to it, or no such resource under it.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
RateLimited:
description: Too many requests.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
Maintenance:
description: 'Writes are paused for maintenance (`error: maintenance`, `Retry-After` header).'
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
schemas:
ApiError:
type: object
description: The error body of the management routes. The content API uses `Error` instead.
properties:
error:
type: string
description: A message, or a code such as `version_conflict`, `lint`, `maintenance`, `site_format_changed`.
message:
type: string
code:
type: string
upgrade:
type: boolean
description: True when the plan is the reason.
required:
- error
additionalProperties: true
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: A `ph_` API key (a user's key, or a tenant's).
tenantAuthToken:
type: apiKey
in: header
name: x-pagehub-auth
description: The tenant's token, sent by PageHub on every webhook call so the tenant can check the request came from PageHub.