Users

A user object represents a person or an account. A user may belong to many domains and may have many tokens on many devices. A user has a 40-character hexadecimal unique identifier and an optional name and email address. A LoginTC user object generally corresponds one-to-one with your application’s user object.

Resources

POST /users

Create a new user for your organization.

Parameters

Name Description Required
username A 1 to 128-character unique identifier Yes
name A 1 to 128-character real name (can be the same as username) Yes
email The user’s valid email address Yes

Example

$ curl -X POST https://cloud.logintc.com/api/users \
  -d '{"username" : "john.doe", "name" : "John Doe", "email" : "john.doe@example.com"}' \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id" : "8c184f495a5b7b6e9ed732f2ce3c67e310806f38",
    "username" : "john.doe",
    "name" : "John Doe",
    "email" : "john.doe@example.com",
    "domains" : []
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User details
$username = 'john.doe';
$name = 'John Doe';
$email = 'john.doe@example.com';

// Helper function to create user
$user = $logintc->createUser($username, $name, $email);

echo $user->getId();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# User details
username = 'john.doe'
email = 'john.doe@example.com'
name = 'John Doe'

# Helper function to create user
user = client.create_user(username, email, name)

print user['id']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);
 
    // User details
    String username = "john.doe";
    String email = "john.doe@example.com";
    String name = "John Doe";

    // Helper function to create user
    User user = logintc.createUser(username, email, name);

    System.out.println(user.getId());
  }
}

GET /users?page={page}

Get list of users.

Example

$ curl -X GET https://cloud.logintc.com/api/users?page=1 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
[
    {
    "id" : "8c184f495a5b7b6e9ed732f2ce3c67e310806f38",
    "username" : "john.doe",
    "name" : "John Doe",
    "email" : "john.doe@example.com",
    "domains" : ["9120580e94f134cb7c9f27cd1e43dbc82980e152"]
    }
]
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Page number
$page = 1;

// Helper function to get user
$users = $logintc->getUsers($page);

foreach( $users as $users ) {
  echo $user->getUsername();
}
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Page number
page = 1

# Helper function to get user
users = client.get_users(page)

for user in users:
  print user['username']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);
 
    // Page number
    Integer page = 1;

    // Helper function to get users
    List<User> users = logintc.getUsers(page);

    for (User user : users) {
        System.out.println(user.getUsername());
    }
  }
}
            

GET /users?username={username}

Get information about a user: username, name, email and domain memberships.

Example

$ curl -X GET https://cloud.logintc.com/api/users?username=john.doe \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id" : "8c184f495a5b7b6e9ed732f2ce3c67e310806f38",
    "username" : "john.doe",
    "name" : "John Doe",
    "email" : "john.doe@example.com",
    "domains" : ["9120580e94f134cb7c9f27cd1e43dbc82980e152"]
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User username
$username = 'john.doe';

// Helper function to get user
$user = $logintc->getUserByUsername($username);

echo $user->getUsername();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# User username
username = 'john.doe'

# Helper function to get user
user = client.get_user_by_username(username)

print user['username']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);
 
    // User username
    String username = "john.doe";

    // Helper function to get user
    User user = logintc.getUserByUsername(username);

    System.out.println(user.getUsername());
  }
}
            

GET /users/{userId}

Get information about a user: username, name, email and domain memberships.

Example

$ curl -X GET https://cloud.logintc.com/api/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id" : "8c184f495a5b7b6e9ed732f2ce3c67e310806f38",
    "username" : "john.doe",
    "name" : "John Doe",
    "email" : "john.doe@example.com",
    "domains" : ["9120580e94f134cb7c9f27cd1e43dbc82980e152"]
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User id
$user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38';

// Helper function to get user
$user = $logintc->getUser($user_id);

echo $user->getUsername();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to get user
user = client.get_user(user_id)

print user['username']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);
 
    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to get user
    User user = logintc.getUser(userId);

    System.out.println(user.getUsername());
  }
}
            

PUT /users/{userId}

Update a user’s name and email.

Parameters

Name Description Required
name A 1 to 128-character real name (can be the same as username) Optional
email The user’s valid email address Optional

Note: Updating the username is not permitted.

Example

$ curl -X PUT https://cloud.logintc.com/api/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38 \
  -d '{"name" : "Jane Doe", "email": "jane.doe@example.com"}' \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id" : "8c184f495a5b7b6e9ed732f2ce3c67e310806f38",
    "username" : "john.doe",
    "name" : "Jane Doe",
    "email" : "jane.doe@example.com",
    "domains" : ["9120580e94f134cb7c9f27cd1e43dbc82980e152"]
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User details
$user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38';
$name = 'Jane Doe';
$email = 'jane.doe@example.com';

// Helper function to update user
$user = $logintc->updateUser($user_id, $name, $email);

echo $user->getName();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# User details
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'
email = 'jane.doe@example.com'
name = 'Jane Doe'

# Helper function to update user
user = client.update_user(user_id, email, name)

print user['name']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);
 
    // User details
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";
    String email = "jane.doe@example.com";
    String name = "Jane Doe";

    // Helper function to update user
    User user = logintc.updateUser(userId, email, name);

    System.out.println(user.getName());
  }
}

DELETE /users/{userId}

Delete an existing user. Deleting a user will remove them from their domains and will revoke their tokens.

Example

$ curl -X DELETE https://cloud.logintc.com/api/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User id
$user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38';

// Helper function to get user
$logintc->deleteUser($user_id);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to delete user
client.delete_user(user_id)
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);
 
    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to delete user
    logintc.deleteUser(userId);
  }
}