Documentation

Publication Requests API

Canonical API flow for preparing private previews and publishing an owner's exact family-branch selection.

Publication Requests API

For the owner-facing explanation of private previews, public URLs, branches, and recovery, see Publishing People and Public Family Branches.

The publication API has one public workflow: create a request, wait for its private preview, and submit one owner-confirmed Publish command. Verification, approval records, promotion planning, preflight, artifact writes, and anonymous public-result checks are automatic internal stages.

Automation tokens with tree:publication:update may create and inspect requests or retry safe stored work. Publishing and discarding require an interactive owner session. A token can prepare work but cannot authorize public disclosure.

Minimal sequence

  1. POST /api/trees/:treeId/publication/requests with explicit TreePerson ids.
  2. Poll the returned request or operation until the request is ready_to_review.
  3. Show the private preview links and branch ids to the owner.
  4. POST /api/trees/:treeId/publication/requests/:requestId/publish with the exact preview revision, selected branch ids, and an idempotency key.
  5. Poll until published or needs_attention.

The publish intent is immutable. Reusing its idempotency key with a different revision or branch selection returns a conflict. Retry resumes only the stored stage and cannot broaden the selection. Refresh creates a new private preview and therefore requires a new Publish confirmation.

Owner-visible request states

preparing_preview, ready_to_review, publishing, published, needs_attention, and discarded are the complete owner-visible state set. Machine stage details appear only as bounded progress and safe issues.

Endpoint contracts

POST /api/trees/:treeId/publication/requests

Create an owner-only publication preview request.

FieldValue
OperationcreatePublicationRequest
Authowner session or tree:publication:update token
Required roleOWNER
Token scopetree:publication:update
Request schemacreatePublicationRequestSchema

Responses:

StatusSchemaDescription
202publicationRequestResponseSchemaPrivate preview preparation was queued.
400apiErrorSchemaInvalid selection.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaOwner access or token scope required.
500apiErrorSchemaRequest creation failed.
503apiErrorSchemaPublication coordination is unavailable.

Request example:

{
  "treePersonIds": [
    "tp-a",
    "tp-b"
  ],
  "language": "ru",
  "note": "Maternal branch"
}

Notes:

  • Creation never makes data public.
  • Preview generation continues without an open browser tab.

GET /api/trees/:treeId/publication/requests

List compact active publication requests or history.

FieldValue
OperationlistPublicationRequests
Authowner session or tree:publication:update token
Required roleOWNER
Token scopetree:publication:update
Query schemalistPublicationRequestsQuerySchema

Responses:

StatusSchemaDescription
200publicationRequestListResponseSchemaCursor-paginated compact request cards.
400apiErrorSchemaInvalid query.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaOwner access or token scope required.
500apiErrorSchemaRequest list failed.
503apiErrorSchemaPublication storage is unavailable.

Query example:

{
  "view": "active",
  "limit": 25
}

Notes:

  • List responses exclude snapshots, graph geometry, digests, and machine-check arrays.

GET /api/trees/:treeId/publication/requests/:requestId

Read one private publication request and its family branches.

FieldValue
OperationgetPublicationRequest
Authowner session or tree:publication:update token
Required roleOWNER
Token scopetree:publication:update

Responses:

StatusSchemaDescription
200publicationRequestResponseSchemaRequest detail with private preview links and safe issues.
400apiErrorSchemaInvalid parameters.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaOwner access or token scope required.
404apiErrorSchemaRequest not found.
409apiErrorSchemaRequest state conflict.
500apiErrorSchemaRequest read failed.
503apiErrorSchemaPublication storage is unavailable.

Notes:

  • Automation-token responses set canPublish to false.

POST /api/trees/:treeId/publication/requests/:requestId/publish

Publish the exact family branches confirmed by the owner.

FieldValue
OperationpublishPublicationRequest
Authinteractive owner session
Required roleOWNER
Request schemapublishPublicationRequestSchema

Responses:

StatusSchemaDescription
202publicationRequestResponseSchemaThe exact publish intent was accepted.
400apiErrorSchemaInvalid selection.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaAutomation tokens are not allowed.
404apiErrorSchemaRequest not found.
409apiErrorSchemaPreview or idempotency conflict.
500apiErrorSchemaPublish intent creation failed.
503apiErrorSchemaPublication coordination is unavailable.

