Sites API Reference

Provides endpoints to manage files for a Square Online site.

Use the Sites API to create, retrieve, update, and delete files in the site or theme directory for a Square Online site. For more information about the directory structure, see Site architecture.

The Square Online CLI provides wrapper commands that you can use to perform equivalent operations. This reference is provided for completeness, but we recommend that you use the Square Online CLI instead of calling the Sites API.

The Sites API provides the following endpoints.

Endpoint Description
List Sites Lists the sites that belong to a seller.
Create Theme Initializes a blank custom theme for a site.
Upsert Theme File Creates or updates a theme file.
List Theme Files Lists all theme files or filters for a specific theme file.
Delete Theme File Permanently deletes a theme file.
Create Site Page Creates a page for a site.
Update Site Page Updates a page for a site.
List Site Pages Lists all site pages
Get Site Page Retrieves a site page.
Delete Site Page Deletes a site page
Upsert Site Setting Creates or updates site settings.
List Site Settings Lists all site settings or filters for a specific setting.
Delete Site Setting Delete a site setting.
Upsert Global Element Creates or updates a global element, such as a header.
List Global Elements Lists all global elements or filters for a specific global element.
Delete Global Element Deletes a global element.

The Sites API uses the following data types.

Object or enum Description
Site A Square Online site.
SiteGlobalElement A global section or container used by a site.
SiteGlobalElementType Types of global element: SECTION or CONTAINER.
SitePage A site page.
SiteSetting A site setting.
Theme A custom theme for a site.
ThemeFile A theme file, which includes file content and metadata.
Error An error encountered during a request to the Square API.

Permissions

The following OAuth permissions are required to call Sites API endpoints. For more information, see Manage Access to the Square APIs.

Permission Description
MERCHANT_PROFILE_READ Required by all Square API endpoints.
ONLINE_STORE_SITE_READ Required by the ListSites endpoint.
ONLINE_STORE_CUSTOM_THEME_WRITE Required by endpoints that perform a POST, PUT, or DELETE operation on a custom site.
ONLINE_STORE_CUSTOM_THEME_READ Required by endpoints that perform a GET operation on a custom site.