> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slate-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bulk Close Orders

> Close every open order for a trading account login.

Each close is its own ACID transaction via `close_order` stored procedure.
A per-ticket failure does NOT abort the batch — failures are captured in
`failed`. Already-closed tickets count as success (idempotent).

Gateway enforces the `close_position` permission on this route.



## OpenAPI

````yaml /openapi.json post /orders/bulk-close
openapi: 3.1.0
info:
  title: Slate API
  version: 1.0.0
  description: Trading infrastructure API.
servers:
  - url: https://api.{your-broker}.slate-labs.com
    variables:
      your-broker:
        default: broker
security: []
tags:
  - name: Authentication
  - name: API Tokens
  - name: Customers
  - name: Accounts
  - name: Orders
  - name: Instruments & Groups
  - name: Transactions
  - name: Payments
  - name: Transfers
  - name: Risk
  - name: Workflow & CRM
  - name: Messaging
  - name: Integrations
  - name: Webhooks
  - name: Compliance
  - name: Promo codes
  - name: Reporting
  - name: Audit
  - name: Fraud & moderation
  - name: Broker settings
  - name: Users
  - name: Roles & Teams
  - name: Streams (SSE)
  - name: Simulator
  - name: Observability
  - name: Prop trading
paths:
  /orders/bulk-close:
    post:
      tags:
        - Orders
      summary: Bulk Close Orders
      description: >-
        Close every open order for a trading account login.


        Each close is its own ACID transaction via `close_order` stored
        procedure.

        A per-ticket failure does NOT abort the batch — failures are captured in

        `failed`. Already-closed tickets count as success (idempotent).


        Gateway enforces the `close_position` permission on this route.
      operationId: bulk_close_orders_orders_bulk_close_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkCloseRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkCloseResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BulkCloseRequest:
      properties:
        login:
          type: integer
          title: Login
          description: Trading account login
        comment:
          anyOf:
            - type: string
            - type: 'null'
          title: Comment
          description: Optional close comment override
      type: object
      required:
        - login
      title: BulkCloseRequest
    BulkCloseResponse:
      properties:
        login:
          type: integer
          title: Login
        closed:
          items:
            type: integer
          type: array
          title: Closed
        failed:
          items:
            $ref: '#/components/schemas/BulkCloseFailure'
          type: array
          title: Failed
      type: object
      required:
        - login
        - closed
        - failed
      title: BulkCloseResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BulkCloseFailure:
      properties:
        ticket:
          type: integer
          title: Ticket
        reason:
          type: string
          title: Reason
      type: object
      required:
        - ticket
        - reason
      title: BulkCloseFailure
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````