Development
  • Guides
  • API Reference
  • API Explorer
  • SDKs
  • Sample apps
  • System status
Support
  • Developer forums
  • Developer blog
  • YouTube
  • X
More
  • Square Home
  • Square Developer
  • App Marketplace
  • Partner with Square
  • Solutions Partner Program
  • Pricing
  • Sales

© 2026 Square, Inc.

  • Developer terms of service
  • Developer Integration and Marketing Agreement
  • Privacy policy
  • Partnerships
  • Sign In
  • Sign In

    Devices

  • List devices

  • List device codes

  • Create device code

  • Get device code

  • Get device

  • Webhooks

  • device.code.paired

  • device.created

<- Devices API

Devices API

All versions ->

Create device code

POST

 /v2/devices/codes

Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected terminal mode.

Permissions:DEVICE_CREDENTIAL_MANAGEMENT
Try in API Explorer
Link to section

Request body

Example code

Link to section

idempotency_key

string

Required

A unique string that identifies this CreateDeviceCode request. Keys can be any valid string but must be unique for every CreateDeviceCode request.

See Idempotency keys for more information.

Min Length
1
Max Length
128
Link to section

device_code

Required

The device code to create.

Link to section

Response fields

Link to section

errors

Any errors that occurred during the request.

Link to section

device_code

The created DeviceCode object containing the device code string.

Link to section

Examples

All versions ->

POST /v2/devices/codes
curl https://connect.squareup.com/v2/devices/codes \ -X POST \ -H 'Square-Version: 2026-11-18' \ -H 'Authorization: Bearer ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "idempotency_key": "01bb00a6-0c86-4770-94ed-f5fca973cd56", "device_code": { "name": "Counter 1", "location_id": "B5E4484SHHNYH", "product_type": "TERMINAL_API" } }'

Response JSON

{ "device_code": { "id": "B3Z6NAMYQSMTM", "name": "Counter 1", "code": "EBCARJ", "product_type": "TERMINAL_API", "location_id": "B5E4484SHHNYH", "created_at": "2020-02-06T18:44:33.000Z", "pair_by": "2020-02-06T18:49:33.000Z", "status": "UNPAIRED", "status_changed_at": "2020-02-06T18:44:33.000Z" } }