Sites API

Use the Sites API

You can use the Sites API to retrieve metadata about Square Online sites. The Sites API is used with the Snippets API to add and manage snippets on a Square Online site. For more information, see Snippets API Overview.

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

List sites Permalink Get a link to this section

The ListSites endpoint retrieves the Square Online sites for a seller account. The following is an example request:

List Sites
  • 1
  • 2
  • 3
  • 4
curl https://connect.squareup.com/v2/sites \
  -H 'Square-Version: 2021-07-21' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json'

If successful, this endpoint returns a 200 OK status code and a JSON response.

  • If the associated account has one or more sites, the response contains the sites:

    {
      "sites": [
        {
          "id": "site_27807527648example",
          "site_title": "My First Site",
          "domain": "mysite1.square.site",
          "is_published": true,
          "created_at": "2020-02-28T13:22:51Z", 
          "updated_at": "2021-01-13T09:58:32Z" 
        },
        {
          "id": "site_10272534583example",
          "site_title": "My Second Site",
          "domain": "mysite2.square.site",
          "is_published": true,
        "created_at": "2020-06-18T17:45:13Z", 
          "updated_at": "2020-11-23T02:19:10Z"
        }
      ]
    }
    
  • If the associated account has no sites, the response contains an empty object:

    {}
    

Related topics Permalink Get a link to this section