> For the complete documentation index, see [llms.txt](https://ninja-lender.gitbook.io/ninja-lender-v2-api-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ninja-lender.gitbook.io/ninja-lender-v2-api-en/seller/application-upload.md).

# Application upload

**Method:** POST

**Url:** <https://test.ninjalender.online/loan/create>

**Headers:**

| header\_key   | content           |
| ------------- | ----------------- |
| Content-Type: | application/json; |
| Authorization | Bearer {{Token}}  |

Where {{Token}} - token obtained during authorization

\
**Request body:**

| Key    | Type        | Required | Description        |
| ------ | ----------- | -------- | ------------------ |
| params | JSON.object | +        | Request parameters |

**Params:**

| Key            | Type        | Required | Description                                                                                                                                                                                                             |
| -------------- | ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount         | numeric     | +        | application amount                                                                                                                                                                                                      |
| term           | numeric     | +        | term of application indicated in seconds                                                                                                                                                                                |
| refuse\_reason | int         | +        | Id of refuse reson                                                                                                                                                                                                      |
| purpose        | int         | +        | id of loan purpose                                                                                                                                                                                                      |
| template       | int         | +        | id of template                                                                                                                                                                                                          |
| requisites     | json.object | +        | Requisites of the application. keys are copied from the template body, the values are filled in according to the properties of the requisites. In case of "enum" kind requisites, as value need to use variant "label". |

**Response:**

| Key      | Type   | Description                   |
| -------- | ------ | ----------------------------- |
| code     | int    | Response code                 |
| message  | string | Response message              |
| data     | json   | Response data                 |
| data.id  | int    | id of created application     |
| log\_key | int    | Id of log for current request |

**Request example:**

```
{
    "params":{
        "template": 9,
        "amount": 100,
        "term": 64000,
        "price_min": 10,
        "refuse_reason":  1,
        "purpose": 1,
        "requisites": {
    	    "one":"1",
            "two": "two",
            "thre": "3",
            "four": "7"
        }
    }
}
```

**Response example:**

**Success:**

```
{
    "code": 0,
    "message": "ok",
    "data": {
        "id": 72,
    },
    "log_key": 781
}
```

**Error:**

```
{
    "code": -1,
    "message": "error",
    "log_key": 748,
    "errors":[
        {
            "code": -1010101,
            "message": "Params is required"
        }
    ]
}
```

**Error list:**

| Ключ     | Сообщение                              |
| -------- | -------------------------------------- |
| -96      | invalid key                            |
| -97      | invalid token                          |
| -98      | expired token                          |
| -99      | system error                           |
| -100     | access denied                          |
| -1010101 | Params is required                     |
| -1010102 | Refuse reason not found                |
| -1010103 | Refuse reason is blank                 |
| -1010104 | Purpose is blank                       |
| -1010105 | Purpose not found                      |
| -1010106 | Template is blank                      |
| -1010107 | Template not found                     |
| -1010108 | Template unactive                      |
| -1010109 | Template unmoderated                   |
| -1010110 | Invalid refuse date                    |
| -1010111 | Requisite needed                       |
| -1010112 | Requisite blank                        |
| -1010113 | Requisite expected date                |
| -1010114 | Requisite expected number              |
| -1010115 | Requisite expected one of list         |
| -1010116 | Requisite expected boolean             |
| -1010117 | Requisite not in template              |
| -1010118 | Amount ivalid                          |
| -1010119 | Price min is zero                      |
| -1010120 | Price min is ivalid                    |
| -1010121 | Term must be more than 86400           |
| -1010122 | Tarm is invalid                        |
| -1010123 | Amount is blank                        |
| -1010124 | Price min is blank                     |
| -1010125 | Term is blank                          |
| -1020126 | Loan not unique                        |
| -1020127 | Requisite registered in other borrower |
| -1020128 | Email is incorrect                     |
| -1020129 | Amount must be more than 0             |
| -1020130 | Refuse reason expected number          |
| -1020131 | Purpose expected number                |
| -1020132 | Template expected number               |
| -1020133 | Phone number is incorrect              |
