auth.v1.PolicyService
CreateSubaccountPolicy
Create a new sub-account policy template (optionally attach to a sub-account).
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/auth.v1.PolicyService/CreateSubaccountPolicy' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--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": "1",
"isTemplate": false,
"locked": false,
"maxOpenOrders": 1,
"maxOrderNotional": "12345",
"name": "Market Maker Policy",
"reviewAt": "2025-01-01T00:00:00Z",
"revision": "1",
"sourceTemplateId": "1",
"spotMarketScope": "ALL",
"spotMarkets": [
{
"symbolId": 1
}
],
"tradingHalted": false,
"updatedAt": "2025-01-01T00:00:00Z"
}
}auth.v1.CreateSubaccountPolicyRequestauth.v1.CreateSubaccountPolicyResponseHuman-readable policy name. Create requires a non-empty value; update validates it after merging fields selected by update_mask.
Optional policy description for dashboards and audits. Maximum 256 characters.
Allowed spot markets for this policy.
Market-level scope for spot markets. When unspecified, defaults to ALL.
High-level actions enabled for the sub-account policy. Mandatory read-only actions are included when omitted. Up to 64 unique explicit actions are allowed.
Maximum notional size 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.
Maximum number of resting orders allowed on this sub-account at any time. A value of 0 means no explicit cap.
When 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.
When true, the policy is write-protected and requires an elevated mutation path.
Optional review time in UTC. This does not automatically disable the policy.
Optional expiry time in UTC. This does not automatically disable the policy.
Optional target sub-account to attach atomically after creation.
Policy identifier (opaque ID).
Human-readable policy name.
Optional policy description for dashboards and audits.
Stable numeric pair ID.
Market-level scope for spot markets. When ALL, spot_markets is returned for display only and is not enforced.
Effective high-level actions enabled for the sub-account. Mandatory read-only actions are always included.
True if this policy is a reusable template; false if it is a per-sub-account instance.
Optional source template this policy was copied from (opaque ID). This is audit metadata only and does not imply live linkage.
Maximum 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".
Maximum number of resting orders allowed on this sub-account at any time. A value of 0 means "no explicit cap".
When 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.
When true, this policy is write-protected and requires an elevated approval flow to modify it.
Optional review time in UTC. This is governance metadata and does not automatically disable the policy.
Optional expiry time in UTC. This is governance metadata and does not automatically disable the policy.
Creation time in UTC.
Last update time in UTC.
Monotonic resource revision used for conditional updates.
| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |