Adding users and the user API

Add people in the admin console one at a time, or keep NearAuth.ai in step with your own systems using the user API. When someone is added, they get an email that walks them through setting up their phone and computer.

In the admin console

  1. Open Users in the admin console and click Add User.
  2. Enter the person's email address, and optionally their name and a UID (your own id for them, or their Linux username if they'll use SSH).
  3. To change someone's role or UID, use the buttons on their row. Reset Devices removes their phone and computers from NearAuth.ai so they can set them up again, for example after getting a new phone.
You can also add everyone in a Google or Entra group automatically with Onboarding.

The user API

POST to:
https://secure.nearauth.ai/b2fUserApi

Authentication

Send your API key with every request in the Authorization header:
Authorization: Bearer <your API key>
Create the key with the Generate API Key button on the Settings page. It is shown only once, so store it somewhere safe, such as a secrets manager. Generating a new key turns off the old one immediately.

Request

Send a JSON array. Each entry adds, changes or removes one user, and you can mix commands in one request, up to 1000 entries. Entries are applied in order and independently: if one fails, the others are still applied.
[
  { "email": "ann@example.com", "username": "Ann Lee", "cmd": "addUser" },
  { "email": "bob@example.com", "uid": "1234", "cmd": "editUser" },
  { "email": "cy@example.com", "cmd": "deleteUser" }
]

Add a user

{
  "email": "<the person's email address>",
  "username": "<their first and last name>",
  "uid": "<your id for them>",
  "cmd": "addUser"
}
email and cmd are required. username and uid are optional.

Change a user

{
  "email": "<the person's email address>",
  "username": "<their first and last name>",
  "uid": "<your id for them>",
  "cmd": "editUser"
}
The user is found by email address. To change someone's email address, add a new user with the new address and remove the old one.

Remove a user

{
  "email": "<the person's email address>",
  "cmd": "deleteUser"
}

Response

{
  "outcome": 0,
  "reason": "",
  "results": [
    { "index": 0, "email": "ann@example.com", "cmd": "addUser", "outcome": 0, "reason": "" },
    ...
  ]
}
outcome is 0 if every entry succeeded and 1 otherwise, with reason explaining why. results has one entry for each entry you sent, in the same order.

Questions or problems? Email help@nearauth.ai or call 607-238-3533.