Skip to content

Users

The Users resource provides access to all methods relating to Users in Keystash.

List Users

Path: /users/list

Method: GET

Authentication: Bearer Token

Request Headers

Param Value Required
Accept-Encoding gzip optional

Request Body

None.

Example Request

curl
curl --location --request GET 'http://app.keystash.io/api/v1/users/list'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
    {
        "id": "x0Uf09z3TYjoNVFv",
        "firstname": "Max",
        "lastname": "Smith",
        "email": "maxsmith@example.org",
        "username": "maxsmith@example.org",
        "server_username": "maxsmith",
        "role_id": "rzbSZtL2zI0oA16V",
        "role_name": "Administrator",
        "status": "Active",
        "two_factor_enabled": false,
        "created": "2022-04-03 16:07:11",
        "created_user_id": "Unknown",
        "created_by": "Unknown",
        "modified": "2022-04-03 16:09:35",
        "modified_user_id": "x0Uf09z8TYjoNVFB",
        "modified_by": "Max Smith"
    },
    {
        "id": "40SZWHyteshQFcaZ",
        "firstname": "Anne",
        "lastname": "Teak",
        "email": "anneteak@example.org",
        "username": "anneteak@example.org",
        "server_username": "anneteak",
        "role_id": "rzbSZtL2zI0oA16V",
        "role_name": "Administrator",
        "status": "Active",
        "two_factor_enabled": false,
        "created": "2022-05-24 09:34:32",
        "created_user_id": "x0Uf09z3TYjoNVFv",
        "created_by": "Max Smith",
        "modified": "2022-09-05 15:04:24",
        "modified_user_id": "x0Uf09z3TYjoNVFv",
        "modified_by": "Max Smith"
    },
    {
        "id": "LdaOTztlSp2RwreN",
        "firstname": "Perry",
        "lastname": "Scope",
        "email": "perryscope@example.org",
        "username": "perryscope@example.org",
        "server_username": "perryscope",
        "role_id": "rzbSZtL2zI0oA16V",
        "role_name": "Administrator",
        "status": "Active",
        "two_factor_enabled": false,
        "created": "2022-05-24 09:38:04",
        "created_user_id": "x0Uf09z3TYjoNVFv",
        "created_by": "Max Smith",
        "modified": "2022-09-14 10:39:56",
        "modified_user_id": "x0Uf09z3TYjoNVFv",
        "modified_by": "Max Smith"
    },
    {
        "id": "s6e2RtXo3lkaPr3Q",
        "firstname": "Oscar",
        "lastname": "Troisi",
        "email": "oscartroisi@example.org",
        "username": "oscartroisi@example.org",
        "server_username": "oscartroisi",
        "role_id": "rzbSZtL2zI0oA16V",
        "role_name": "Administrator",
        "status": "Active",
        "two_factor_enabled": false,
        "created": "2022-05-24 09:39:07",
        "created_user_id": "x0Uf09z3TYjoNVFv",
        "created_by": "Max Smith",
        "modified": "2022-05-24 10:00:57",
        "modified_user_id": "x0Uf09z3TYjoNVFv",
        "modified_by": "Max Smith"
    }
]

View User

Path: /users/view

Method: GET

Authentication: Bearer Token

Request Headers

Key Value Required
Accept-Encoding gzip optional

Request Parameters

Key Value Required
id x0Uf09z3TYjoNVFv required

Request Body

None.

Example Request

curl
curl --location --request GET 'http://app.keystash.io/api/v1/users/view?id=x0Uf09z3TYjoNVFv'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
    {
        "id": "x0Uf09z3TYjoNVFv",
        "firstname": "Max",
        "lastname": "Smith",
        "email": "maxsmith@example.org",
        "username": "maxsmith@example.org",
        "server_username": "maxsmith",
        "role_id": "rzbSZtL2zI0oA16V",
        "role_name": "Administrator",
        "status": "Active",
        "two_factor_enabled": false,
        "expire_user": false,
        "delete_after_expire": false,
        "expiration_date": "",
        "created": "2022-04-03 16:07:11",
        "created_user_id": "Unknown",
        "created_by": "Unknown",
        "modified": "2022-04-03 16:09:35",
        "modified_user_id": "x0Uf09z3TYjoNVFv",
        "modified_by": "Max Smith"
    }
]

Create User

Path: /users/create

Method: POST

Authentication: Bearer Token

Request Headers

Key Value Required
Content-Type application/json required

Request Parameters

None.

Request Body Parameters

