Update Site Page

PUT /v2/sites/{site_id}/pages/{page_id}

Updates a page for a Square Online site. This operation updates the .json page file under pages in the site directory of the site.

Permissions: ONLINE_STORE_CUSTOM_THEME_WRITE

Path parameters

Name Type Description
site_id string Required The ID of the site.
page_id string Required The ID of the page to update.

Request body

Name Type Description
idempotency_key string A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
page SitePage Details about the page to update, which can include any of the following fields: name, route, or properties. Sparse updates are supported, so you only need to provide a field if it has changed. When updating properties, you must provide the complete value because the entire string is replaced.

Response fields

Name Type Description
errors Error [ ] Any errors that occurred during the request.
page SitePage The updated page.

Example request

curl https://connect.squareup.com/v2/sites/site_id0/pages/page_id1 \
  -X PUT \
  -H 'Square-Version: 2023-09-25' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "properties": "{\"props\": {\"main\": [{\"props\": {\"heading\": \"Featured products\", \"products\": {\"filters\": {\"ids\": [\"164\", \"165\", \"166\", \"167\", \"168\", \"169\"], \"square_online_id\": true}}}, \"template\": \"featured\"}], \"footer\": {\"props\": []}, \"header\": {\"props\": []}}, \"layout\": \"layouts/brisk\", \"template\": \"templates/pages/home\"}"
  }'

Example response

{
  "page": {
    "id": "site_page_7e4e68a8-fde2-11ee-be56-0242ac120002",
    "name": "Home",
    "route": "lightning-home",
    "properties": "{\"props\": {\"main\": [{\"props\": {\"heading\": \"Featured products\", \"products\": {\"filters\": {\"ids\": [\"164\", \"165\", \"166\", \"167\", \"168\", \"169\"], \"square_online_id\": true}}}, \"template\": \"featured\"}], \"footer\": {\"props\": []}, \"header\": {\"props\": []}}, \"layout\": \"layouts/brisk\", \"template\": \"templates/pages/home\"}",
    "site_id": "site_278075276488921835",
    "created_at": "2020-06-18T17:45:13.000000Z",
    "updated_at": "2020-11-23T02:19:10.000000Z"
  }
}