# Publish hosted document pages

Hosted pages on pages.policygrain.com render pure semantic HTML with zero scripts and zero cookies, ensuring privacy notices never themselves track visitors.

## Requirements before publishing

- The target document version must be in final state (all agent_inferred answers confirmed by the owner).
- The caller holds the documents scope or a signed-in web session.

## Publish via PUT /v1/documents/{id}/publication

```bash
curl -X PUT https://api.policygrain.com/v1/documents/doc_01.../publication \
  -H "Authorization: Bearer $POLICYGRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug": "example-privacy"}'
```

PUT publishes the newest final version. The body takes only slug, and only the first time: the slug then stays this document's, so later calls send {} (or the same slug) and a different slug is refused. The call is idempotent; it answers 200 once the page is live and 202 while the edge is still syncing.

Link the returned https://pages.policygrain.com/{slug} URL from your website footer and banner notice link. Previous published versions remain readable at /{slug}/versions/{n}.

## Unpublishing and material_version bumps

Call DELETE /v1/documents/{id}/publication to unpublish and purge the hosted page from the edge. When a published privacy or consent notice changes materially, bump your banner config material_version so returning visitors see the updated notice.
