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

# Validate order type draft

> Runs every publish check on an unsaved draft and returns the report; nothing is saved. Requires permission `edit/orderType`.
Always answers 200 with `ok` (true when no check has severity `error`) and `checks`. Any part you leave out counts as empty. Pass `orderTypeId` for an existing order type to also run the checks that compare with its stored data and orders.



## OpenAPI

````yaml /openapi/public/openapi-flow.json post /order-type-validate
openapi: 3.0.0
info:
  title: API - Flow
  version: 3.0.0
  description: API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Flow
    description: >-
      Flow is the mobile field application workflow, setting it correctly is
      critical to the success of the field workers in doing their job
      efficiently. Flow attributes consist of IDs, pages, components,
      configurations, and time. The Flow will be used at Task, Automation, or
      Schedule.


      **To see the details of flow object, please follow [this
      link](#tag/flow_model)**
  - name: Automation
    description: >-
      Automation enables you to set up automation based on tasks' events and
      data source's events. It might help you automate creation of tasks, task
      assignment, task placement, task webhook, data source update, datasource
      creation, and data source webhook. Automation attributes consist of IDs,
      automation name, automation type, automation details, and rules.


      **To see the details of automation object, please follow [this
      link](#tag/automation_model)**
  - name: Order Type
    description: >-
      An order type is the blueprint for orders: the list of steps, which task
      type each step uses, and how an order moves from one step to the next.
      Order types are versioned: you edit a draft, validate or simulate it, then
      publish it. These endpoints are served under `/api/v4`.
paths:
  /order-type-validate:
    servers:
      - url: https://apiweb.mile.app/api/v4
    post:
      tags:
        - Order Type
      summary: Validate order type draft
      description: >-
        Runs every publish check on an unsaved draft and returns the report;
        nothing is saved. Requires permission `edit/orderType`.

        Always answers 200 with `ok` (true when no check has severity `error`)
        and `checks`. Any part you leave out counts as empty. Pass `orderTypeId`
        for an existing order type to also run the checks that compare with its
        stored data and orders.
      operationId: validateOrderTypeDraft
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderTypeValidateRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  message:
                    description: Message of API response.
                    type: string
                  data:
                    description: Validation report.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  message: Success
                  data:
                    ok: false
                    checks:
                      - code: ordt-109
                        rule: GR-05
                        severity: error
                        key: deadEnd
                        stepId: pickup
                        port: next
                        params: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
components:
  schemas:
    OrderTypeValidateRequest:
      example:
        orderTypeId: 6710a2f4c1d2e3f4a5b6c7d8
        fields:
          - id: orderNo
            title: Order number
            type: string
            required: true
            unique: true
            show: true
          - id: customerName
            title: Customer name
            type: string
            required: false
            show: true
          - id: weight
            title: Weight (kg)
            type: number
            required: false
            show: true
            min: 0
        statuses:
          - id: new
            label: New
            category: new
            order: 1
            color: '#6C757D'
          - id: onDelivery
            label: On delivery
            category: inProgress
            order: 2
          - id: completed
            label: Completed
            category: completed
            order: 3
          - id: cancelled
            label: Cancelled
            category: completed
            order: 4
        configuration:
          uniqueBy:
            - orderNo
          cancelStatusId: cancelled
        orderSteps:
          - id: start
            type: string
            title: Order created
            position:
              x: 0
              'y': 0
            event: onOrderCreated
            next:
              next:
                - pickup
          - id: pickup
            type: string
            title: Pickup
            position:
              x: 240
              'y': 0
            taskTypeId: 66f1b2c3d4e5f6a7b8c9d0e1
            assignee:
              mode: unassigned
            hub:
              mode: order
            quantity:
              mode: perOrder
            taskData:
              - target: title
                source:
                  ref: $order.values.orderNo
            saveToOrder: []
            next:
              next:
                - done
          - id: done
            type: string
            title: Finish
            position:
              x: 480
              'y': 0
            statusId: completed
      type: object
      properties:
        orderTypeId:
          type: string
          description: >-
            Optional id of an existing order type, to include the checks that
            compare with its stored data.
        fields:
          type: array
          items:
            type: object
            additionalProperties: true
          description: Draft fields; same format as **Update order type**.
        statuses:
          type: array
          items:
            type: object
            additionalProperties: true
          description: Draft statuses; same format as **Update order type**.
        configuration:
          type: object
          description: Draft configuration; same format as **Update order type**.
          additionalProperties: true
        orderSteps:
          type: array
          items:
            type: object
            additionalProperties: true
          description: Draft order steps; same format as **Update order type**.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````

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