Hi,
im having some trouble with the device code generation when following the terminal api youtube video from the sqaure space dev: sandbox 101: getting started with terminal api. The code is giving an error that says < “errors”: [
{
“category”: “AUTHENTICATION_ERROR”,
“code”: “UNAUTHORIZED”,
“detail”: “This request could not be authorized.”
}
] >
ive made sure the webhook is in production and ive tried authentication keys with no luck moving forward. Im still new to the API field so it could be a simple fix but ive looked over the code to make sure there are no typos and all fields are correct. Below i will post my code for reference minus the access codes for obvious privacy reasons. i made sure i have it in production as thats what ive read could be an issue, as well as using the access key from production.
curl -X POST https:// connect .squareup.com/v2/devices/codes
-H “Square-Version: 2026-05-20”
-H “Authorization: Bearer ${}” \
-H “Content-Type: application/json”
-d ‘{
“device_code”: {
“product_type”: “TERMINAL_WEBHOOK”,
“name”: “Square Terminal 3420”,
“location_id”: “LT2C9ZNDV4ARG”
},
“idempotency_key”: "’$(uuidgen)‘"
}’ | jq