# Terminal API Device Code Auth Error

**URL:** <https://developer.squareup.com/forums/t/terminal-api-device-code-auth-error/26666>\
**Category:** Questions\
**Tags:** terminal-api\
**Created:** [July 1, 2026, 1:19am UTC](https://developer.squareup.com/forums/t/terminal-api-device-code-auth-error/26666 "2026-07-01T01:19:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElectricCroc](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ElectricCroc](https://developer.squareup.com/forums/u/ElectricCroc)\
**Post date:** [July 1, 2026, 1:19am UTC](https://developer.squareup.com/forums/t/terminal-api-device-code-auth-error/26666/1 "2026-07-01T01:19:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ElectricCroc](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ElectricCroc](https://developer.squareup.com/forums/u/ElectricCroc)\
**Post date:** [July 1, 2026, 1:20am UTC](https://developer.squareup.com/forums/t/terminal-api-device-code-auth-error/26666/2 "2026-07-01T01:20:23Z")

</div>

i added spaces in the code URL to avoid the 422 posting error

---

<div class="post-metadata">

**Author:** ![sde1000](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sde1000](https://developer.squareup.com/forums/u/sde1000)\
**Post date:** [July 2, 2026, 8:12am UTC](https://developer.squareup.com/forums/t/terminal-api-device-code-auth-error/26666/3 "2026-07-02T08:12:27Z")

</div>

`product_type` should be `TERMINAL_API` not `TERMINAL_WEBHOOK`.

---

<div class="post-metadata">

**Author:** ![ElectricCroc](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ElectricCroc](https://developer.squareup.com/forums/u/ElectricCroc)\
**Post date:** [July 3, 2026, 3:29pm UTC](https://developer.squareup.com/forums/t/terminal-api-device-code-auth-error/26666/4 "2026-07-03T15:29:44Z")

</div>

i adjusted that field and still getting the same error.
