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

# Create an order

> Create a new record with optional child records.



## OpenAPI

````yaml /api-reference/openapi.json post /order/order/
openapi: 3.0.3
info:
  title: Fail Fast API
  version: v1
  description: >-
    REST API for the Fail Fast platform. Authenticate with a workspace API key
    sent as a bearer token. Every response uses the `{message, error, data}`
    envelope.
servers:
  - url: https://api.failfast.ai
security: []
paths:
  /order/order/:
    post:
      tags:
        - Sales
      summary: Create an order
      description: Create a new record with optional child records.
      operationId: order_order_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Order'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Order'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Order'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - error
                  - data
                properties:
                  message:
                    type: string
                    description: Human-readable outcome of the request.
                  error:
                    type: boolean
                    description: true when the request failed.
                    example: false
                  data:
                    $ref: '#/components/schemas/Order'
          description: ''
      security:
        - apiKey: []
components:
  schemas:
    Order:
      type: object
      description: |-
        A ModelSerializer that takes an additional `fields` argument that
        controls which fields should be displayed.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        custom_fields:
          nullable: true
        operation_number:
          type: integer
          maximum: 2147483647
          minimum: 0
          default: 0
        operation_date:
          type: string
          format: date-time
        description:
          type: string
          nullable: true
        operation_status:
          $ref: '#/components/schemas/OperationStatusEnum'
        status_description:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        deleted_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        audit_status:
          allOf:
            - $ref: '#/components/schemas/AuditStatusEnum'
          readOnly: true
        validation_date:
          type: string
          format: date-time
        discount_percentage:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        number_order_customer:
          type: string
        subtotal:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        discount_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        additional_discount_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        insurance_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        freight_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        total:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        order_state:
          $ref: '#/components/schemas/OrderStateEnum'
        tree:
          nullable: true
        member:
          type: string
          format: uuid
          readOnly: true
        operation:
          type: string
          format: uuid
        market_exchange_rate:
          type: string
          format: uuid
          nullable: true
        branch_office:
          type: string
          format: uuid
        created_by:
          type: string
          format: uuid
          readOnly: true
        updated_by:
          type: string
          format: uuid
          readOnly: true
          nullable: true
        deleted_by:
          type: string
          format: uuid
          readOnly: true
          nullable: true
        customer:
          type: string
          format: uuid
        customer_detail:
          type: string
          format: uuid
          nullable: true
        location:
          type: string
          format: uuid
          nullable: true
        salesman:
          type: string
          format: uuid
        commercial_condition:
          type: string
          format: uuid
        discount_type:
          type: string
          format: uuid
          nullable: true
        price_list_type:
          type: string
          format: uuid
        warehouse:
          type: string
          format: uuid
          nullable: true
      required:
        - audit_status
        - branch_office
        - commercial_condition
        - created_at
        - created_by
        - customer
        - deleted_at
        - deleted_by
        - id
        - member
        - number_order_customer
        - operation
        - operation_date
        - price_list_type
        - salesman
        - updated_at
        - updated_by
    OperationStatusEnum:
      enum:
        - PR
        - CO
        - ER
      type: string
      description: |-
        * `PR` - Provisional
        * `CO` - Complete
        * `ER` - Error
    AuditStatusEnum:
      enum:
        - C
        - U
        - D
      type: string
      description: |-
        * `C` - Created
        * `U` - Updated
        * `D` - Deleted
    OrderStateEnum:
      enum:
        - CRE
        - AUT
        - CAN
        - CLO
        - PRO
        - COM
        - DIS
        - INV
      type: string
      description: |-
        * `CRE` - CREATED
        * `AUT` - AUTHORIZED
        * `CAN` - CANCELLED
        * `CLO` - CLOSED
        * `PRO` - IN_PRODUCTION
        * `COM` - PRODUCTION_COMPLETED
        * `DIS` - IN_DISPATCH
        * `INV` - INVOICED
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Workspace API key sent as a bearer token: `Authorization: Bearer
        failfast_...`. Create keys in Settings -> Workspace -> API Keys.

````