Create a page
Create one page. The response is a 201 with the new page’s URI in Location.
POST https://sitepaste.com/api/v1/public/sites/{siteId}/pages
Requires the content scope.
To write many pages at once, or to create, update, and delete together, use POST /sites/{siteId}/pages/batch. To change a page that already exists, use PATCH at the page’s own URI.
Usage
curl -X POST https://sitepaste.com/api/v1/public/sites/default/pages \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Getting started",
"slug": "getting-started",
"content": "# Getting started\n\nWelcome to the docs.",
"contentType": "docs"
}'
The response’s Location names the new page:
Location: /api/v1/public/sites/default/pages/docs/getting-started
Saving a page does not publish it. Deploy the site with POST /sites/{siteId}/deployments when you are ready for the change to go live.
Authorizations
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token (Authorization: Bearer sp_...). Created in the dashboard under Account > Tokens. See authentication. |
Body
The body is one page object, made of the fields below. Send Content-Type: application/json, or multipart/form-data with the JSON in a payload field alongside file parts when the page carries inline media.
The site is named in the path, not the body. See addressing.
pages and deleteSlugs belong to the batch, an id names a page that already exists and belongs to a PATCH, and publishing has its own route. A body carrying one of them answers 422 naming the field and where it belongs.
Page fields
title is required. Everything else is optional, and a field you leave out takes its default.
| Field | Type | Required | Description |
|---|---|---|---|
| slug | string | No | URL slug (max 100 bytes). Generated from title when omitted. |
| title | string | Yes | Page title (max 200 bytes). |
| content | string | No | Markdown content (max 100,000 bytes). Leading and trailing whitespace is trimmed. May contain file: references to inline media. |
| contentType | string | No | blog, docs, standalone, or homepage. Defaults to blog for new pages. |
| section | string | No | Groups the page under a path. See Sections. |
| description | string | No | Meta description (max 500 bytes). Trimmed. |
| apiEndpoint | string | No | Marks the page as an API reference, like GET /sites/{siteId}/pages/{slug} (max 200 bytes). The method is uppercased on save and shows as a badge in the site navigation. Empty string clears it. |
| draft | boolean | No | Leaves the page off the deployed site. Defaults to false for API-created pages. |
| tags | array | No | Up to 20 tags, each max 30 bytes. See Tags. |
| publishedAt | string | No | RFC 3339 timestamp. Defaults to now for new pages. |
| authorId | string | No | Author to credit the page to, from list authors. Empty string removes the author. |
| password | string | No | Password-protects the page (min 8 bytes). See Protection. |
| ogImageUrl | string | No | Social preview image URL. Empty string clears it. |
| showListings | boolean | No | Homepage only: show recent posts and section listings below the content. |
| language | string | No | Language tag for the page, like en or pt-BR. Empty string clears it. |
| params | object | No | Arbitrary JSON stored with the page, for a theme to read. Replaces existing params when present. |
Theme overrides
A page can override the site’s theme settings, exactly as in the page editor’s theme panel. All are optional; a page without overrides inherits everything from the site.
String settings clear back to “inherit” with an empty string:
| Field | Type | Description |
|---|---|---|
| theme | string | Theme name for this page. |
| primaryColor | string | Hex color in the form #RRGGBB, like #336699. |
| primaryColorDark | string | Hex color in the form #RRGGBB, used while the page is shown in dark mode. When blank, dark mode uses this page’s primaryColor if set, and otherwise the site’s dark mode color. |
| fontSize | string | compact, comfortable, or large. |
| codeThemeLight | string | Syntax highlighting theme for light mode. |
| codeThemeDark | string | Syntax highlighting theme for dark mode. |
| galleryDownloadPosition | string | Where the “Download all” button appears: top or footer. |
Boolean settings take the strings "true", "false", or "inherit". A JSON true or false is accepted too and means the same as its string.
| Field | Description |
|---|---|
| showToc | Table of contents. |
| showSocialShare | Social share buttons. |
| showComments | Comments. |
| showNextPrev | Next/previous post navigation. |
| showNewsletterCta | Newsletter signup CTA. |
| showTags | Tag chips. |
| showDates | Publish dates. |
| showAuthor | Author byline. |
| showReadingTime | Reading time estimate. |
| showBreadcrumbs | Breadcrumbs. |
| showCopyMarkdown | Copy-as-Markdown button. |
| showGalleryDownload | Gallery “Download all” button, which serves the gallery as a ZIP. |
| showGalleryItemDownload | Download buttons on individual gallery photos and videos, in the grid and the lightbox. |
| fullWidthGallery | Full-width gallery grid (photographer theme). |
| masonryGallery | Masonry gallery grid (photographer theme). |
Sections
A section groups pages under a shared path: /docs/my-section/my-page for docs and blog, /my-section/my-page for standalone. A standalone section may nest one level by joining two names with a slash (api/builds publishes at /api/builds/my-page); docs and blog sections cannot nest. Typed casing is captured as the section’s display name where none is set yet: API/Builds publishes at /api/builds and displays as API. Some names are reserved for standalone section roots. See Sections.
Tags
Tags are stored lowercased, with each run of spaces and hyphens as one hyphen, so machine learning and machine-learning are the same tag. What you typed is captured as the tag’s display name where none is set yet: iOS is stored as ios and displays as iOS, and Machine Learning is stored as machine-learning and displays as Machine Learning. When tags is present, it replaces all existing tags; an empty array removes them; omitted, existing tags are kept.
Response
201 Created, with the page in the representation GET /sites/{siteId}/pages/{pagePath} serves and the page’s URI in Location. On a multipart request that carried files, the body also lists them:
| Field | Type | Description |
|---|---|---|
| media | array | One {filename, url} per uploaded inline file. Only on multipart requests with files. |
Errors
Field problems return 422 and name the field, like every other single-resource write:
{
"error": "validation failed",
"code": "validation_failed",
"fields": {
"title": "title is required for new pages"
}
}
A page that already exists at the same content type, section, and slug is a 409. Update it at its own URI instead, or send the batch, which upserts.
Unresolved file: references are covered under inline media.
A refusal can land after some inline media has already been stored. Those files stay in the library and count against your storage quota whatever the request’s outcome. The error envelope then carries a media array naming them, using the same {filename, url} entries the success response lists, so a retry need not upload them again.
This route refuses an Idempotency-Key with a 422 naming the header. Re-sending a create never writes twice, because a page that already exists answers 409.
See errors.