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

# Optimize sweeps

> Run sweep optimization to consolidate items and reduce trips



## OpenAPI

````yaml api-reference/v1/openapi.yaml post /v1/sweeps/optimize
openapi: 3.1.0
info:
  title: Goods API
  version: 1.0.0
  description: >-
    API for Goods grocery operations - scanner app, admin dashboard, and
    customer features
  contact:
    name: Goods Team
    url: https://goods.app
servers:
  - url: http://localhost:3000
    description: Local development
  - url: https://dev.api.switchyard.run
    description: Development
  - url: https://api.switchyard.run
    description: Production
security: []
tags:
  - name: v1
    description: API v1 - unified domain-based endpoints
  - name: Scanner
    description: Scanner app endpoints for drivers and pickers
  - name: Sweeps
    description: Sweep management - retail store pickup operations
  - name: RFC Picks
    description: Ready-for-checkout picking operations
  - name: Inventory
    description: Inventory management and barcode lookup
  - name: Admin
    description: Admin dashboard endpoints
  - name: Orders
    description: Order management
  - name: Products
    description: Product catalog management
  - name: Notifications
    description: Push, email, SMS, and Slack notification management
paths:
  /v1/sweeps/optimize:
    post:
      tags:
        - Sweeps
      summary: Optimize sweeps
      description: Run sweep optimization to consolidate items and reduce trips
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                dry_run:
                  type: boolean
                  default: false
                date:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
      responses:
        '200':
          description: Optimization result
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  dry_run:
                    type: boolean
                  plan:
                    type: object
                    properties:
                      moves_count:
                        type: number
                      sweeps_to_cancel:
                        type: number
                      estimated_savings:
                        type: number
                      moves:
                        type: array
                        items:
                          type: object
                          properties:
                            from_sweep_id:
                              type: string
                              format: uuid
                            to_sweep_id:
                              type: string
                              format: uuid
                            items_count:
                              type: number
                            reason:
                              type: string
                          required:
                            - from_sweep_id
                            - to_sweep_id
                            - items_count
                            - reason
                    required:
                      - moves_count
                      - sweeps_to_cancel
                      - estimated_savings
                      - moves
                  executed:
                    type: boolean
                  moved_items:
                    type: number
                  cancelled_sweeps:
                    type: number
                required:
                  - success
                  - dry_run
                  - plan
                  - executed
                  - moved_items
                  - cancelled_sweeps
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                    example: Not found
                required:
                  - error

````