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

You are viewing an old version of the API
Create mobile authorization code

POST /mobile/authorization-code

Generates code to authorize a mobile application to connect to a Square card reader.

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

Important: The Authorization header you provide to this endpoint must have the following format:

  Authorization: Bearer ACCESS_TOKEN

Replace ACCESS_TOKEN with a valid production authorization credential.


Permissions
PAYMENTS_WRITE_IN_PERSON
Guide
Build with Mobile Authorization API
Try in API Explorer
Name Description
location_id
string

The Square location ID that the authorization code should be tied to.

Min Length 1 Max Length 191

Response Fields

Name Description
authorization_code
string

The generated authorization code that connects a mobile application instance to a Square account.

Max Length 191
expires_at
string

The timestamp when authorization_code expires, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").

Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:

UTC: 2020-01-26T02:25:34Z

Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00

Min Length 20 Max Length 48
error
Error

An error object that provides details about how creation of the authorization code failed.

Examples

You are viewing an old version of the API
POST /mobile/authorization-code
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/mobile/authorization-code \
  -X POST \
  -H 'Square-Version: 2022-07-20' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "location_id": "YOUR_LOCATION_ID"
  }'
Response JSON
{
  "authorization_code": "YOUR_MOBILE_AUTHORIZATION_CODE",
  "expires_at": "2019-01-10T19:42:08Z"
}