PolicyService
Create Subaccount Policy
Create a new sub-account policy template for the caller account or workspace.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/auth/policies/subaccounts' \
--header 'Accept: */*' \
--header 'X-API-KEY-ID: YOUR_API_KEY_ID' \
--header 'X-API-TIMESTAMP: YOUR_API_TIMESTAMP' \
--header 'X-API-SIGNATURE: YOUR_API_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"policy": {
"actions": [
"TRADE_SPOT"
],
"description": "Example configuration for the API playground.",
"expiresAt": "2025-01-01T00:00:00Z",
"locked": false,
"maxOpenOrders": 1,
"maxOrderNotional": "12345",
"name": "value",
"reviewAt": "2025-01-01T00:00:00Z",
"spotMarketScope": "ALL",
"spotMarkets": [
{
"symbolId": 1
}
],
"tradingHalted": false
},
"subaccountId": "6789012345678"
}'Responses
{
"policy": {
"actions": [
"TRADE_SPOT"
],
"createdAt": "2025-01-01T00:00:00Z",
"description": "Allow spot trading for selected markets.",
"expiresAt": "2025-01-01T00:00:00Z",
"id": "7gQY8okwBT",
"isTemplate": false,
"locked": false,
"maxOpenOrders": 1,
"maxOrderNotional": "12345",
"name": "Market Maker Policy",
"reviewAt": "2025-01-01T00:00:00Z",
"revision": "1",
"sourceTemplateId": "8gnKtjkL5A",
"spotMarketScope": "ALL",
"spotMarkets": [
{
"symbolId": 1
}
],
"tradingHalted": false,
"updatedAt": "2025-01-01T00:00:00Z"
}
}Complete mutable policy configuration.
Optional target sub-account to attach atomically after creation.
Policy identifier (opaque ID).
7gQY8okwBTHuman-readable policy name.
Market Maker PolicyOptional policy description for dashboards and audits.
Allow spot trading for selected markets.Stable numeric pair ID.
1Market-level scope for spot markets. When ALL, spot_markets is returned for display only and is not enforced.
ALLEffective high-level actions enabled for the sub-account. Mandatory read-only actions are always included.
["TRADE_SPOT"]True if this policy is a reusable template; false if it is a per-sub-account instance.
falseOptional source template this policy was copied from (opaque ID). This is audit metadata only and does not imply live linkage.
8gnKtjkL5AMaximum notional size allowed for any single order on this sub-account, expressed in canonical quote microunits (one unit is 0.000001 USDT). A value of 0 means "no explicit cap".
12345Maximum number of resting orders allowed on this sub-account at any time. A value of 0 means "no explicit cap".
1When true, new orders and exposure-increasing order or trigger changes are rejected regardless of other settings. Existing orders and triggers may still be canceled or paused by an otherwise authorized caller.
falseWhen true, this policy is write-protected and requires an elevated approval flow to modify it.
falseOptional review time in UTC. This is governance metadata and does not automatically disable the policy.
2025-01-01T00:00:00ZOptional expiry time in UTC. This is governance metadata and does not automatically disable the policy.
2025-01-01T00:00:00ZCreation time in UTC.
2025-01-01T00:00:00ZLast update time in UTC.
2025-01-01T00:00:00ZMonotonic resource revision used for conditional updates.
1| Key | Status | Error | When |
|---|---|---|---|
| unauthenticated | 401 | Unauthenticated | Authentication required. |
| permission-denied | 403 | Permission Denied | Permission denied. |
| invalid-argument | 400 | Invalid Argument | Invalid argument. |
| not-found | 404 | Not Found | Not found. |
| unavailable | 503 | Unavailable | Service unavailable. |