> For the complete documentation index, see [llms.txt](https://docs.clickoptions.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clickoptions.ai/api/accounts-controller.md).

# Accounts Controller

## get user accounts

> Get user accounts

```json
{"openapi":"3.1.0","info":{"title":"fintp-public-api","version":"0.0.1"},"tags":[],"servers":[{"url":"https://api.clickoptions.ai/api","description":"Generated server url"}],"paths":{"/v1/all-accounts":{"get":{"tags":["accounts-controller"],"summary":"get user accounts","description":"Get user accounts","operationId":"getAccounts","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountDto"}}}}}}}}},"components":{"schemas":{"AccountDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"userId":{"type":"integer","format":"int32"},"commonName":{"type":"string","maxLength":255,"minLength":2},"currency":{"type":"string","maxLength":6,"minLength":3},"balance":{"type":"number","readOnly":true},"blockedBalance":{"type":"number","readOnly":true},"accountType":{"type":"string","minLength":1},"accountStatus":{"type":"string","minLength":1},"positionType":{"type":"string","minLength":1},"wl":{"type":"integer","format":"int32"},"level":{"type":"integer","format":"int32"},"internal":{"type":"boolean"},"inOutStatus":{"type":"string"},"mmBookingAccountId":{"type":"integer","format":"int64"},"equity":{"type":"number"},"tradingFeeRate":{"type":"number"},"totalPositionsCost":{"type":"number"},"balances":{"type":"array","items":{"$ref":"#/components/schemas/CcyBalanceDto"},"readOnly":true}},"required":["accountStatus","accountType","commonName","currency","positionType","userId"]},"CcyBalanceDto":{"type":"object","properties":{"curency":{"type":"string"},"balance":{"type":"number"},"blockedBalance":{"type":"number"}}}}}}
```

## Get account total P\&L

> Get total P\&L for current account across all closed/exercised positions

```json
{"openapi":"3.1.0","info":{"title":"fintp-public-api","version":"0.0.1"},"tags":[],"servers":[{"url":"https://api.clickoptions.ai/api","description":"Generated server url"}],"paths":{"/v1/account-total-pnl":{"get":{"tags":["accounts-controller"],"summary":"Get account total P&L","description":"Get total P&L for current account across all closed/exercised positions","operationId":"getAccountTotalPnL","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccountTotalPnLDto"}}}}}}}},"components":{"schemas":{"AccountTotalPnLDto":{"type":"object","description":"Total PnL data for a specific account across all closed/exercised positions","properties":{"totalPremium":{"type":"string","description":"Sum of premium totals for all positions (received/paid premiums)"},"totalExercisePl":{"type":"string","description":"Sum of exercise P&L for all positions"},"totalRealizedPnl":{"type":"string","description":"Total realized P&L (premiumTotal + exercisePl)"},"totalFee":{"type":"string","description":"Total fees paid for all positions"},"positionCount":{"type":"integer","format":"int64","description":"Count of closed/exercised positions for this account"},"averagePnlPerPosition":{"type":"string","description":"Average PnL per position (computed)"}}}}}}
```

## Get account info for current api-key

> Get current trading acount

```json
{"openapi":"3.1.0","info":{"title":"fintp-public-api","version":"0.0.1"},"tags":[],"servers":[{"url":"https://api.clickoptions.ai/api","description":"Generated server url"}],"paths":{"/v1/account-info":{"get":{"tags":["accounts-controller"],"summary":"Get account info for current api-key","description":"Get current trading acount","operationId":"getAccountInfo","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccountDto"}}}}}}}},"components":{"schemas":{"AccountDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"userId":{"type":"integer","format":"int32"},"commonName":{"type":"string","maxLength":255,"minLength":2},"currency":{"type":"string","maxLength":6,"minLength":3},"balance":{"type":"number","readOnly":true},"blockedBalance":{"type":"number","readOnly":true},"accountType":{"type":"string","minLength":1},"accountStatus":{"type":"string","minLength":1},"positionType":{"type":"string","minLength":1},"wl":{"type":"integer","format":"int32"},"level":{"type":"integer","format":"int32"},"internal":{"type":"boolean"},"inOutStatus":{"type":"string"},"mmBookingAccountId":{"type":"integer","format":"int64"},"equity":{"type":"number"},"tradingFeeRate":{"type":"number"},"totalPositionsCost":{"type":"number"},"balances":{"type":"array","items":{"$ref":"#/components/schemas/CcyBalanceDto"},"readOnly":true}},"required":["accountStatus","accountType","commonName","currency","positionType","userId"]},"CcyBalanceDto":{"type":"object","properties":{"curency":{"type":"string"},"balance":{"type":"number"},"blockedBalance":{"type":"number"}}}}}}
```
