• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Create device code BETA

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

Required permissions: DEVICE_CREDENTIAL_MANAGEMENT

Request Body

Name Description
idempotency_key
string

Required

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

See Idempotency keys for more information.

Max Length 128 Min Length 1
device_code
DeviceCode

Required

The device code to create.

Response Fields

Name Description
errors
Error [ ]

Any errors that occurred during the request.

device_code
DeviceCode

The created DeviceCode object containing the device code string.

Examples

You are viewing an old version of the API
POST /v2/devices/codes
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
curl https://connect.squareup.com/v2/devices/codes \
  -X POST \
  -H 'Square-Version: 2020-06-25' \
  -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"
  }
}

Share Feedback

Thanks for visiting the Square API documentation. What's on your mind?