> For the complete documentation index, see [llms.txt](https://docs.sfox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sfox.com/rest-api/shorting/get-account-risk-metrics.md).

# Get Account Risk Metrics

<mark style="color:green;">**`GET`**</mark> `https://api.sfox.com/v1/margin/account`

Returns your account's current risk metrics.

{% hint style="info" %}
Shorting is only available if your account is enabled for margin trading
{% endhint %}

### Response Body

<table><thead><tr><th width="339.33890664607196">Key</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>account_value</code></strong></td><td>Your account's current value in USD</td></tr><tr><td><strong><code>equity</code></strong></td><td>Your account's USD balance - <code>position_notional</code></td></tr><tr><td><strong><code>position_notional</code></strong></td><td>The USD value of the active short positions in your account</td></tr><tr><td><strong><code>collateral</code></strong></td><td>The total amount of collateral you hold in your account (USD balance - USD proceeds from opening short positions)</td></tr><tr><td><strong><code>free_collateral</code></strong></td><td>The collateral available for opening new short positions</td></tr><tr><td><strong><code>margin_level</code></strong></td><td>Your account's current risk level (<code>equity</code> / <code>position_notional</code>). null if you have no active positions</td></tr><tr><td><strong><code>margin_call_level</code></strong></td><td>The <code>margin_level</code> at which you will receive a notification from sFOX to let you know that your <code>margin_level</code> is low and we suggest either closing positions or depositing additional collateral (USD) to avoid liquidation</td></tr><tr><td><strong><code>maintenance_margin_level</code></strong></td><td>The <code>margin_level</code> at which your position will be automatically liquidated</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;">200</mark></summary>

```json
{
    "account_value": 100885.75696235,
    "equity": 97850.05595684,
    "position_notional": 88153.20356472,
    "collateral": 97850.05595684,
    "free_collateral": 97850.05595684,
    "margin_level": 1.11,
    "margin_call_level": 0.15,
    "maintenance_margin_level": 0.05
}
```

</details>

<details>

<summary><mark style="color:red;">403</mark>: Forbidden</summary>

```json
//Your account does not have Margin enabled
{
    "error": "account is not enabled for margin trading"
}
```

</details>

### Example Requests

{% tabs %}
{% tab title="Shell" %}

```bash
curl -H 'Authorization: Bearer <API_TOKEN>' \
https://api.sfox.com/v1/margin/account
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/margin/account',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.get(
  "https://api.sfox.com/v1/margin/account",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sfox.com/rest-api/shorting/get-account-risk-metrics.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
