Users .: Create

API Reference / v15

Create a User

This endpoint creates a user and returns an access token with the requested permissions.

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"
  },
  "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.
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"
    },
    "permission_keynames": [
      "manage_user_payment_methods",
      "create_orders"
    ]
  }'

Example Response

HTTP/1.1 200 OK

{
  "user": {
    "email": "ryanp@thelevelup.com",
    "first_name": "Ryan",
    "last_name": "Punxsutawney",
    "phone": "(555) 555-5555"
  },
  "access_token": {
    "token": "939171-08f16..."
  }
}

Errors

HTTP/1.1 422 Unprocessable Entity

[
  {
    "error": {
      "message": "Email is already associated with another app powered by LevelUp. If this is your account, you can go back to the login screen and log in using that email address and password.",
      "object": "user",
      "property": "email"
    }
  }
]

HTTP/1.1 422 Unprocessable Entity

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