# Response Codes

Every answer of the API carries a numeric `code` next to `status` and `msg`: `7777777` when the call succeeded, a `7770xxx` code when it failed.

## Response format

### Success

```json
{
    "status": 1,
    "code": 7777777,
    "msg": "SUCCESS"
}
```

The method's own fields follow `msg`. `transfer_status` answers `"msg": "Completed"` for a completed transfer.

### Failure

```json
{
    "status": 0,
    "code": 7770405,
    "msg": "user_code is required"
}
```

> **Note:** Decide on `status` or `code`, not on `msg`. The `msg` text is written for people and logs: it often names the exact field or value at fault (for example `provider_code PGSOFT does not support game history`), so its wording varies.

* Every JSON answer comes with HTTP status `200`. Two failures are not JSON: a request body that is not valid JSON is refused with HTTP `400`, and a request from a blocked IP address gets no answer at all.
* A request that fails validation reports its first problem only: `7770405` for a missing field, `7770006` for an invalid `amount`, and `7770400` for anything else, with the reason in `msg`.

## Codes

### Success

| Code      | msg                                          | Meaning           |
| --------- | -------------------------------------------- | ----------------- |
| `7777777` | `SUCCESS` (`Completed` for `transfer_status`) | The call succeeded |

### Request and agent

| Code      | msg                                                                                                                                                                                                         | Meaning                                                                                                     |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `7770400` | The reason, for example `perPage must be less than or equal to 1000000`, `lobby_url is not allowed to be empty`, `foo is not allowed`                                                                        | A parameter is invalid: wrong type, out of range, empty, not accepted by the method, or an invalid combination |
| `7770404` | `Invalid Agent.`                                                                                                                                                                                            | Unknown `agent_code`, or a wrong `agent_token`                                                              |
| `7770405` | `<field> is required`, for example `user_code is required`                                                                                                                                                 | A required parameter is missing                                                                             |
| `7770406` | `method is required`, or `Unknown method: <method>`                                                                                                                                                         | The `method` is missing or does not exist                                                                   |
| `7770407` | The reason, for example `provider_code <code> was not found`, `provider_code <code> is currently disabled`, `provider_code <code> is not enabled for this agent`, `provider_code <code> does not support game history` | The provider cannot be used for this request                                                                |
| `7770410` | `user_codes must be a JSON array of user codes`                                                                                                                                                             | `control_users_rtp`: `user_codes` is not a JSON array                                                       |
| `7770412` | `rtp must be less than or equal to 99 when isTest=0 and isPromo=0`, or `rtp must be greater than or equal to 120 when isTest=1 and isPromo=0`                                                               | The RTP is outside the range your agent account allows                                                     |
| `7770414` | `This agent can't use this API.`                                                                                                                                                                            | Your agent type cannot call this method                                                                     |
| `7770415` | `Seamless agent can't use this API.`                                                                                                                                                                        | A Transfer API method was called by a Seamless agent                                                        |
| `7770416` | `Blocked Agent`                                                                                                                                                                                             | The agent is blocked                                                                                        |
| `7770417` | `Deleted Agent`                                                                                                                                                                                             | The agent is deleted                                                                                        |
| `7770429` | `Rate Limit Error`                                                                                                                                                                                          | The method was called again within its [rate limit](https://my.nexusggr.com/app/docs/integration/rate-limit)                      |

### Users, balances, bonuses and tours

| Code      | msg                                                                                                                                   | Meaning                                                                                                                                  |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `7770003` | `Invalid User`                                                                                                                        | The user does not exist                                                                                                                  |
| `7770006` | The reason, for example `amount must be greater than 0`, `amount must have no more than 2 decimal places`                             | The `amount` is invalid                                                                                                                  |
| `7770012` | `Duplicated Agent Sign.`                                                                                                              | `user_deposit` / `user_withdraw`: the `agent_sign` was already used for this user                                                       |
| `7770013` | `agent_sign <agent_sign> was not found for user_code <user_code>`                                                                     | `transfer_status`: there is no transfer with this `agent_sign`                                                                           |
| `7770014` | `Insufficient agent funds.` (`bonus_create` and `tour_create` add the amounts, for example `Insufficient agent funds. (tour: 7000, agent balance: 5000)`) | Your agent balance does not cover the request: `user_deposit`, `bonus_create`, `tour_create`, or `game_launch` by a Seamless agent without balance |
| `7770015` | `Insufficient user funds.`                                                                                                            | `user_withdraw`: the user's balance is lower than the `amount`                                                                           |
| `7770017` | `Influencer count exceed.`                                                                                                            | The agent has reached its limit of users                                                                                                 |
| `7770018` | `Processing`                                                                                                                          | `transfer_status`: the transfer has not completed                                                                                        |
| `7770024` | `Duplicated Tour Id.`                                                                                                                 | `tour_create`: the `tour_id` is already used                                                                                             |
| `7770025` | `There is no running tour.`                                                                                                           | `tour_cancel`: no running tour with this `tour_id`                                                                                       |
| `7770026` | `Duplicated Bonus Id.`                                                                                                                | `bonus_create`: the `bonus_id` is already used                                                                                           |
| `7770027` | `There is no such bonus.` (with the reason when the bonus is over, for example `(bonus_id bonus_777 is finished)`)                   | `bonus_cancel`: no open bonus with this `bonus_id` for this user and game                                                                |

### Server

| Code      | msg                                                                                                                                                                   | Meaning                                                                                       |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `7770500` | `Internal Error`                                                                                                                                                      | The request failed on our side. Retry later, and contact support if it keeps happening        |
| `7770502` | `External Error : <reason>`. The reason is the game server's code, or a sentence, for example `External Error : the request to the PRAGMATIC game server failed` | The game server refused the request or did not answer. Each method's page lists its reasons |
