SubaccountService
Create Subaccount
Create a new sub-account under the caller's root account. Requires the caller to have accepted the current terms.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/auth/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 '{
"color": "#7C3AED",
"icon": "💰",
"label": "Market Making",
"message": "Polyester account authorization\n\nCreate a sub-account controlled by the smart account below.\nThis does not authorize a transaction or a login.\n\naction: create_subaccount\norigin: https://devnet.polyester.com\naudience: devnet\npolyester_chain_id: 888168\nroot_account_id: 123456789\nowner_address: 0x5555555555555555555555555555555555555555\nsmart_account_address: 0x2222222222222222222222222222222222222222\nsalt_nonce: 1\nrequest_id: 8f3a72c91b4de6058f3a72c91b4de6058f3a72c91b4de6058f3a72c91b4de605\nissued_at: 2026-01-01T00:00:00Z\nexpiration: 2026-01-01T00:05:00Z",
"signature": "0xabcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789",
"smartAccountAddress": "0x2222222222222222222222222222222222222222"
}'Responses
{
"revision": "1",
"smartAccountSaltNonce": 1,
"subaccountId": "36u1pj4a2WL",
"totalCreated": 1
}Optional user-chosen color token for UI display. Tokens use lowercase letters, numbers, underscores, or hyphens.
Optional user-chosen icon/emoji for UI display.
Optional human label for display in UI. label.no_angle_brackets // label must not contain '<' or '>'
Exact EIP-191 authorization returned by CreateSubaccountChallenge. string.max_bytes = 4096
Smart-account signature over message using EIP-191 personal_sign semantics. Deployed ERC-1271 and counterfactual ERC-6492 signatures are supported.
Smart Account EVM address for the new sub-account.
Identifier for the created sub-account (opaque ID).
36u1pj4a2WLTotal number of sub-accounts that have ever been created for this root, including soft-deleted ones. Request a new challenge for the next account.
1Smart-account derivation salt nonce assigned to the created sub-account. Today this equals total_created for a successful create.
1Initial monotonic resource revision. Clients can pass this value directly as expected_revision on the next revision-gated mutation.
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. |