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

# Query orders

> Search and filter orders from the local database.

### Available Filters

- **text**: Free-text search across multiple fields
- **plate**: Filter by license plate (partial match)
- **person**: Filter by customer name (partial match)
- **phone**: Filter by phone number
- **email**: Filter by email address
- **status**: Filter by project status
- **damage**: Filter by damage category
- **station**: Filter by station ID
- **missing_parts**: Only show orders with missing parts
- **zu_verplanen**: Filter by "zu verplanen" status (true=unplanned, false=planned)
- **after/before**: Filter by shop date range (YYYY-MM-DD)
- **finish_after/finish_before**: Filter by finish date range

### Pagination

Use `limit` and `offset` for pagination. Maximum 1000 results per request.



## OpenAPI

````yaml /connectors/openapi/reit-openapi.json get /api/orders
openapi: 3.1.0
info:
  title: PlanSo Connector
  description: >

    ## PlanSo Order Management Integration


    This connector provides a REST API for the PlanSo workshop management
    system, enabling order synchronization and queries.


    ### Features


    - **Order Sync**: Automatic background synchronization from PlanSo to local
    SQLite database

    - **Rich Queries**: Search orders by plate, person, phone, email, status,
    damage type, and date ranges

    - **Parts Tracking**: View parts lists with order/delivery status

    - **CRUD Operations**: Create, update, and delete orders in PlanSo


    ### Sync Architecture


    The connector maintains a local SQLite database that mirrors PlanSo data:


    1. **Background Sync**: Runs automatically during business hours
    (configurable)

    2. **Manual Sync**: Trigger via `/api/sync` endpoint

    3. **Incremental Updates**: Only fetches changed orders when possible


    ### Data Model


    - **Orders**: Repair projects with customer, vehicle, and scheduling info

    - **Parts**: Individual parts linked to orders with ordering/delivery status

    - **Extended Data**: Damaged areas, documents, images (optional sync)


    ### Authentication


    All endpoints (except `/health` and `/ready`) require an `X-API-Key` header.
    Requests may also be restricted by IP whitelist.
  contact:
    name: AICO Engineering
    url: https://aicoflow.com/
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://reit.connectors.aicoflow.com
    description: Production
  - url: http://localhost:8102
    description: Local development
security:
  - ApiKeyAuth: []
tags:
  - name: Authentication
    description: PlanSo session management. Login and maintain authenticated sessions.
  - name: Sync
    description: >-
      Data synchronization operations. Trigger manual syncs and monitor sync
      status.
  - name: Orders
    description: Order management. Query, create, update, and delete repair orders.
  - name: Parts
    description: Parts information. View parts lists and status for orders.
  - name: Health
    description: Service health and readiness checks.
