List Theme Files

GET /v2/sites/{site_id}/themes/{theme_id}/files

Lists all theme files for a Square Online site, or filters for a specific theme file by file path. This operation returns files from the theme directory of the site.

Permissions: ONLINE_STORE_CUSTOM_THEME_READ

Path parameters

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

Query parameters

Name Type Description
path string The URL-encoded path of the theme file to retrieve. If not specified, all theme files are returned.
cursor string A pagination cursor returned by the previous call to ListThemeFiles. Send this cursor in the next request to retrieve the next page of results. For more information, see Pagination.

Response fields

Name Type Description
errors Error [ ] Any errors that occurred during the request.
files ThemeFile [ ] All theme files or the requested theme file. Returns empty object ({ }) if none are found.
cursor string A pagination cursor used to retrieve the next page of query results. This field is present only if there are additional results. For more information, see Pagination.

Example requests

List all theme files:

curl https://connect.squareup.com/v2/sites/site_id0/themes/theme_id1/files \
  -H 'Square-Version: 2023-09-25' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json'

Retrieve a specific theme file:

curl https://connect.squareup.com/v2/sites/site_id0/themes/theme_id1/files?path=theme%2Fpath%2Ffile_name2.twig \
  -H 'Square-Version: 2023-09-25' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json'

Example response

{
  "files": [
    {
      "path": "theme/partials/header.twig",
      "content": "<h1>Hello world</h1>",
      "checksum": "7e85c676fd97d370e2309003a5681bc4388306979b7db04c37c6fb0672891b6a",
      "content_type": "text/plain",
      "size": 1542,
      "site_theme_id": "site_theme_413f6836-4c8d-4fee-8cb1-6d8bd042c880",
      "updated_at": "2020-11-23T02:19:10.000000Z"
    },
    {
      "path": "theme/images/emoji.gif",
      "content": "fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3fo379UAAAAASUVORK5CYII=",
      "checksum": "05b71b9303ad6c74e6237a2756c95f83ec887ed9cc9a2f71d6d66d60d392ec42",
      "content_type": "image/gif",
      "size": 965,
      "site_theme_id": "site_theme_413f6836-4c8d-4fee-8cb1-6d8bd042c880",
      "updated_at": "2020-11-23T02:19:10.000000Z"
    }
  ],
  "cursor": "N4LMZ7RPBUxbVBZccouiIhlFDJ1S3Dy7VsMVMookk2599EUNUaturj6EVXpslxjWc27YUXzDIYPP9O6bImVn1rvUJH98eyyAfsXLIIkYx7mM4UEXZQRcvjSuhHf"
}