# User-Specific Endpoint

## Get A User

<mark style="color:blue;">`GET`</mark> `https://accountable.pixelninja.dev/:token/user/:uuid`

This will get a specified user by UUID. This is not for authenticating users as there are specific endpoints for that. This endpoint should not be used for getting data that is covered by other endpoints (like custom attributes). You can use this endpoint 2 times per second.

#### Path Parameters

| Name  | Type   | Description                                     |
| ----- | ------ | ----------------------------------------------- |
| token | string | This is your API token.                         |
| uuid  | string | This is the UUID of the user you wish to fetch. |

{% tabs %}
{% tab title="200 The user was retrieved successfully. If returning an empty array, the user does not exist." %}

```c
[{
    "username": "admin",
    "uuid": "3ae74cfd-3174-49e2-ab99-1310bb89fa67",
    "password": "$2b$12$O1l14ukIqsL8S/0L1E2IsOYtfvkgtS2H7oJYfKcuMMZVlRSAEnakO",
    "accessToken": "M2FlNzRjZmQtMzE3NC00OWUyLWFiOTktMTMxMGJiODlmYTY3.MTYxNjAxODY1MTAyNw.exyGGW61aV04V4GcFUXRIpS1mIqeiSpl",
    "passwordLastChanged": 1616018651027,
    "createdAt": 1616018651027,
    "permissions": 0,
    "customAttributes": {},
    "2fa": {
        "enabled": true,
        "enabledAt": 1616154804936,
        "token": "HBBWWLRYN4WF4YZDGVYWKWRVMFRXQ5JYO4UVIS25KBFVW52WGAXA",
        "mfaToken": "AYIspPs91RUYdabk9WdZvKO3lA9v2MTS"
    },
    "scopes": {
        "key": "",
        "permissions": [],
        "timeout": 0
    }
}]
```

{% endtab %}

{% tab title="400 The provided API token is invalid." %}

```c
{ "code": 400, "message": "Bad request" }
```

{% endtab %}
{% endtabs %}

## Edit User Info

<mark style="color:orange;">`PUT`</mark> `https://accountable.pixelninja.dev/:token/user/:uuid`

This is used to change information about a user. It only covers username and password as other endpoints are dedicated to editing other values. You can choose to change one or both of these values in one request. You can use this endpoint once per second.

#### Path Parameters

| Name  | Type   | Description                                    |
| ----- | ------ | ---------------------------------------------- |
| token | string | This is your API token.                        |
| uuid  | string | This is the UUID of the user you wish to edit. |

#### Request Body

| Name     | Type   | Description                                       |
| -------- | ------ | ------------------------------------------------- |
| username | string | Provide this field to change the user's username  |
| password | string | Provide this field to change the user's password. |

{% tabs %}
{% tab title="200 The user was edited successfully. This will return the new user object with updated details." %}

```c
{
    "username": "NotAdmin",
    "uuid": "3ae74cfd-3174-49e2-ab99-1310bb89fa67",
    "password": "$2b$12$W3bsCDysVoyIYzbR22tAZ.ycsJORzxkSRrD3X58Zle.6k9L2CXmd6",
    "accessToken": "M2FlNzRjZmQtMzE3NC00OWUyLWFiOTktMTMxMGJiODlmYTY3.MTYxNjQ1MTU0MjYxMw.QWjOPg3s4Py9XHYMOvMVWbptbqx0aXY0",
    "passwordLastChanged": 1616451542613,
    "createdAt": 1616018651027,
    "permissions": 0,
    "customAttributes": {},
    "2fa": {
        "enabled": true,
        "enabledAt": 1616154804936,
        "token": "HBBWWLRYN4WF4YZDGVYWKWRVMFRXQ5JYO4UVIS25KBFVW52WGAXA",
        "mfaToken": "AYIspPs91RUYdabk9WdZvKO3lA9v2MTS"
    },
    "scopes": {
        "key": "",
        "permissions": [],
        "timeout": 0
    }
}
```

{% endtab %}

{% tab title="400 Some of the provided details were incorrect/invalid (API token, username, password)." %}

```c
{ "code": 400, "message": "Bad request" }
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
If you change a user password, the user access token will change! Make sure to re-send it to the user!
{% endhint %}

{% hint style="info" %}
Whilst both parameters are optional, you need at least one to get a successful response.
{% endhint %}

## Delete User

<mark style="color:red;">`DELETE`</mark> `https://accountable.pixelninja.dev/:token/user/:uuid`

This will permanently delete a user - Deleted users do not count against your user quota. This endpoint can be used 2 times per second.

#### Path Parameters

| Name  | Type   | Description                                      |
| ----- | ------ | ------------------------------------------------ |
| token | string | This is your API token.                          |
| uuid  | string | This is the UUID of the user you wish to delete. |

{% tabs %}
{% tab title="204 The user was deleted successfully!" %}

```c
{ "code": 204, "message": "No content" }
```

{% endtab %}

{% tab title="400 The details provided were invalid (likely API token)." %}

```c
{ "code": 400, "message": "Bad request" }
```

{% endtab %}

{% tab title="404 The specified user could not be found! " %}

```c
{ "code": 404, "message": "Not found" }
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Deleted users cannot be recovered.
{% endhint %}
