---
url: https://gudhub.com/docs/rest-api/auth-rest-api/
title: "Auth Rest API\n                #"
description: "Authentication requests are responsible for a user account. It provides creating an account, changing data about it, and access it. In this article you can read"
lang: uk
updated: 2026-09-11T14:14:06.082Z
---

# Auth Rest API [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-rest-api)

Authentication requests are responsible for a user account. It provides creating an account, changing data about it, and access it.

In this article you can read about all these requests:

1.  [auth/signup](#auth-signup)
2.  [auth/login with password & username](#auth-login-with-password-username)
3.  [auth/login with auth\_key](#auth-login-with-authkey)
4.  [auth/login with accesstoken](#auth-login-with-token)
5.  [auth/getuserbyid](#auth-getuserbyid)
6.  [auth/updateuser](#auth-updateuser)
7.  [auth/logout](#auth-logout)
8.  [auth/userlist](#auth-userlist)

## auth/signup [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-signup)

Request for creating a new user account.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `POST` | `Form Data` | `https://gudhub.com/GudHub/auth/signup` |

It contains user object with standard registration information. The object "user" needs certain data to be created:

| Property | Type | Description |
| :-- | :-- | :-- |
| fullname | `string` | _contains full user name_ |
| password | `string` | _contains user password_ |
| username | `string` | _contains user email_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example)

Copy

```json
   user: {
      "fullname" : "Jon Jerry",
      "password" : "mypassword",
      "username" : "jon@gudhub.com"
   }
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response)

As a result you will get an object with all user data.

Copy

```json
{
   "user_id" : 149,
   "accesstoken" : "hkpbqelu_jt-rxatjfvulzjgfj-qizjhunonbdto",
   "username" : "jon@gudhub.com",
   "fullname" : "Jon Jerry",
   "auth_key" : "jgjgGJHGgHGJGHJBGHJGG/DKJSL934394",
   "expirydate" : 1497912166008,
   "app_init" : 3444
}
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code)

| Name | Description |
| :-- | :-- |
| 200 Ok | user is registered |
| 400 Bad Request | incorrect request syntax |
| 600 | user with such name does not exist |

## auth/login with password & username [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-login-with-password-username)

There are two types of login requests. The first one is with the help of password and username. It contains password and username.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request-1)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `POST` | `Form Data` | `https://gudhub.com/GudHub/auth/login` |

It contains password and username.

| Property | Type | Description |
| :-- | :-- | :-- |
| password | `string` | _user account password_ |
| login | `string` | _user account login_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example-1)

Copy

```json
   password : mypassword
   login : johndow@gudhub.com
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response-1)

In return will be an object of user data.

Copy

```json
{ 
   "accesstoken": "zjzvgiesfiifsdkhiilfkskd33u",
   "app_init": 26749,
   "auth_key": "bMfVNFzEQX3KjqbMQ+BhnVk",
   "avatar_128": "https://gudhub.com/avatars/1578_2208_128.jpg",
   "avatar_512": "https://gudhub.com/avatars/1578_2208_512.jpg",
   "expirydate": 1674256597882,
   "fullname": "John Dow",
   "user_id": 78,
   "username": "johndow@gudhub.com"
}
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code-1)

| Name | Description |
| :-- | :-- |
| 200 Ok | success |
| 401 Unauthorized | wrong login or password |
| 711 | incorrect login |
| 712 | incorect password |

## auth/login with authkey [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-login-with-authkey)

Request for login into an existing account.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request-2)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `POST` | `Form Data` | `https://gudhub.com/GudHub/auth/login` |

It contains the auth key.

| Property | Type | Description |
| :-- | :-- | :-- |
| auth\_key | `string` | _personal authentication key_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example-2)

Copy

```json
   auth_key:
   hIHIHIUioihsbdospklmzxnHsdlkiojojojisjdnjvkbiuoajdnwjnufosfjji0045456/==
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response-2)

As well as the first login request, this one will returns an object with user data.

Copy

```json
{ 
   "accesstoken": "zjzvgiesfiifsdkhiilfkskd33u",
   "app_init": 26749,
   "auth_key": "bMfVNFzEQX3KjqbMQ+BhnVk",
   "avatar_128": "https://gudhub.com/avatars/1578_2208_128.jpg",
   "avatar_512": "https://gudhub.com/avatars/1578_2208_512.jpg",
   "expirydate": 1674256597882,
   "fullname": "John Dow",
   "user_id": 78,
   "username": "johndow@gudhub.com"
}
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code-2)

| Name | Description |
| :-- | :-- |
| 000 Unauthorized | wrong auth\_key |
| 200 Ok | success |

## auth/login with token [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-login-with-token)

One more login request allows you to login by the valid user token.

> But it can be used for one token **only for 8 hours of its existence**. After that, the token changes.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request-3)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `POST` | `Query params` | `https://gudhub.com/GudHub/auth/login` |

This request only transmits an existing valid token.

| Property | Type | Description |
| :-- | :-- | :-- |
| accesstoken | `string` | _used to get access_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example-3)

Copy

