Upsert Site Setting

POST /v2/sites/{site_id}/settings

Updates settings for a Square Online site. This operation creates a .json file under settings in the site directory of the site. If a file with the specified name already exists, Square replaces the file.

Permissions: ONLINE_STORE_CUSTOM_THEME_WRITE

Path parameters

Name Type Description
site_id string Required The ID of the site.

Request body

Name Type Description
name string The name of the settings file to create or update (without the file extension).
properties string The setting properties, as an escaped JSON string. This value represents the contents of the file.

Response fields

Name Type Description
errors Error [ ] Any errors that occurred during the request.
setting SiteSetting The new or updated setting.

Example request

curl https://connect.squareup.com/v2/sites/site_id0/settings \
  -X POST \
  -H 'Square-Version: 2023-09-25' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "settings",
    "properties": "{\"default\": \"dark\"}"
}'

Example response

{
  "setting": {
    "name": "settings",
    "properties": "{\"default\": \"dark\"}"
  }
}