Struggling with authentication

Hi there - I’m just trying to be able to retreive data from Square sales, and, of course, there are no transactions in a sandbox (that I know of), and I really don’t want to try and figure out how to create them because that’s not a useful function to me. So I tried to authenticate to the production systems and am unable to do so - but what I’m reading in these forums is inconsistent (probably because the system has evolved over time.)

First off - Do I have to have some kind of testing in the sandbox first? There’s a post that seems to indicate that’s a requirement.

Second, if not - l don’t have an “endpoint URL” - it’s a PC running curl scripts just to retrieve data, not one that Square will initialize communication with. Is that not an option? There are posts which seem to indicate both sides of the communication need to be able to initialize with the other, but, again, that’s not the case here - there’s no “server” on this side.

I’ve done this with Paypal, and I went thru the API documentation but am unable to determine why I’m getting an “UNAUTHORIZED” just trying to do the initial authorization using Postman.

My understanding is that this returns a bearer token that is then used for further RESTful API invocations. Not correct?

Thanks!

You don’t need sandbox testing first, and you don’t need OAuth or an endpoint URL. OAuth (and its redirect URL) is only for apps that act on other sellers’ accounts.

To read your own account’s data from curl, you can use your production personal access token:

  1. In the Developer Console, open your app → Credentials, switch the toggle to Production, and copy the Production Access Token.
  2. Send it as a bearer token directly on API calls to https://connect.squareup.com. There’s no separate authorization call to exchange it first.

UNAUTHORIZED usually means the token and the base URL are from different environments. Sandbox tokens only work against connect.squareupsandbox.com, and production tokens only work against connect.squareup.com. Your Developer Console account also has to be the same Square account that has the sales.

Access tokens: Access Tokens and Other Credentials
Payments API: GET /v2/payments - Square API Reference

:vulcan_salute:

I’ve done that. I’d think a very simple query to get location data should work, no?

https://connect.squareup.com/v2/locations?Square-Version=2026-09-16&Authorization=Bearer [production access token]&Content-Type=application/json

should work. But I’m getting an authentication error.

Oh, and it works in API explorer on production. Doesn’t matter if I use postman or a direct curl call from the command line on my side; the access token is cut and pasted from API explorer to Postman and I manually verified that every character is correct.

curl -v https://connect.squareup.com/v2/locations -H “Square-Version=2026-09-16” -H “Authorization=Bearer [production access token]” -H “Content-Type=application/json”

  • Host connect.squareup.com:443 was resolved.
  • IPv6: (none)
  • IPv4: 172.66.0.47, 162.159.140.47
  • Trying 172.66.0.47:443…
  • schannel: disabled automatic use of client certificate
  • ALPN: curl offers http/1.1
  • ALPN: server accepted http/1.1
  • Connected to connect.squareup.com (172.66.0.47) port 443
  • using HTTP/1.x

GET /v2/locations HTTP/1.1
Host: connect.squareup.com
User-Agent: curl/8.13.0
Accept: /

  • Request completely sent off
    < HTTP/1.1 401 Unauthorized
    < Date: Mon, 19 Oct 2026 15:51:20 GMT
    < Content-Type: application/json
    < Content-Length: 161
    < Connection: keep-alive
    < CF-Ray: a4d0f18ff959ee37-IAD
    < CF-Cache-Status: DYNAMIC
    < Server: cloudflare
    < Strict-Transport-Security: max-age=631152000; includeSubDomains; preload
    < Vary: Origin, Accept-Encoding
    < x-content-type-options: nosniff
    < x-download-options: noopen
    < x-envoy-decorator-operation: /v2/locations
    < x-frame-options: SAMEORIGIN
    < x-permitted-cross-domain-policies: none
    < x-sq-dc: aws
    < x-sq-envoy-safe-auth-decision: UNAUTHORIZED
    < x-sq-region: us-east-1
    < x-xss-protection: 1; mode=block
    < set-cookie: __cf_bm=SP7dgHc2G1fD6tq5f32kO4wDLok78dlggD4Zj7NdK2A-1792425080.3218887-1.0.1.1-uP8FfmeXAAgOw02DFw_vOkqXtuqruXrpIbytrOTkMIvMQMVUH8ErCJGbFvPsBwGA.jrIUsIPHNrZrkiODLtrNuD9DwD4vHGH.ndlVbC7DzIJKBAfFVtzBwDInL9kHxwUft; HttpOnly; SameSite=None; Secure; Path=/; Domain=connect.squareup.com; Expires=Mon, 19 Oct 2026 16:21:20 GMT

Any other suggestions?

This looks like a request formatting issue. In the curl command you shared, the headers use equals signs between their names and values. HTTP headers need colons instead. Use straight quotation marks around each header as well.

In Postman, put the access token under Authorization → Bearer Token, rather than in the URL or Params. Put Square-Version under Headers.

The List locations reference shows the expected header format.

If you still receive a 401 after those changes, share the response body and updated request details with the access token removed.

Bada-bing. Thank you!