Positions

Set Leverage

Sets the leverage for a market. Leverage must be a positive integer and cannot exceed the market's maximum leverage. Reducing leverage while insufficient margin is available will return 400 with error_code=insufficient_margin. For how leverage and margin work, see Leverage.

post/v1/perps/leverage

Request

  • Base URL
    https://api.ondoperps.xyz
  • URL
    https://api.ondoperps.xyz/v1/perps/leverage
  • Auth
    • HTTP bearer
    • or API key in header ONDO-KEY-ID

Request body

marketstring required

Perps market to set leverage for

leveragestring required

New leverage value. Must be a positive integer not exceeding the market maximum.

Example request

{
  "market": "AAPL-USD.P",
  "leverage": "10"
}

Response

Leverage updated successfully

successboolean required

Whether the request was successful

errorstring

Error message, present only on failure

error_codestring

Semantic error code. See each endpoint's error responses for the specific codes it can return.

deprecatedstring

Deprecation notice, if applicable

Example response

{
  "success": true
}

Changes

No recorded changes to this operation across all 2 revisions of this API.