Request example:

{
  "previewRevisionId": "revision-1",
  "branchIds": [
    "branch-a"
  ],
  "idempotencyKey": "publish-request-1-revision-1"
}

Notes:

  • Verification, approvals, preflight, execution, and public-result checks run automatically.

POST /api/trees/:treeId/publication/requests/:requestId/refresh

Prepare a new immutable private preview for the same selection.

FieldValue
OperationrefreshPublicationRequest
Authowner session or tree:publication:update token
Required roleOWNER
Token scopetree:publication:update
Request schemapublicationRequestCommandSchema

Responses:

StatusSchemaDescription
202publicationRequestResponseSchemaPreview refresh was queued.
400apiErrorSchemaInvalid request.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaOwner access or token scope required.
404apiErrorSchemaRequest not found.
409apiErrorSchemaRequest cannot be refreshed.
500apiErrorSchemaRefresh failed.
503apiErrorSchemaPublication coordination is unavailable.

Request example:

{}

Notes:

  • A changed preview always requires a new owner Publish confirmation.

POST /api/trees/:treeId/publication/requests/:requestId/retry

Retry only the stored retryable stage.

FieldValue
OperationretryPublicationRequest
Authowner session or tree:publication:update token
Required roleOWNER
Token scopetree:publication:update
Request schemapublicationRequestCommandSchema

Responses:

StatusSchemaDescription
202publicationRequestResponseSchemaThe exact failed operation was requeued.
400apiErrorSchemaInvalid request.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaOwner access or token scope required.
404apiErrorSchemaRequest not found.
409apiErrorSchemaFailure is not retryable.
500apiErrorSchemaRetry failed.
503apiErrorSchemaPublication coordination is unavailable.

Request example:

{}

Notes:

  • Retry cannot change revision, branches, identities, or digests.

POST /api/trees/:treeId/publication/requests/:requestId/discard

Discard an unpublished private preview request.

FieldValue
OperationdiscardPublicationRequest
Authinteractive owner session
Required roleOWNER
Request schemapublicationRequestCommandSchema

Responses:

StatusSchemaDescription
200publicationRequestResponseSchemaRequest moved to history.
400apiErrorSchemaInvalid request.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaAutomation tokens are not allowed.
404apiErrorSchemaRequest not found.
409apiErrorSchemaPublishing or published request cannot be discarded.
500apiErrorSchemaDiscard failed.
503apiErrorSchemaPublication storage is unavailable.

Request example:

{}

Notes:

  • Discard never unpublishes an already completed public result.

GET /api/trees/:treeId/publication/operations/:operationId

Read safe automatic publication progress.

FieldValue
OperationgetPublicationOperation
Authowner session or tree:publication:update token
Required roleOWNER
Token scopetree:publication:update

Responses:

StatusSchemaDescription
200publicationOperationResponseSchemaAutomatic operation status and safe issue.
400apiErrorSchemaInvalid parameters.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaOwner access or token scope required.
404apiErrorSchemaOperation not found.
409apiErrorSchemaOperation state conflict.
500apiErrorSchemaOperation read failed.
503apiErrorSchemaPublication storage is unavailable.

Notes:

  • Responses never expose leases, storage keys, receipts, or execution cursors.

GET /api/trees/:treeId/publication/candidates

Discover bounded age-eligible publication candidates.

FieldValue
OperationqueryPublicationCandidates
Authowner session or tree:publication:update token
Required roleOWNER
Token scopetree:publication:update
Query schemapublicationCandidateQuerySchema

Responses:

StatusSchemaDescription
200publicationCandidateListResponseSchemaBounded candidate page.
400apiErrorSchemaInvalid query.
401apiErrorSchemaAuthentication required.
403apiErrorSchemaOwner access or token scope required.
500apiErrorSchemaCandidate discovery failed.
503apiErrorSchemaTree data is unavailable.

Query example:

{
  "q": "Иван",
  "limit": 25
}

Notes:

  • Candidate discovery never authorizes publication.