Skip to main content
GET
/
api
/
onchain
/
config
Get/Update Onchain Config
curl --request GET \
  --url https://api.example.com/api/onchain/config \
  --header 'Content-Type: application/json' \
  --data '
{
  "enabled": true,
  "chain_ids": [
    {}
  ],
  "max_tx_value_usd": 123,
  "daily_spend_cap_usd": 123,
  "cooldown_seconds": 123,
  "max_slippage_bps": 123,
  "max_leverage": 123,
  "expiry_seconds": 123,
  "require_policy_hash": true,
  "verifying_contract": "<string>",
  "whitelist": {}
}
'
{
  "enabled": true,
  "chain_ids": [1, 8453],
  "limits": {
    "max_tx_value_usd": 1000.0,
    "daily_spend_cap_usd": 5000.0,
    "cooldown_seconds": 60,
    "max_slippage_bps": 100,
    "max_leverage": 10
  },
  "permits": {
    "expiry_seconds": 300,
    "require_policy_hash": true,
    "verifying_contract": "0x3333333333333333333333333333333333333333"
  },
  "whitelist": {
    "0x1111111111111111111111111111111111111111": ["0x12345678", "swap(uint256,uint256)"]
  }
}
Retrieves or updates the onchain module configuration including limits, permits settings, and whitelisted contracts.

Authentication

Requires a valid session token in the Authorization header:
Authorization: Bearer <session_token>

GET /api/onchain/config

Retrieves the current onchain configuration.

Response

enabled
boolean
Whether the onchain module is enabled
chain_ids
array
List of allowed blockchain chain IDs (e.g., [1, 137, 8453] for Ethereum, Polygon, Base)
limits
object
Spending and transaction limits
permits
object
EIP-712 permit configuration
whitelist
object
Map of contract addresses to allowed function selectorsExample:
{
  "0x1111111111111111111111111111111111111111": ["0x12345678", "swap(uint256,uint256)"]
}
{
  "enabled": true,
  "chain_ids": [1, 8453],
  "limits": {
    "max_tx_value_usd": 1000.0,
    "daily_spend_cap_usd": 5000.0,
    "cooldown_seconds": 60,
    "max_slippage_bps": 100,
    "max_leverage": 10
  },
  "permits": {
    "expiry_seconds": 300,
    "require_policy_hash": true,
    "verifying_contract": "0x3333333333333333333333333333333333333333"
  },
  "whitelist": {
    "0x1111111111111111111111111111111111111111": ["0x12345678", "swap(uint256,uint256)"]
  }
}

PUT /api/onchain/config

Updates the onchain configuration. All fields are optional; only provided fields will be updated.

Request Body

enabled
boolean
Enable or disable the onchain module
chain_ids
array
Array of allowed chain IDs
max_tx_value_usd
number
Maximum transaction value (must be >= 0)
daily_spend_cap_usd
number
Daily spending cap (must be >= 0)
cooldown_seconds
integer
Cooldown between permits (0-86400 seconds)
max_slippage_bps
integer
Maximum slippage (0-10000 basis points)
max_leverage
integer
Maximum leverage (1-200)
expiry_seconds
integer
Permit expiry duration (60-3600 seconds)
require_policy_hash
boolean
Whether to include policy hash in permits
verifying_contract
string
Verifying contract address (0x + 40 hex characters)
whitelist
object
Contract whitelist map

Response

Returns the updated configuration.
success
boolean
true if the update succeeded
Plus all configuration fields (same as GET response).

Validation Errors (400)

{
  "errors": [
    "max_tx_value_usd must be a non-negative finite number",
    "expiry_seconds must be between 60 and 3600"
  ]
}

Examples

curl https://localhost:3978/api/onchain/config \
  -H "Authorization: Bearer fn_sess_abc123..."

Status Codes

  • 200 - Success
  • 400 - Validation error (PUT only)
  • 401 - Unauthorized
  • 500 - Failed to save configuration file

Build docs developers (and LLMs) love