Users .: Create a Guest User

API Reference / v15

Create a Guest User

This endpoint creates a one-time guest user for order ahead checkout purposes. The client must store the returned access_token as there is no way to request a new one without creating a new guest account. Guests cannot be created with emails that already exist on non-guest users.

Request Endpoint

POST/v15/apps/users

No Header Authorization Required

Request Body

{
  "api_key": "23eef8c2895ce66eb4500bb5e324b200f5339e6fe6d8665f6de0205f43f3b563",
  "user": {
    "email": "ryanp@thelevelup.com",
    "first_name": "Ryan",
    "last_name": "Punxsutawney",
    "phone": "(555) 555-5555",
    "guest": true
  },
  "permission_keynames": [
    "manage_user_payment_methods",
    "create_orders"
  ]
}

Request Parameters

Param Required Description
api_key Yes Your API Key.
email Yes The new user’s email address.
first_name Yes The new user’s first name.
last_name Yes The new user’s last name.
phone No The new user’s phone number.
guest Yes Set this to true to create guest account.
permission_keynames Yes Array of permissions

cURL Example

curl https://sandbox.thelevelup.com/v15/apps/users \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -d '{
    "api_key": "23eef8c2895ce66eb4500bb5e324b200f5339e6fe6d8665f6de0205f43f3b563",
    "user": {
      "email": "ryanp@thelevelup.com",
      "first_name": "Ryan",
      "last_name": "Punxsutawney",
      "phone": "(555) 555-5555",
      "guest": true
    },
    "permission_keynames": [
      "manage_user_payment_methods",
      "create_orders"
    ]
  }'

Example Response

HTTP/1.1 200 OK

{
  "user": {
    "email": "xaxxmiw2md0smhgnjdvynd91kjcmnfho5xpy-abapv0@levelupguestaccount.com",
    "first_name": "Ryan",
    "last_name": "Punxsutawney",
    "phone": "(555) 555-5555",
    "guest_email": "ryanp@thelevelup.com"
  },
  "access_token": {
    "token": "4400994-rgj1M..."
  }
}

Errors

HTTP/1.1 422 Unprocessable Entity To enable guest ordering for your app, email support@thelevelup.com.

[
  {
      "error": {
          "code": "no_guest_ordering",
          "message": "This app does not support guest ordering.",
          "object": "user",
          "property": "base"
      }
  }
]

HTTP/1.1 422 Unprocessable Entity

[
  {
    "error": {
      "message": "Permissions missing or keynames invalid",
      "object": "user",
      "property": "base"
    }
  }
]

HTTP/1.1 422 Unprocessable Entity - User already exists in the system

[
    {
        "error": {
            "code": "user_exists",
            "message": "This app is powered by LevelUp. You already have a LevelUp account that you created when registering for the following
            LevelUp-powered app: App Name. Please install LevelUp and log in with that account, then try again.",
            "object": "user",
            "property": "base"
        }
    }
]