User Access Tokens .: Create

API Reference / v15

Create an User Access Token to Authenticate a POS system or a White Label (Enterprise) App

Given valid credentials, this endpoint returns an access token which may be used to authenticate a point of sale system (merchant user) or White Label (Enterprise) application.

Request Endpoint

POST /v15/access_tokens

No Authorization Required

Request Body

{
  "access_token": {
    "api_key": "23eef8c2895ce66eb4500bb5e324b200f5339e6fe6d8665f6de0205f43f3b563",
    "username": "sandboxdevexample@thelevelup.com",
    "password": "fod2yau4flu6vok6"
  }
}

Request Parameters

Param Type Required Description
api_key String Yes The app’s API Key.
username String Yes The user’s email address.
password String Yes The user’s password.

cURL Example

curl -X POST https://sandbox.thelevelup.com/v15/access_tokens \
  -H Content-Type:application/json \
  -H Accept:application/json \
  -d '{
    "access_token": {
      "api_key": "23eef8c2895ce66eb4500bb5e324b200f5339e6fe6d8665f6de0205f43f3b563",
      "username": "sandboxdevexample@thelevelup.com",
      "password": "fod2yau4flu6vok6"
    }
  }'

Example Response Body

HTTP/1.1 200 OK

{
  "access_token": {
      "app_id":20,
      "merchant_id":34,
      "token":"981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1",
      "user_id":210
  }
}

Response Parameters

Parameters Type Description
merchant_id Integer LevelUp ID of the associated merchant (if present)
token String Access token for the associated merchant (100 bytes maximum)
user_id Integer LevelUp User ID of the authenticated user

Errors

HTTP/1.1 422 Unprocessable Entity - The specified api_key was not found

[
  {
    "error": {
      "message": "Api key is invalid.",
      "object": "access_token",
      "property": "api_key"
    }
  }
]

HTTP/1.1 422 Unprocessable Entity - The email address or password is incorrect

[
  {
    "error": {
      "message": "The email address or password you provided is incorrect.",
      "object": "access_token",
      "property": "base"
    }
  }
]