Update Position Exits
Create or update position exits for an account.
Available to: Traders (own account); organization administrators (any account in their organization)
Environments: Demo, Live
Rate Limit: No endpoint-specific limit
Set when an account’s position in each contract is flattened. Pass the accountId and an items array of 1 to 256 entries, each with a contractId, an optional flattenTimestamp, and an optional repeatInterval. If the account already has a position exit for a contract, it’s replaced with the values you send (omitting flattenTimestamp or repeatInterval clears it); otherwise a new one is created. The response returns the saved position exits in userAccountPositionExits.
If some contracts fail to save, the rest are still saved. The response lists each failed contract in errorText (separated by ;), and userAccountPositionExits holds only the ones that saved.
Common Failure Scenarios
- The same
contractIdappears more than once initems. This returnsHTTP 200with"Contracts must be unique"inerrorText, and nothing is saved. - The account is archived, closed, or restricted, or its type isn’t eligible for position exits. This returns
HTTP 200with"Wrong account state"inerrorText. - No account matches
accountId, or the caller can’t access the account or its owner. All of these returnHTTP 404with an empty body. A trading permission on someone else’s account isn’t enough: a trader can only read their own user record, so the lookup of the account’s owner fails. - The caller’s user type, or the API key’s permissions, don’t include full access to the
Risksresource. This returnsHTTP 401with"Access is denied". accountIdisn’t greater than 0,itemsis empty or has more than 256 entries, or an item’scontractIdorrepeatIntervalisn’t greater than 0. These returnHTTP 400.
This endpoint returns HTTP 200 for both successful and rejected requests, so check the errorText field to confirm the result. Other failures, such as denied access or an invalid request, return their own HTTP status.
Error Messages
Authentication
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
Response
Non-empty if the request failed