```json
   token: thog-tayjf-.k-cbeapsebnqawkphhiny-ursyqsn
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response-3)

The current method returns an object with user data.

> Note that this method returns data with a **new access token** that is **valid for the next 8 hours**.

Copy

```json
{ 
   "accesstoken": "zjzvgiesfiifsdkhiilfkskd33u",
   "app_init": 26749,
   "auth_key": "bMfVNFzEQX3KjqbMQ+BhnVk",
   "avatar_128": "https://gudhub.com/avatars/1578_2208_128.jpg",
   "avatar_512": "https://gudhub.com/avatars/1578_2208_512.jpg",
   "expirydate": 1674256597882,
   "fullname": "John Dow",
   "user_id": 78,
   "username": "johndow@gudhub.com"
}
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code-3)

| Name | Description |
| :-- | :-- |
| 200 Ok | success login |

## auth/getuserbyid [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-getuserbyid)

This get request allows to get the user by his/her ID. It is automatically called when the user clicks on [Sharing button](https://gudhub.com/docs/gh-elements/sharing-element/). In fact, it returns the users who have permission for the application in which the request was called.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request-4)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `GET` | `Query String Parameters` | `https://gudhub.com/GudHub_Test/auth/getuserbyid` |

The request consists of a token and the ID of the user whose object will be retrieved.

| Property | Type | Description |
| :-- | :-- | :-- |
| token | `string` | _used to get access_ |
| id | `number` | _ID of the user whose data are to be retrieved_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example-4)

Copy

```json
   token: thog-tayjf-.k-cbeapsebnqawkphhiny-ursyqsn
   id: 1578
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response-4)

In response, you will get the desired user, if his/her profile exists.

Copy

```json
{
   "avatar_128": "https://gudhub.com/avatars/1578_9032_128.jpg",
   "avatar_512": "https://gudhub.com/avatars/1578_9032_512.jpg",
   "expirydate": 0,
   "fullname": "John Dow",
   "user_id": 1578,
   "username": "johndow@gudhub.com"
}
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code-4)

| Name | Description |
| :-- | :-- |
| 200 Ok | user is registered |

## auth/updateuser [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-updateuser)

Request for updating data of the existing account.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request-5)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `POST` | `Form Data` | `https://gudhub.com/GudHub/auth/updateuser` |

It contains token and user object.

| Property | Type | Description |
| :-- | :-- | :-- |
| token | `string` | _using for getting access_ |
| user | `object` | _created user_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example-5)

Copy

```json
   Token: prijmtwlezsxxyromyzbx_eptm.etnkhaewwp-_y

   user:{
      "user_id" : 149,
      "fullname" : "Jon Jerry",
      "username" : "jon@gudhub.com",
      "avatar": "...",
      "app_init" : 3444
   }
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response-5)

In result will be updated user data.

Copy

```json
{
   "user_id" : 149,
   "username" : "jon@gudhub.com",
   "fullname" : "Jon Jerry",
   "expirydate" : 0,
   "app_init" : 3445
}
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code-5)

| Name | Description |
| :-- | :-- |
| 200 Ok | success |

## auth/logout [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-logout)

Request for signing out of the account.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request-6)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `POST` | `Form Data` | `https://gudhub.com/GudHub/auth/logout` |

It contains only token.

| Property | Type | Description |
| :-- | :-- | :-- |
| token | `string` | _using for getting access_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example-6)

Copy

```json
   token:
   hkpbqelu_jt-rxatjfvulzjgfj-qizjhunonbdto
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response-6)

In reply will be a success message.

Copy

```json
Logout OK for token: 
hkpbqelu_jt-rxatjfvulzjgfj-qizjhunonbdto
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code-6)

| Name | Description |
| :-- | :-- |
| 200 | logout is success |

## auth/userlist [#](https://gudhub.com/docs/rest-api/auth-rest-api/#auth-userlist)

This request allows to get the list of users which have keyword matches. The keyword can contain any number of signs. The user list will be retrieved if it has at least three signs.

### Request [#](https://gudhub.com/docs/rest-api/auth-rest-api/#request-7)

| Request Method | Content Type | Request URL |
| :-- | :-- | :-- |
| `GET` | `Query String Parameters` | `https://gudhub.com/GudHub_Test/auth/userlist` |

The current request sends token and keyword.

| Property | Type | Description |
| :-- | :-- | :-- |
| token | `string` | _allows to get the access_ |
| keyword | `string` | _contains the string that will be used to find users for the list_ |

#### **Example:** [#](https://gudhub.com/docs/rest-api/auth-rest-api/#example-7)

Copy

```json
   token: thog-tayjf-.k-cbeapsebnqawkphhiny-ursyqsn
   keyword: john
```

### Response [#](https://gudhub.com/docs/rest-api/auth-rest-api/#response-7)

In response, you will get an array of matched user objects.

Copy

```json
[{
   "avatar_128": "https://gudhub.com/avatars/6832_128.jpg",
   "avatar_512": "https://gudhub.com/avatars/6832_512.jpg",
   "expirydate": 0,
   "fullname": "John Dow",
   "user_id": 1578,
   "username": "johndow@gudhub.com"
}]
```

### Status Code [#](https://gudhub.com/docs/rest-api/auth-rest-api/#status-code-7)

| Name | Description |
| :-- | :-- |
| 200 Ok | user is registered |
| 400 Bad Request | incorrect request syntax |
