v1

latestOpenAPI 3.0.0Apache 2.02026-07-143281,4552.1 MB
Snippets

UpsertSnippet

Adds a snippet to a Square Online site or updates the existing snippet on the site. The snippet code is appended to the end of the head element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.

You can call ListSites to get the IDs of the sites that belong to a seller.

Note: Square Online APIs are publicly available as part of an early access program. For more information, see Early access program for Square Online APIs.

post/v2/sites/{site_id}/snippet

Path parameters

site_idstring required

The ID of the site where you want to add or update the snippet.

Request body

Example request

{
  "snippet": {
    "content": "<script>var js = 1;</script>"
  }
}

Response

Success

Example response

{
  "snippet": {
    "content": "<script>var js = 1;</script>",
    "created_at": "2021-03-11T25:40:09.000000Z",
    "id": "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7",
    "site_id": "site_278075276488921835",
    "updated_at": "2021-03-11T25:40:09.000000Z"
  }
}