# Deposit / Withdraw User Balance

## End**point**

```
POST https://api.nexusggr.com
```

## **Request Body**

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "method": "user_deposit",
    "agent_code": "testAgent",
    "agent_token": "c3041c6d9146a164387fa454eff7b432",
    "user_code": "test",
    "amount": 10000.00,
    "agent_sign": "UNIQUE_ID"   // Optional to prevent duplicated
}
</code></pre>

```json
{
    "method": "user_withdraw",
    "agent_code": "testAgent",
    "agent_token": "c3041c6d9146a164387fa454eff7b432",
    "user_code": "test",
    "amount": 10000.00,
    "agent_sign": "UNIQUE_ID"   // Optional to prevent duplicated
}
```

<table><thead><tr><th width="130">Key</th><th width="96">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>method</code></td><td>string</td><td>API method name. For balance transfer to a user game wallet, the value must be <code>user_deposit</code> or  <code>user_withdraw</code>.</td></tr><tr><td><code>agent_code</code></td><td>string</td><td>Unique agent identifier provided by NEXUS. Used to identify which agent is sending the request.</td></tr><tr><td><code>agent_token</code></td><td>string</td><td>Secret authentication token assigned to the agent. Used for API authentication and request validation.</td></tr><tr><td><code>user_code</code></td><td>string</td><td>Unique user identifier within the agent’s platform, without whitespace. This user will receive (<code>user_deposit</code>) or give (<code>user_withdraw</code>) the transferred balance. <code>user_deposit</code> creates the user if it does not exist yet.</td></tr><tr><td><code>amount</code></td><td>double</td><td>Amount to transfer from the agent balance to the user API balance (<code>user_deposit</code>), or back (<code>user_withdraw</code>). Must be greater than <code>0</code> and sent as a JSON number, not a string. Supports up to 2 digits after the decimal point. Example: <code>10000.00</code></td></tr><tr><td><code>agent_sign</code></td><td>string</td><td>Optional unique request identifier used to prevent duplicated requests: a sign already used for the same user is refused with <code>Duplicated Agent Sign.</code> Letters, digits and underscores only (<code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code>). Recommended for transaction safety and idempotency handling. Example: UUID without hyphens, hash string, timestamp-based unique value.</td></tr></tbody></table>

## **Response Example**

```json
{
    "status": 1, 
    "code": 7777777,
    "msg": "SUCCESS",
    "agent_balance": 990000,
    "user_balance": 10000
}
```

```json
{
    "status": 0,
    "code": 7770014,
    "msg": "Insufficient agent funds."
}
```

```json
{
    "status": 0,
    "code": 7770015,
    "msg": "Insufficient user funds."
}
```

<table><thead><tr><th width="151">Field</th><th width="86">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>status</code></td><td>int</td><td>Request processing status. <code>1</code> indicates success, while <code>0</code> indicates failure.</td></tr><tr><td><code>code</code></td><td>int</td><td>Response code. <code>7777777</code> indicates success; any other value is an error code (<code>7770xxx</code>).</td></tr><tr><td><code>msg</code></td><td>string</td><td>Response message describing the result of the request. Example: <code>SUCCESS</code>, <code>Insufficient agent funds.</code></td></tr><tr><td><code>agent_balance</code></td><td>double</td><td>Remaining balance of the agent after the transaction has been processed successfully. Supports up to 2 digits after the decimal point. </td></tr><tr><td><code>user_balance</code></td><td>double</td><td>Updated API balance of the user after the transaction has been completed successfully. Supports up to 2 digits after the decimal point. </td></tr></tbody></table>
