> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://partner.ninjatrader.com/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://live.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 limit

Set 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`.

<Warning>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.</Warning>

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.<br/>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.<br/>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.<br/>This value is not intended for partner workflows because it is set automatically by the system during internal risk processing. |
| `AgreedOnLiquidationByAutoLiq` (Internal) | Reserved.<br/>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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: connect
  version: 1.0.0
paths:
  /accountRiskStatus/setadminautoliqaction:
    post:
      operationId: set-admin-auto-liq-action
      summary: Set Admin Auto Liq Action
      description: >-
        ### Set the auto-liquidation action for an account.


        **Available to:** Organization administrators


        **Environments:** Demo


        **[Rate Limit](/overview/core-concepts/rate-limits):** No
        endpoint-specific limit


        Set 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`.


        <Warning>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.</Warning>


        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.<br/>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.<br/>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.<br/>This value is not intended for partner workflows because it
        is set automatically by the system during internal risk processing. |

        | `AgreedOnLiquidationByAutoLiq` (Internal) | Reserved.<br/>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 |
      tags:
        - subpackage_risks
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: AccountRiskStatusResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountRiskStatusResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetAdminAutoLiqAction'
servers:
  - url: https://live.tradovateapi.com/v1
    description: https://live.tradovateapi.com/v1
components:
  schemas:
    SetAdminAutoLiqActionAdminAction:
      type: string
      enum:
        - AgreedOnLiqOnlyModeByAutoLiq
        - AgreedOnLiquidationByAutoLiq
        - DisableAutoLiq
        - LiquidateImmediately
        - LiquidateOnlyModeImmediately
        - LockTradingImmediately
        - Normal
        - PlaceAutoLiqOnHold
      description: >-
        AgreedOnLiqOnlyModeByAutoLiq, AgreedOnLiquidationByAutoLiq,
        DisableAutoLiq, LiquidateImmediately, LiquidateOnlyModeImmediately,
        LockTradingImmediately, Normal, PlaceAutoLiqOnHold
      title: SetAdminAutoLiqActionAdminAction
    SetAdminAutoLiqActionAdminActionReasonCode:
      type: string
      enum:
        - CloseAMLDecision
        - CloseComplianceDecision
        - CloseCustomerRequest
        - CloseDeceased
        - CloseEscheatment
        - CloseFraud
        - CloseInactiveUnfundedAccount
        - FullBalanceWithdrawal
        - Other
        - RestrictedAMLRequest
        - RestrictedAccountsRequest
        - RestrictedComplianceRequest
        - RestrictedRiskRestriction
        - RestrictedTreasuryRequest
        - RestrictedW8Expired
      description: >-
        CloseAMLDecision, CloseComplianceDecision, CloseCustomerRequest,
        CloseDeceased, CloseEscheatment, CloseFraud,
        CloseInactiveUnfundedAccount, FullBalanceWithdrawal, Other,
        RestrictedAMLRequest, RestrictedAccountsRequest,
        RestrictedComplianceRequest, RestrictedRiskRestriction,
        RestrictedTreasuryRequest, RestrictedW8Expired
      title: SetAdminAutoLiqActionAdminActionReasonCode
    SetAdminAutoLiqAction:
      type: object
      properties:
        accountId:
          type: integer
          format: int64
        adminAction:
          $ref: '#/components/schemas/SetAdminAutoLiqActionAdminAction'
          description: >-
            AgreedOnLiqOnlyModeByAutoLiq, AgreedOnLiquidationByAutoLiq,
            DisableAutoLiq, LiquidateImmediately, LiquidateOnlyModeImmediately,
            LockTradingImmediately, Normal, PlaceAutoLiqOnHold
        adminActionReasonCode:
          $ref: '#/components/schemas/SetAdminAutoLiqActionAdminActionReasonCode'
          description: >-
            CloseAMLDecision, CloseComplianceDecision, CloseCustomerRequest,
            CloseDeceased, CloseEscheatment, CloseFraud,
            CloseInactiveUnfundedAccount, FullBalanceWithdrawal, Other,
            RestrictedAMLRequest, RestrictedAccountsRequest,
            RestrictedComplianceRequest, RestrictedRiskRestriction,
            RestrictedTreasuryRequest, RestrictedW8Expired
        adminActionReason:
          type: string
      required:
        - accountId
        - adminAction
        - adminActionReasonCode
      title: SetAdminAutoLiqAction
    AccountRiskStatusAdminAction:
      type: string
      enum:
        - AgreedOnLiqOnlyModeByAutoLiq
        - AgreedOnLiquidationByAutoLiq
        - DisableAutoLiq
        - LiquidateImmediately
        - LiquidateOnlyModeImmediately
        - LockTradingImmediately
        - Normal
        - PlaceAutoLiqOnHold
      description: >-
        AgreedOnLiqOnlyModeByAutoLiq, AgreedOnLiquidationByAutoLiq,
        DisableAutoLiq, LiquidateImmediately, LiquidateOnlyModeImmediately,
        LockTradingImmediately, Normal, PlaceAutoLiqOnHold
      title: AccountRiskStatusAdminAction
    AccountRiskStatus:
      type: object
      properties:
        id:
          type: integer
          format: int64
        adminAction:
          $ref: '#/components/schemas/AccountRiskStatusAdminAction'
          description: >-
            AgreedOnLiqOnlyModeByAutoLiq, AgreedOnLiquidationByAutoLiq,
            DisableAutoLiq, LiquidateImmediately, LiquidateOnlyModeImmediately,
            LockTradingImmediately, Normal, PlaceAutoLiqOnHold
        adminTimestamp:
          type: string
          format: date-time
        liquidateOnly:
          type: string
          format: date-time
        userTriggeredLiqOnly:
          type: boolean
        maxNetLiq:
          type: number
          format: double
          description: $ Max Net Liq
        minNetLiq:
          type: number
          format: double
          description: $ Min Net Liq
      title: AccountRiskStatus
    AccountRiskStatusResponse:
      type: object
      properties:
        errorText:
          type: string
          description: Non-empty if the request failed
        accountRiskStatus:
          $ref: '#/components/schemas/AccountRiskStatus'
      title: AccountRiskStatusResponse
  securitySchemes:
    bearer_access_token:
      type: http
      scheme: bearer

```

## 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://live.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction"

payload = {
    "accountId": 1,
    "adminAction": "AgreedOnLiqOnlyModeByAutoLiq",
    "adminActionReasonCode": "CloseAMLDecision"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://live.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', '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://live.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 <token>")
	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://live.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 <token>'
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<String> response = Unirest.post("https://live.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"accountId\": 1,\n  \"adminAction\": \"AgreedOnLiqOnlyModeByAutoLiq\",\n  \"adminActionReasonCode\": \"CloseAMLDecision\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://live.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction', [
  'body' => '{
  "accountId": 1,
  "adminAction": "AgreedOnLiqOnlyModeByAutoLiq",
  "adminActionReasonCode": "CloseAMLDecision"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://live.tradovateapi.com/v1/accountRiskStatus/setadminautoliqaction");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
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 <token>",
  "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://live.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()
```