Key Data Type Required Notes
firstname string required Users firstname
lastname string required Users lastname
server_username string required Username that will be used to login to Linux servers
email string required Valid email address of the user
role_id string required ID of the Role that will be assigned to the user
expire_user boolean optional Determines if this user should be expired at expiration_date
delete_after_expire boolean optional Required if expire_user is set. If this is set to true then the user account will be deleted instead of disabled.
expiration_date ISO 8601 date string optional The date and time in UTC time at which the user will be expired. Format: 2020-02-25 21:30:26 (YYYY-MM-DD HH:mm:ss)

Example Request Body

{
    "firstname": "John",
    "lastname": "Smith",
    "server_username": "johnsmith",
    "email": "jonhsmith@example.org",
    "role_id": "rzbSZtL2zI0oA16V",
    "expire_user": "true",
    "delete_after_expire": "false",
    "expiration_date": "2022-07-13 12:39:00"
}

Example Request

curl
curl --location --request POST 'https://app.keystash.io/api/v1/users/create' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstname": "John",
    "lastname": "Smith",
    "server_username": "johnsmith",
    "email": "jonhsmith4@example.org",
    "role_id": "rzbSZtL2zI0oA16V",
    "expire_user": "true",
    "delete_after_expire": "false",
    "expiration_date": "2022-07-13 12:39:00"
}'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "result": "User was successfully created.",
    "id": "KeJA92MhgOVFYQhr"
}

Update User

Path: /users/update

Method: POST

Authentication: Bearer Token

Request Headers

Key Value Required
Content-Type application/json required

Request Parameters

None.

Request Body Parameters

Key Data Type Required Notes
id string required The ID of the user to update
firstname string optional Users firstname
lastname string optional Users lastname
server_username string optional Username that will be used to login to Linux servers
password string optional Change the users password to the specified string
email string optional Valid email address of the user
role_id string optional ID of the Role that will be assigned to the user
expire_user boolean optional Determines if this user should be expired at expiration_date
delete_after_expire boolean optional Required if expire_user is set. If this is set to true then the user account will be deleted instead of disabled.
expiration_date ISO 8601 date string optional The date and time in UTC time at which the user will be expired. Format: 2020-02-25 21:30:26 (YYYY-MM-DD HH:mm:ss)

Example Request Body

{
    "id": "KcJA96MhgOVFYQhx",
    "firstname": "John",
    "lastname": "Smith",
    "password": "Mysupersecretpassword1",
    "expire_user": true,
    "delete_after_expire": false,
    "expiration_date": "2022-07-25 19:00:00"
}

Example Request

curl
curl --location --request POST 'https://app.keystash.io/api/v1/users/update' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": "KcJA96MhgOVFYQhx",
    "firstname": "John",
    "lastname": "Smith",
    "password": "Mysupersecretpassword1",
    "expire_user": true,
    "delete_after_expire": false,
    "expiration_date": "2022-07-25 19:00:00"
}'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "result": "User was successfully updated.",
    "id": "KcJA96MhgOVFYQhx"
}

Enable User

Path: /users/enable

Method: GET

Authentication: Bearer Token

Request Headers

Key Value Required
Accept-Encoding gzip optional

Request Parameters

Key Value Required
id x0Uf09z3TYjoNVFv required

Request Body

None.

Example Request

curl
curl --location --request GET 'http://app.keystash.io/api/v1/users/enable?id=x0Uf09z3TYjoNVFv'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "result": "User with ID 'x0Uf09z3TYjoNVFv' was successfully enabled."
}

Disable User

Path: /users/disable

Method: GET

Authentication: Bearer Token

Request Headers

Key Value Required
Accept-Encoding gzip optional

Request Parameters

Key Value Required
id x0Uf09z3TYjoNVFv required

Request Body

None.

Example Request

curl
curl --location --request GET 'http://app.keystash.io/api/v1/users/disable?id=x0Uf09z3TYjoNVFv'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "result": "User with ID 'x0Uf09z3TYjoNVFv' was successfully disabled."
}

Delete User

Path: /users/delete

Method: GET

Authentication: Bearer Token

Request Headers

Key Value Required
Accept-Encoding gzip optional

Request Parameters

Key Value Required
id x0Uf09z3TYjoNVFv required

Request Body

None.

Example Request

curl
curl --location --request GET 'http://app.keystash.io/api/v1/users/delete?id=x0Uf09z3TYjoNVFv'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "result": "User with ID 'x0Uf09z3TYjoNVFv' was successfully deleted."
}