Content
Where a project's pages live, whether the live site is behind the latest save, and the files of a project written in Syntext.
A project's pages live in one of three places, its contentSource:
| contentSource | Pages live in | Saved with | Published by |
|---|---|---|---|
hosted | Syntext — written in Syntext | The editor or Save Pages, as draft revisions | Publish Content |
github | The connected GitHub repository | Commits | A push, or a save in the editor |
upload | Nowhere — the CLI uploads the built site | — | stx deploy |
The content endpoints read and change projects written in Syntext. Pages are read and saved with the Pages & Content API, as on any project. To move a project between Syntext and GitHub, see Connect GitHub.
| Endpoint | Scope | Description |
|---|---|---|
GET /content | read | Where the pages live, and unpublished changes |
GET /content/files | read | Every file, images included |
GET /content/history | read | The revision list |
GET /content/revisions/{number} | read | One revision and what it changed |
POST /content/revisions/{number}/restore | full | Bring back a revision, or some of its files |
POST /content/publish | build | Publish the project as it is now |
POST /content/import | full | Upload a .zip or a folder of files |
GET /projects/templates | — | The starter templates |
Any workspace member (session JWT), or an API key bound to this project with the scope in the table or higher — see Scopes. Available on every plan.
Get content status
Works on every project. For a project written in Syntext, it also says whether the live site is behind the latest save — the dashboard's N changes not published badge.
latestRevision — the newest revision number, or null before the first save.publishedRevision — the newest revision a successful publish deployed. A failed, cancelled or still-running publish doesn't count, so unpublishedChanges stays true until the site really shows the latest save.null / false.List files
/v1/projects/{projectId}/content/filesEvery file of a project written in Syntext, sorted by path — pages, config and images:
kind is text (a page, syntext.json or another .json / .yaml file) or asset (an image). Images are served from their path: images/logo.png is /images/logo.png on the site.
Paths in a project written in Syntext
index.mdx, guides/quickstart.mdx. docs/ can't hold pages directly, and public/ is reserved — keep images at the path they're served from..md, .mdx, .json and .yaml files and PNG, JPEG, GIF, SVG and WebP images. Anything else returns 400 unsupported_file_type.400 invalid_path).Limits
| Limit | Value | Error |
|---|---|---|
| Files per project | 2,000 | 413 too_many_files |
| Total size per project | 200 MB | 413 content_too_large |
| One text file | 1 MB | 413 file_too_large |
| One image | 5 MB | Skipped on import |
Errors on GitHub and CLI projects
Every content endpoint except GET /content answers 409 on a project that isn't written in Syntext, with details.contentSource:
content_source_github — the project is written in its GitHub repository. Its history and publishing follow the repository.content_source_upload — the project is published with stx deploy. Import its files to write it in Syntext.