# ZaleyCash API v.2

Домен - <https://zaleycash.com>

&#x20;

Используется схема Bearer аутентификации - <https://swagger.io/docs/specification/authentication/bearer-authentication/>

&#x20;

Доступ к ресурсам осуществляется при предоставлении токена в HTTP заголовке **Authorization: Bearer \<access\_token>**

&#x20;

Токен генерируется по секретному ключу методом /api/v2/token - в HTTP заголовке передать **Authorization: Bearer \<secret\_key>**

&#x20;

Токен действителен 1 час. Секретный ключ предоставляется клиенту по запросу после регистрации на сайте <https://zaleycash.com> в разделе <https://zaleycash.com/profile/>.

&#x20;

Все методы принимают запросы и отдают данные в формате JSON.

Структура успешного ответа:

```
{
    "code": 200,
    "message": "OK",
    "response": {
        JSON data
    }
}
```

Структура ответа с ошибкой:

```
{
    "code": 5,
    "message": "Message"
}
```

&#x20;

HTTP Коды ответов:&#x20;

200 - успешный ответ&#x20;

400 - неверный формат запроса&#x20;

401 - пользователь не авторизован&#x20;

403 - доступ к ресурсу закрыт&#x20;

404 - ресурс не найден&#x20;

500 - внутренняя ошибка сервера

Внутренние коды ошибок и их обозначения:&#x20;

1 - Invalid access token&#x20;

2 - Wrong secret key&#x20;

3 - Client does not exist&#x20;

4 - Wrong Authorization header&#x20;

5 - Access is denied for user&#x20;

10 - Invalid request&#x20;

20 - Registration errors&#x20;

21 - User does not exist&#x20;

22 - User with account does not exist&#x20;

23 - Account \<account\_id> type is not \<account\_type>&#x20;

24 - Account \<account\_name> inactive. Operations are protected&#x20;

25 - Wrong account\_id&#x20;

26 - User inactive. Operations are protected&#x20;

50 - Not enough money or your amount is less then set limit&#x20;

51 - Not enough money&#x20;

52 - Switch on common financial account for operation processing in account \<account\_name>&#x20;

53 - Transaction processing error&#x20;

54 - Financial operations are protected for account \<account\_name>&#x20;

55 - Wrong operation\_id&#x20;

56 - Invalid transaction description in request&#x20;

57 - Can not approve deposit transaction&#x20;

58 - Duplicate operation\_id&#x20;

59 - Operation already approved&#x20;

60 - Operation already declined&#x20;

71 - Account creation error&#x20;

72 - Email already exist&#x20;

73 - {partner name} returned an error&#x20;

80 - Wrong currency&#x20;

81 - Agent account is disabled