paths:
  /api/orders:
    get:
      tags:
        - Orders
      summary: Query orders
      description: >-
        Search and filter orders from the local database.


        ### Available Filters


        - **text**: Free-text search across multiple fields

        - **plate**: Filter by license plate (partial match)

        - **person**: Filter by customer name (partial match)

        - **phone**: Filter by phone number

        - **email**: Filter by email address

        - **status**: Filter by project status

        - **damage**: Filter by damage category

        - **station**: Filter by station ID

        - **missing_parts**: Only show orders with missing parts

        - **zu_verplanen**: Filter by "zu verplanen" status (true=unplanned,
        false=planned)

        - **after/before**: Filter by shop date range (YYYY-MM-DD)

        - **finish_after/finish_before**: Filter by finish date range


        ### Pagination


        Use `limit` and `offset` for pagination. Maximum 1000 results per
        request.
      operationId: query_orders_api_orders_get
      parameters:
        - name: text
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Free-text search query
            title: Text
          description: Free-text search query
        - name: plate
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: License plate filter
            title: Plate
          description: License plate filter
        - name: person
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Person name filter
            title: Person
          description: Person name filter
        - name: phone
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Phone number filter
            title: Phone
          description: Phone number filter
        - name: email
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Email filter
            title: Email
          description: Email filter
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Project status filter
            title: Status
          description: Project status filter
        - name: damage
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Damage category filter
            title: Damage
          description: Damage category filter
        - name: station
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: Station ID filter
            title: Station
          description: Station ID filter
        - name: missing_parts
          in: query
          required: false
          schema:
            type: boolean
            description: Filter orders with missing parts
            default: false
            title: Missing Parts
          description: Filter orders with missing parts
        - name: zu_verplanen
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Filter by zu verplanen status (true=unplanned, false=planned)
            title: Zu Verplanen
          description: Filter by zu verplanen status (true=unplanned, false=planned)
        - name: after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Shop date >= YYYY-MM-DD
            title: After
          description: Shop date >= YYYY-MM-DD
        - name: before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Shop date <= YYYY-MM-DD
            title: Before
          description: Shop date <= YYYY-MM-DD
        - name: finish_after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Finish date >= YYYY-MM-DD
            title: Finish After
          description: Finish date >= YYYY-MM-DD
        - name: finish_before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Finish date <= YYYY-MM-DD
            title: Finish Before
          description: Finish date <= YYYY-MM-DD
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000
            minimum: 1
            description: Maximum results per page
            default: 50
            title: Limit
          description: Maximum results per page
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Number of results to skip
            default: 0
            title: Offset
          description: Number of results to skip
      responses:
        '200':
          description: Paginated list of orders matching the filters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    QueryResponse:
      properties:
        success:
          type: boolean
          title: Success
        orders:
          items:
            $ref: '#/components/schemas/OrderModel'
          type: array
          title: Orders
        total:
          type: integer
          title: Total
        limit:
          type: integer
          title: Limit
        offset:
          type: integer
          title: Offset
        message:
          type: string
          title: Message
          default: ''
      type: object
      required:
        - success
        - orders
        - total
        - limit
        - offset
      title: QueryResponse
      description: Query orders response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OrderModel:
      properties:
        id:
          type: integer
          title: Id
        short_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Short Name
        plate:
          anyOf:
            - type: string
            - type: 'null'
          title: Plate
        person:
          anyOf:
            - type: string
            - type: 'null'
          title: Person
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        damage:
          anyOf:
            - type: string
            - type: 'null'
          title: Damage
        project_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Status
        station_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Station Id
        station_state:
          anyOf:
            - type: string
            - type: 'null'
          title: Station State
        shop_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Shop Date
        repair_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Repair Date
        finish_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Finish Date
        planned_delivery_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Planned Delivery Date
        parts_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Parts Status
        missing_parts:
          type: integer
          title: Missing Parts
          default: 0
        est_hours_karo:
          anyOf:
            - type: number
            - type: 'null'
          title: Est Hours Karo
        est_hours_lack:
          anyOf:
            - type: number
            - type: 'null'
          title: Est Hours Lack
        est_hours_mech:
          anyOf:
            - type: number
            - type: 'null'
          title: Est Hours Mech
        vin:
          anyOf:
            - type: string
            - type: 'null'
          title: Vin
        kba:
          anyOf:
            - type: string
            - type: 'null'
          title: Kba
        manufacturer_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Manufacturer Name
        model_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Name
        sub_model_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Sub Model Name
        engine_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Engine Type
        engine_size:
          anyOf:
            - type: string
            - type: 'null'
          title: Engine Size
        engine_power:
          anyOf:
            - type: string
            - type: 'null'
          title: Engine Power
        curb_weight:
          anyOf:
            - type: string
            - type: 'null'
          title: Curb Weight
        gross_weight:
          anyOf:
            - type: string
            - type: 'null'
          title: Gross Weight
        first_registration:
          anyOf:
            - type: string
            - type: 'null'
          title: First Registration
        last_registration:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Registration
        hu_au:
          anyOf:
            - type: string
            - type: 'null'
          title: Hu Au
        mileage:
          anyOf:
            - type: string
            - type: 'null'
          title: Mileage
        engine_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Engine Code
        country_of_origin:
          anyOf:
            - type: string
            - type: 'null'
          title: Country Of Origin
        vehicle_owner:
          anyOf:
            - type: string
            - type: 'null'
          title: Vehicle Owner
        owner_phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner Phone
        owner_address:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner Address
        appointment_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Appointment Date
        external_calculation:
          anyOf:
            - type: string
            - type: 'null'
          title: External Calculation
        express_link:
          anyOf:
            - type: string
            - type: 'null'
          title: Express Link
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        zip_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip Code
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
        zu_verplanen:
          type: integer
          title: Zu Verplanen
          default: 0
        plate_city:
          anyOf:
            - type: string
            - type: 'null'
          title: Plate City
        plate_city_phonetic:
          anyOf:
            - type: string
            - type: 'null'
          title: Plate City Phonetic
        remarks:
          anyOf:
            - type: string
            - type: 'null'
          title: Remarks
        total_net_cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Net Cost
        total_gross_cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Gross Cost
        insurance_json:
          anyOf:
            - {}
            - type: 'null'
          title: Insurance Json
        costs_json:
          anyOf:
            - {}
            - type: 'null'
          title: Costs Json
      type: object
      required:
        - id
      title: OrderModel
      description: Order/Project record.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````