> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://partner.ninjatrader.com/connect/api/rest-api-endpoints/risks/set-admin-auto-liq-action/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://partner.ninjatrader.com/_mcp/server. # Set Admin Auto Liq Action POST https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction Content-Type: application/json ### Set the auto-liquidation action for an account.**Available to:** Organization administrators**Environments:** Demo**[Rate Limit](/overview/core-concepts/rate-limits):** No endpoint-specific limitSet the auto-liquidation action for an account. Use this endpoint to lock an account (rejecting new orders), trigger liquidation, or unlock it by setting the action back to `Normal`.The status set by this endpoint is **persistent**. A locked or liquidated account stays in that state until you explicitly call this endpoint again with `adminAction` set to `Normal`. It does not auto-unlock at the next trading session, time out, or reset on its own.There is no bulk version of this endpoint. You must call it separately for each account.**`adminAction` Values**| Value | Effect | | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `Normal` | Clears any restriction on the account and allows trading to resume. Use this to unlock an account after a lock or liquidation action. | | `LockTradingImmediately` | Immediately locks the account. All orders are rejected. Open positions are not liquidated. | | `LiquidateImmediately` | Immediately liquidates all open positions and locks the account. All orders are rejected. | | `LiquidateOnlyModeImmediately` | Immediately restricts the account to closing orders only. New position-opening orders are rejected. Open positions are not liquidated. | | `PlaceAutoLiqOnHold` (Internal) | Temporarily pauses auto-liquidation for one minute, then resumes.This value is not intended for partner workflows because it is set automatically by the system during internal risk processing. | | `DisableAutoLiq` (Internal) | Permanently disables auto-liquidation on the account.This value is not intended for partner workflows because it is set automatically by the system during internal risk processing. | | `AgreedOnLiqOnlyModeByAutoLiq` (Internal) | Temporarily suppresses auto-liquidation for one minute while allowing liquidate-only mode to trigger.This value is not intended for partner workflows because it is set automatically by the system during internal risk processing. | | `AgreedOnLiquidationByAutoLiq` (Internal) | Reserved.This value is not intended for partner workflows because it is set automatically by the system during internal risk processing. |**`adminActionReasonCode` Values**Most partners use `Other` (with a descriptive `adminActionReason`). The `Close*` and `Restricted*` codes are used internally for brokerage account management.When `adminActionReasonCode` is `Other`, you must provide an `adminActionReason` describing why you're taking the action. For all other reason codes, `adminActionReason` is optional.**Common Partner Workflows**- **Lock an account:** Set `adminAction` to `LockTradingImmediately` to prevent new orders. The account's open positions are not affected. - **Liquidate and lock:** Set `adminAction` to `LiquidateImmediately`, then call the endpoint again with `adminAction` set to `LockTradingImmediately`. - **Only block new positions:** Set `adminAction` to `LiquidateOnlyModeImmediately`. The account can still close existing positions but cannot open new ones. - **Unlock an account:** Set `adminAction` to `Normal` to allow the account to resume trading. - **Unlock after a daily loss limit breach** (`doNotUnlock` enabled): If the account's [`doNotUnlock`](/overview/prop-firm-management/risk-management/post-trade-risk) field is set to `true`, a daily loss limit breach locks the account and the lock does not auto-reset at the next market open. Call this endpoint with `Normal` before the next trading session to let the trader resume. The `doNotUnlock` setting stays in place for future sessions. - **Account remediation:** Use this endpoint alongside [`changeDemoBalance`](/api/rest-api-endpoints/accounting/change-demo-balance) and [`updateMaxNetLiq`](/api/rest-api-endpoints/risks/update-max-net-liq) to reset an account after an incident.**Best Practices**- Track active accounts on your end and avoid calling this endpoint on archived accounts. The endpoint accepts requests for archived accounts without returning an error, which can lead to unnecessary API calls and rate limit issues. - Verify the account status after calling this endpoint by checking the `accountRiskStatus` object in the response or by calling `accountRiskStatus/deps`.**Common Failure Scenarios**- `accountId` does not reference a valid account (returns `HTTP 404`) - `adminActionReasonCode` is `Other` but `adminActionReason` is missing - `adminActionReason` exceeds 8,192 characters - Caller is not an organization administrator on the Demo environment (returns `HTTP 401`)**Error Messages**| `errorText` | Trigger | | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `"Account Id should be greater than 0"` | `accountId` is 0 or negative | | `"Admin Action should be between Normal and LiquidateImmediately"` | `adminAction` is not a valid enum value | | `"Admin Action Reason Code should be between CloseAMLDecision and Other"` | `adminActionReasonCode` is not a valid enum value | | `"Admin Action Reason should be no longer than 8192"` | `adminActionReason` exceeds 8,192 characters | | `"Admin Action Reason should be specified"` | `adminActionReasonCode` is `Other` but no `adminActionReason` was provided | | `"Access is denied"` | Caller is not an organization administrator, or the request was sent to the Live environment | | `"This endpoint should be called on live.tradovateapi.com"` | Called on the replay environment | Reference: https://partner.ninjatrader.com/connect/api/rest-api-endpoints/risks/set-admin-auto-liq-action ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects a SetAdminAutoLiqAction. - `accountId` (long, required) - `adminAction` (enum, required) — AgreedOnLiqOnlyModeByAutoLiq, AgreedOnLiquidationByAutoLiq, DisableAutoLiq, LiquidateImmediately, LiquidateOnlyModeImmediately, LockTradingImmediately, Normal, PlaceAutoLiqOnHold - Allowed values: `AgreedOnLiqOnlyModeByAutoLiq`, `AgreedOnLiquidationByAutoLiq`, `DisableAutoLiq`, `LiquidateImmediately`, `LiquidateOnlyModeImmediately`, `LockTradingImmediately`, `Normal`, `PlaceAutoLiqOnHold` - `adminActionReasonCode` (enum, required) — CloseAMLDecision, CloseComplianceDecision, CloseCustomerRequest, CloseDeceased, CloseEscheatment, CloseFraud, CloseInactiveUnfundedAccount, FullBalanceWithdrawal, Other, PartnerPayoutLock, RequalificationReset, RestrictedAMLRequest, RestrictedAccountsRequest, RestrictedComplianceRequest, RestrictedRiskRestriction, RestrictedSubaccountDeclineRequest, RestrictedTreasuryRequest, RestrictedW8Expired - Allowed values: `CloseAMLDecision`, `CloseComplianceDecision`, `CloseCustomerRequest`, `CloseDeceased`, `CloseEscheatment`, `CloseFraud`, `CloseInactiveUnfundedAccount`, `FullBalanceWithdrawal`, `Other`, `PartnerPayoutLock`, `RequalificationReset`, `RestrictedAMLRequest`, `RestrictedAccountsRequest`, `RestrictedComplianceRequest`, `RestrictedRiskRestriction`, `RestrictedSubaccountDeclineRequest`, `RestrictedTreasuryRequest`, `RestrictedW8Expired` - `adminActionReason` (string, optional) ## Response ### 200 AccountRiskStatusResponse - `errorText` (string, optional) — Non-empty if the request failed - `accountRiskStatus` (AccountRiskStatus, optional) ## Types ### AccountRiskStatus - `id` (long, optional) - `adminAction` (enum, optional) — AgreedOnLiqOnlyModeByAutoLiq, AgreedOnLiquidationByAutoLiq, DisableAutoLiq, LiquidateImmediately, LiquidateOnlyModeImmediately, LockTradingImmediately, Normal, PlaceAutoLiqOnHold - Allowed values: `AgreedOnLiqOnlyModeByAutoLiq`, `AgreedOnLiquidationByAutoLiq`, `DisableAutoLiq`, `LiquidateImmediately`, `LiquidateOnlyModeImmediately`, `LockTradingImmediately`, `Normal`, `PlaceAutoLiqOnHold` - `adminTimestamp` (datetime, optional) - `liquidateOnly` (datetime, optional) - `userTriggeredLiqOnly` (boolean, optional) - `maxNetLiq` (double, optional) — $ Max Net Liq - `minNetLiq` (double, optional) — $ Min Net Liq ## Examples **Request** ```json { "accountId": 1, "adminAction": "AgreedOnLiqOnlyModeByAutoLiq", "adminActionReasonCode": "CloseAMLDecision" } ``` **Response** ```json { "errorText": "string", "accountRiskStatus": { "id": 1, "adminAction": "AgreedOnLiqOnlyModeByAutoLiq", "adminTimestamp": "2024-01-15T09:30:00Z", "liquidateOnly": "2024-01-15T09:30:00Z", "userTriggeredLiqOnly": true, "maxNetLiq": 1.1, "minNetLiq": 1.1 } } ``` **SDK Code** ```python import requests url = "https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction" payload = { "accountId": 1, "adminAction": "AgreedOnLiqOnlyModeByAutoLiq", "adminActionReasonCode": "CloseAMLDecision" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"accountId":1,"adminAction":"AgreedOnLiqOnlyModeByAutoLiq","adminActionReasonCode":"CloseAMLDecision"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction" payload := strings.NewReader("{\n \"accountId\": 1,\n \"adminAction\": \"AgreedOnLiqOnlyModeByAutoLiq\",\n \"adminActionReasonCode\": \"CloseAMLDecision\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"accountId\": 1,\n \"adminAction\": \"AgreedOnLiqOnlyModeByAutoLiq\",\n \"adminActionReasonCode\": \"CloseAMLDecision\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"accountId\": 1,\n \"adminAction\": \"AgreedOnLiqOnlyModeByAutoLiq\",\n \"adminActionReasonCode\": \"CloseAMLDecision\"\n}") .asString(); ``` ```php request('POST', 'https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction', [ 'body' => '{ "accountId": 1, "adminAction": "AgreedOnLiqOnlyModeByAutoLiq", "adminActionReasonCode": "CloseAMLDecision" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"accountId\": 1,\n \"adminAction\": \"AgreedOnLiqOnlyModeByAutoLiq\",\n \"adminActionReasonCode\": \"CloseAMLDecision\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "accountId": 1, "adminAction": "AgreedOnLiqOnlyModeByAutoLiq", "adminActionReasonCode": "CloseAMLDecision" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://demo.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```