> ## Documentation Index
> Fetch the complete documentation index at: https://tickblaze.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deactivate a trading account

> Deactivate a trading account with a reason and, when requested, submit close-position requests for its open positions.



## OpenAPI

````yaml /openapi.json patch /api/accounts/{id}/deactivate/
openapi: 3.0.3
info:
  title: TBBO API
  version: 1.0.0
  description: >
    Authentication uses short-lived session tokens (3 hours).


    Send the token with every request using the `Authorization` header:


    ```

    Authorization: Token <token>

    ```


    Example:


    ```

    Authorization: Token 123abc456def789

    ```


    To obtain a token, call `POST /auth/login/` with valid credentials. The
    response includes a `key` value. Use that value in the header above for
    subsequent API calls.


    How to find required IDs:


    - `challenge_id`: Prop Tech Configuration -> Challenges

    - `user_id`: Tickblaze Manager -> Users

    - `account_id`: Tickblaze Manager -> Accounts 
servers: []
security: []
tags:
  - name: withdrawals
    description: Withdrawal related endpoints
    x-displayName: Withdrawals
paths:
  /api/accounts/{id}/deactivate/:
    patch:
      tags:
        - Accounts
      summary: Deactivate a trading account
      description: >-
        Deactivate a trading account with a reason and, when requested, submit
        close-position requests for its open positions.
      operationId: api_accounts_deactivate_partial_update
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedAccountDeactivateRequest'
            examples:
              DeactivateWithoutClosingPositions:
                value:
                  reason: Temporary suspension for review
                  close_positions: false
                summary: Deactivate account keeping positions open
                description: >-
                  Example of deactivating an account while leaving open
                  positions unchanged
              DeactivateAndClosePositions:
                value:
                  reason: User requested account closure
                  close_positions: true
                summary: Deactivate account and submit close-position requests
                description: >-
                  Example of deactivating an account and submitting
                  close-position requests
              DeactivateForRuleViolation:
                value:
                  reason: >-
                    Maximum drawdown limit exceeded. Account violated risk
                    management rules.
                  close_positions: true
                summary: Deactivate for breaking trading rules
                description: >-
                  Example of deactivating an account due to rule violation and
                  submitting close-position requests
              DeactivateForInactivity:
                value:
                  reason: Account inactive for 90+ days. Deactivating per policy.
                  close_positions: false
                summary: Deactivate inactive account
                description: Example of deactivating an account due to prolonged inactivity
              DeactivateForFailedEvaluation:
                value:
                  reason: >-
                    Failed Phase 1 evaluation. Daily loss limit breached on day
                    3.
                  close_positions: true
                summary: Deactivate after failed evaluation
                description: >-
                  Example of deactivating an account that failed the evaluation
                  phase
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedAccountDeactivateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedAccountDeactivateRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationResponse'
              examples:
                SuccessResponse-PositionsNotClosed:
                  value:
                    success: true
                    message: Account deactivated successfully.
                    results:
                      - account_id: 1001
                        challenge_short_code: '001122'
                        is_active: false
                        is_passed: false
                        failure_reason: Temporary suspension for review
                        failed_at: '2026-01-07T15:45:00Z'
                        deactivated_at: '2026-01-07T15:45:00Z'
                        positions_closed: false
                        open_position_count: 3
                    summary:
                      updated: 1
                      positions_closed: 0
                      position_close_requested: 0
                      position_close_submitted: 0
                      position_close_failed: 0
                    duration_ms: 45
                  summary: Successful deactivation without closing positions
                  description: >-
                    Response when account is deactivated but positions remain
                    open
                SuccessResponse-PositionsClosed:
                  value:
                    success: true
                    message: Account deactivated successfully.
                    results:
                      - account_id: 1001
                        challenge_short_code: '001122'
                        is_active: false
                        is_passed: false
                        failure_reason: >-
                          Maximum drawdown limit exceeded. Account violated risk
                          management rules.
                        failed_at: '2026-01-07T15:50:00Z'
                        deactivated_at: '2026-01-07T15:50:00Z'
                        positions_closed: true
                        open_position_count: 3
                        position_close_result:
                          success: true
                          results:
                            - symbol: ES
                              account_id: 1001
                              status: submitted
                              event_id: evt_123
                              oms_status_code: 202
                          summary:
                            requested_symbols: 1
                            submitted: 1
                            failed: 0
                          duration_ms: 102.5
                          message: Submitted close requests for 1 symbol(s).
                    summary:
                      updated: 1
                      positions_closed: 1
                      position_close_requested: 1
                      position_close_submitted: 1
                      position_close_failed: 0
                    duration_ms: 78
                  summary: Successful deactivation with close requests submitted
                  description: >-
                    Response when the account is deactivated and all required
                    close-position requests were accepted
          description: ''
      security:
        - tokenAuth: []
components:
  schemas:
    PatchedAccountDeactivateRequest:
      type: object
      properties:
        reason:
          type: string
          maxLength: 500
        close_positions:
          type: boolean
          default: false
    OperationResponse:
      type: object
      description: >-
        Standard serializer for operation responses. A command or a task should
        return a response matching this format.

        Operation = a request to perform some action, e.g. sync, update, delete,
        create, etc.
      properties:
        success:
          type: boolean
          description: Indicates whether the operation completed successfully.
        results:
          type: array
          items: {}
          description: >-
            List containing the result items produced by the operation. The
            structure of each item depends on the executed operation.
        summary:
          type: object
          additionalProperties: {}
          description: >-
            Aggregated summary information about the operation results (e.g.
            counts of updated, created, failed or unchanged records).
        duration_ms:
          type: number
          format: double
          description: Execution time of the operation in milliseconds.
        message:
          type: string
          nullable: true
          description: Optional human-readable message describing the operation outcome.
      required:
        - duration_ms
        - results
        - success
        - summary
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.