# App documents

Read, draft, preview, submit and withdraw an app's privacy policy, terms, documentation and API reference.

These requests manage the documents Tringify hosts for each app on `apps-support.tringify.com` ([Policies and documentation](/apps/apps/policies-and-docs)). They run signed in to your developer organization like the Developer Portal and the CLI (a Developer Portal session with `X-Organization-ID`, see [Overview and authentication](/developer-api)), at `https://api-dev.tringify.com/api/v1`, with request bodies as JSON (`Content-Type: application/json`). Reading needs View Apps (`apps:read`); saving or discarding a draft and previewing need Edit Apps (`apps:write`); submitting and withdrawing need Release Apps (`apps:release`). See [Organization team permissions](/apps/apps/team-permissions). `:kind` is `privacy`, `terms`, `docs` or `api`.

| Request | Does |
| --- | --- |
| `GET /apps/:id/site` | The app's addresses, `limits`, its documents (draft, submission, published version and the latest review decision) and the generated privacy section of the current release. |
| `PUT /apps/:id/site/:kind/draft` | Saves the draft. Privacy and terms: `{"locales": {"en": {"body_markdown": "..."}}}`. Docs and API reference: `{"locales": {"en": {"pages": [{"slug": "getting-started", "title": "Getting started", "body_markdown": "..."}]}}}`, in page order. |
| `DELETE /apps/:id/site/:kind/draft` | Discards the draft. |
| `POST /apps/:id/site/:kind/submit` | Submits the draft: `{"expected_sha256": "<the draft's content_sha256>"}`, so you submit exactly the draft you saved (`APP_SITE_DRAFT_CHANGED` if it changed since). |
| `POST /apps/:id/site/:kind/withdraw` | Withdraws the submission. It becomes the draft again unless there is a newer draft. |
| `GET /apps/:id/site/:kind/versions?cursor=&limit=` | Published versions, newest first, a page at a time (`next_cursor`). |
| `GET /apps/:id/site/:kind/versions/:version` | One version with its content. |
| `POST /apps/:id/site/preview` | Renders Markdown as it will be published: `{"kind": "docs", "markdown": "..."}` returns `{"html": "..."}`. |

A version has `version`, `published_at`, `url` (its `/v/<n>` address), `source` (`developer` or `release`) and `site_status`: `pending` until it is live on `apps-support.tringify.com`, `live`, or `failed` with the error in `site_error`. Refusals name the problem, such as `APP_SITE_BODY_TOO_LONG`, `APP_SITE_TOO_MANY_PAGES`, `APP_SITE_PAGE_SLUG_INVALID`, `APP_SITE_PAGE_SLUG_DUPLICATE`, `APP_SITE_LOCALE_REQUIRED` or `APP_SITE_ALREADY_SUBMITTED`, with the limit that was exceeded.

