Skip to main content
POST
Upsert delegated agent

Authorizations

X-Monaco-Signature
string
header
required

Ed25519 session-key request signing. Every authenticated request carries three headers: X-Monaco-PublicKey (64-char lowercase-hex session public key), X-Monaco-Timestamp (Unix milliseconds, within 30s of server time), and X-Monaco-Signature (hex ed25519 signature). The signature is over METHOD\npath?query\ntimestamp_ms\nSHA256_hex(body), where the body hash is the SHA-256 of the empty byte string when there is no body. Obtain the session keypair from POST /api/v1/auth/challenge followed by POST /api/v1/auth/verify.

Body

application/json
agentAddress
string
required

Agent wallet address (EVM, 42 chars including 0x)

Example:

"0x742d35cc6634c0532925a3b8d4060f31e2c3d8b5"

allowedActions
string[]
required

Required JSON array of actions the agent may perform: CREATE_ORDER, CANCEL_ORDER, REPLACE_ORDER, READ, MANAGE_RISK_BUCKETS. Every delegated session may read the owner's data; a policy listing only READ, or no action, is a read-only key. MANAGE_RISK_BUCKETS lets the agent move a margin account's free collateral into that account's own risk buckets (POST /api/v1/margin/risk-buckets/collateral/transfer-in), only for an account listed in allowedMarginAccountIds and, if the policy lists markets, only into an isolated risk bucket on a listed market. No action lets an agent move collateral any other way. Any other value is rejected.

Minimum string length: 1
Example:
allowedTradingPairIds
string<uuid>[]
required

Required JSON array of trading pair UUIDs. Each listed scope must match: with markets and margin accounts both listed, an order needs a listed market AND a listed account. Send [] for account-only scope; both scopes empty permit no orders.

Minimum string length: 1
name
string | null

Optional human-friendly label for the agent

Example:

"market-maker-bot"

expiresAt
string | null

Delegation expiry timestamp (ISO 8601). Ends delegated reads, trading, and session refresh. Omit for the default of 14 days from now; at most 180 days ahead.

Example:

"2026-12-31T23:59:59Z"

allowedMarginAccountIds
string<uuid>[] | null

Optional JSON array of margin account UUIDs the agent is bound to. When listed, an order must be on one of these accounts (and on a listed market, if any are listed). Omitted, null, or [] leaves the account unrestricted; both scopes empty permit no orders.

Minimum string length: 1
allowedOrderTypes
string[] | null

Optional JSON array of permitted order types (LIMIT, MARKET). Omitted, null, or [] means unrestricted order types.

Minimum string length: 1
Example:
allowedTimeInForce
string[] | null

Optional JSON array of permitted time-in-force values (GTC, IOC, FOK). Omitted, null, or [] means unrestricted time in force.

Minimum string length: 1
Example:
maxLeverage
string | null

Maximum leverage the agent may use (decimal string). Omit for no limit.

Example:

"10"

maxOrderNotional
string | null

Maximum order notional (price * quantity, decimal string). Omit for no limit.

Example:

"50000"

maxOpenOrders
integer<int32> | null

Unsupported legacy field. Requests that set maxOpenOrders are rejected; no concurrent open-order cap is enforced. Omit this field.

ipAllowlist
string[] | null

Optional JSON array of up to 20 IP addresses or CIDR ranges the agent may create its delegated session from. Omitted, null, or [] allows any address.

Minimum string length: 1
Example:

Response

OK

id
string<uuid> | null

Delegation UUID

Example:

"123e4567-e89b-12d3-a456-426614174000"

ownerUserId
string<uuid> | null

Owner account UUID the agent acts on behalf of

agentAddress
string | null

Agent wallet address (EVM)

Example:

"0x742d35cc6634c0532925a3b8d4060f31e2c3d8b5"

name
string | null

Human-friendly label for the agent

isActive
boolean | null

Whether the delegation is active

expiresAt
string | null

Delegation expiry timestamp (ISO 8601), if set

revokedAt
string | null

Revocation timestamp (ISO 8601), if revoked

allowedActions
string[] | null

Actions the agent may perform

Minimum string length: 1
allowedTradingPairIds
string<uuid>[] | null

Trading pair UUIDs the agent may trade

Minimum string length: 1
allowedMarginAccountIds
string<uuid>[] | null

Margin account UUIDs the agent may trade against

Minimum string length: 1
allowedOrderTypes
string[] | null

Permitted order types. Empty means unrestricted.

Minimum string length: 1
allowedTimeInForce
string[] | null

Permitted time-in-force values. Empty means unrestricted.

Minimum string length: 1
maxLeverage
string | null

Maximum leverage (decimal string), if set

maxOrderNotional
string | null

Maximum order notional (decimal string), if set

maxOpenOrders
integer<int32> | null

Legacy field; no concurrent open-order cap is enforced. New or updated policies leave it unset.

ipAllowlist
string[] | null

IP addresses and CIDR ranges the agent may create its delegated session from, normalized. Empty allows any address.

Minimum string length: 1