Create Wallet Rule
POST /v1/wallets/{wallet_id}/rules
Creates a new rule for a wallet. The rule type determines which sub-rule fields are required.
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer <token> |
Content-Type | Yes | application/json |
X-Target-Server | Yes | wallet-rules |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
wallet_id | string (UUID) | Yes | Wallet ID |
Request Body
| Field | Type | Required | Validation | Description |
|---|---|---|---|---|
name | string | Yes | -- | Rule name |
type | string | Yes | auto_transfer or permissionless_transfer_limit | Rule type |
network_id | string (UUID) | Yes | Valid UUID | Network this rule applies to |
network_currency_id | string (UUID) | Yes | Valid UUID | Currency this rule applies to |
priority | integer | No | 1-100 | Rule priority |
auto_transfer_rule | object | No | Required for auto_transfer type | Auto-transfer configuration |
sign_and_approve_rule | object | No | -- | Approval configuration |
permissionless_transfer_limit_rule | object | No | Required for permissionless_transfer_limit type | Transfer limit configuration |
Auto Transfer Rule Object
| Field | Type | Required | Validation | Description |
|---|---|---|---|---|
type | string | Yes | See sub-types | Auto-transfer behavior type |
rule_logic | object | Yes | See RuleLogic | Condition tree |
amount | number | Yes | Must be > 0 | Amount to transfer when conditions are met |
target_wallet_id | string (UUID) | Yes | Valid UUID | Destination wallet ID |
Sign and Approve Rule Object
| Field | Type | Required | Validation | Description |
|---|---|---|---|---|
mandatory_user_id | string (UUID) | No | Valid UUID | User who must approve |
min_priority | integer | No | 1-100 | Minimum approver priority |
max_priority | integer | No | 1-100 | Maximum approver priority |
min_user_count | integer | No | min: 1 | Required number of approvals |
Permissionless Transfer Limit Rule Object
| Field | Type | Required | Validation | Description |
|---|---|---|---|---|
max_amount | integer | Yes | Must be > 0 | Max transfer amount in time window |
time_period | string | Yes | hour, day, week, month, year | Time period unit |
time_period_value | integer | Yes | Must be > 0 | Number of time periods |
Examples
Create an Auto-Transfer Rule
{
"name": "Low Balance Auto-Refill",
"type": "auto_transfer",
"network_id": "770e8400-e29b-41d4-a716-446655440000",
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000",
"priority": 1,
"auto_transfer_rule": {
"type": "auto",
"rule_logic": {
"field": "target.balance",
"op": "<",
"value": 100,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
},
"amount": 500.0,
"target_wallet_id": "990e8400-e29b-41d4-a716-446655440001"
}
}
Create an Auto-Transfer with Approval Rule
{
"name": "Large Transfer with Approval",
"type": "auto_transfer",
"network_id": "770e8400-e29b-41d4-a716-446655440000",
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000",
"priority": 2,
"auto_transfer_rule": {
"type": "auto_with_approve",
"rule_logic": {
"field": "target.balance",
"op": "<",
"value": 50,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
},
"amount": 1000.0,
"target_wallet_id": "990e8400-e29b-41d4-a716-446655440001"
},
"sign_and_approve_rule": {
"min_priority": 1,
"max_priority": 50,
"min_user_count": 2
}
}
Create a Permissionless Transfer Limit Rule
{
"name": "Daily Transfer Limit",
"type": "permissionless_transfer_limit",
"network_id": "770e8400-e29b-41d4-a716-446655440000",
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000",
"permissionless_transfer_limit_rule": {
"max_amount": 10000,
"time_period": "day",
"time_period_value": 1
}
}
Response
201 Created
Rule created successfully. No response body.
400 Bad Request
401 Unauthorized
404 Not Found
Wallet not found.