

# Update site settings

Change a site's settings. Every setting the dashboard's site settings pages can change is settable here, under the same rules. All fields are optional; omitted fields keep their existing values.

```sh
PATCH https://sitepaste.com/api/v1/public/site
```

Settings take effect on the site's next deploy, exactly as when changed in the dashboard.

## Usage

```bash
curl -X PATCH https://sitepaste.com/api/v1/public/site \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"protectionType": "password", "pagesPassword": "share-with-team"}'
```

## Authorizations

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |

## Site protection

| Field | Type | Description |
|-------|------|-------------|
| protectionType | string | `public`, `password`, or `workspace`. See [Password protection](/concepts/password-protection). |
| pagesPassword | string | The site password for `password` protection. Empty string clears it. |

Switching to `password` requires a password: send `pagesPassword` in the same request, unless one is already stored from before. Switching away keeps the stored password, so you can switch back without resending it.

## General

| Field | Type | Description |
|-------|------|-------------|
| siteId | string | Target site ID. Defaults to your default site. Also accepted as a `?siteId=` query parameter, which takes precedence over the body field. |
| name | string | Site name. |
| displayName | string | Display name shown on the site, when different from `name`. |
| description | string | Site description (max 500 chars). |
| logoUrl | string | Logo image URL. |
| iconUrl | string | Site icon (favicon) URL. |
| ogImageUrl | string | Default social preview image URL. |
| logoDisplayPreference | string | `next-to-name`, `instead-of-name`, or `hide`. |
| language | string | Site language tag, like `en`. |
| docsEnabled | boolean | Whether the `/docs/` section exists. |
| previewEnabled | boolean | Whether the draft preview site is enabled. |

## Theme and layout

| Field | Type | Description |
|-------|------|-------------|
| theme | string | Theme name. |
| primaryColor | string | Hex (`#336699`) or named color. |
| fontSize | string | `compact`, `comfortable`, or `large`. |
| contentWidth | string | `narrow`, `medium`, `wide`, or `full`. |
| sidebarPosition | string | `left`, `right`, `top`, or `none`. |
| sidebarContent | string | Which lists the sidebar shows: `all`, `pages-only`, or `tags-only`. |
| stickyHeader | boolean | Pin the header while scrolling. |
| stickySidebar | boolean | Pin the sidebar while scrolling. |
| codeTheme | string | `auto`, `light`, or `dark`. |
| codeThemeLight | string | Chroma style name for light mode. |
| codeThemeDark | string | Chroma style name for dark mode. |
| darkModeDefault | string | `system`, `light`, or `dark`. |
| darkModeStyle | string | `lights-out`, `soft`, or `blue`. |
| showDarkToggle | boolean | Dark mode toggle button. |
| headingFont | string | `system-sans` or `serif`. |
| bodyFont | string | `system-sans` or `serif`. |
| headingBorders | string | `none` or `bottom`. |
| textAlign | string | `left` or `justify`. |
| antialiasText | boolean | Antialiased text rendering. |

## Feature toggles

Site-wide defaults; several have [per-page overrides](/api/pages/post-pages).

| Field | Description |
|-------|-------------|
| showTags | Tag chips on pages and listings. |
| showDates | Publish dates. |
| showAuthor | Author byline. |
| showReadingTime | Reading time estimate. |
| showToc | Table of contents. |
| showBreadcrumbs | Breadcrumbs. |
| showNextPrev | Next/previous page navigation. |
| showSearch | Search bar. |
| showFooter | Site footer. |
| showSocialShare | Social share buttons. |
| showComments | Comments. |
| showNewsletterCta | Newsletter signup CTA. Pro plan only. |
| showCopyMarkdownDocs | Copy-as-Markdown button on docs pages. |
| showCopyMarkdownBlog | Copy-as-Markdown button on blog posts. |
| showCopyMarkdownStandalone | Copy-as-Markdown button on standalone pages. |
| preserveAspectRatio | Keep gallery images at their own aspect ratio instead of cropping to squares. |
| fullWidthGallery | Gallery grid spans the full screen width. |
| masonryGallery | Masonry gallery grid, packed with no gaps. |
| showGalleryDownload | Gallery "Download all" button. |

## Navigation, sidebar, and footer

| Field | Type | Description |
|-------|------|-------------|
| navLinks | array | Up to 10 `{label, url}` links in the top navigation. |
| navCtaLabel | string | Call-to-action button label. Required together with `navCtaUrl`. |
| navCtaUrl | string | Call-to-action button URL. Required together with `navCtaLabel`. |
| sidebarSectionsDisplay | string | `nested` or `flat`. |
| sidebarItemsPerPage | number | Any number from 1 to 100. |
| sidebarShowMore | boolean | Show a "show more" control when a sidebar group has more entries than `sidebarItemsPerPage`. |
| sidebarShowViewAll | boolean | Show a "view all" link to the section index at the end of a sidebar group. |
| sidebarItems | array | Sidebar entries: `{type: "section", contentType, key}` or `{type: "link", contentType, label, url}`, where `contentType` is `docs`, `blog`, or a standalone section name. Max 100 total, 20 per group. |
| footerSections | array | Up to 5 sections: `{title, type: "links", links: [{label, url}]}` or `{title, type: "markdown", content}`. |

## Plan requirements

Site protection (`protectionType` other than `public`), `pagesPassword`, and `showNewsletterCta: true` require the Pro plan; theme changes require a paid plan. These are the same rules the dashboard enforces, and since API tokens themselves require Pro, they are normally already satisfied.

## Response

`200 OK` with the updated settings document, in the same shape as [get site settings](/api/site/get-site).

Field validation errors return `400`:

```json
{
  "error": "validation failed",
  "fields": { "contentWidth": "contentWidth must be one of: narrow, medium, wide, full" }
}
```
