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

# Create a dish

> Create a dish and define the dish's details. 

The client app will display the `name`, `description`, and `price` and will use the `category` to determine where to display the dish in the menu. The server will check the dish's `ingredient_id` to ensure essential ingredients are in stock (if not in stock, the dish will be disabled in the client app). 

The KDS will use the `station`, `preparation_time`, and `ingredients` array when prioritizing and prepping the dish.




## OpenAPI

````yaml openapi.yaml post /dishes
openapi: 3.0.3
info:
  title: Point of Service (POS) API
  version: '1.0'
  description: >
    An example of a restaurant point of sale API, used to learn how to make API
    calls using Swagger, Github codespaces, and Postman, and to learn API
    documentation best practices.
  contact:
    name: Course Discord server
    url: https://discord.gg/dPsnz5u9
    email: mark.wentowski@docsgeek.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev
    description: The server URL used for the point of service API
    variables:
      gh-codespaces-server-url:
        default: https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev
        description: >-
          Codespace URL used by Sarah Holdgrafer for Mastering API Documentation
          course.
  - url: http://localhost:80/
    description: Local URL for testing
security: []
tags:
  - name: Orders
    description: Methods for creating and managing orders in the client app.
  - name: Dishes
    description: Methods for creating and managing dishes in the client app.
  - name: Ingredients
    description: Methods used for creating and managing ingredients in the client app .
  - name: Users
    description: >-
      Methods for creating and managing the user accounts allowed to access the
      client app.
  - name: Auth
    description: Authentication endpoints for the client app (all methods use Basic auth).
paths:
  /dishes:
    post:
      tags:
        - Dishes
      summary: Create a dish
      description: >
        Create a dish and define the dish's details. 


        The client app will display the `name`, `description`, and `price` and
        will use the `category` to determine where to display the dish in the
        menu. The server will check the dish's `ingredient_id` to ensure
        essential ingredients are in stock (if not in stock, the dish will be
        disabled in the client app). 


        The KDS will use the `station`, `preparation_time`, and `ingredients`
        array when prioritizing and prepping the dish.
      operationId: postDishes
      requestBody:
        $ref: '#/components/requestBodies/CreateDishRequest'
      responses:
        '201':
          description: Dish successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dish'
          headers:
            Location:
              schema:
                type: string
              description: ...
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '403':
          description: Access denied
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '409':
          description: Unable to complete request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - AccessToken: []
components:
  requestBodies:
    CreateDishRequest:
      description: >
        The request body to create a new dish in the client app requires the
        following properties: 

        - `category`

        - `description`

        - `image_name`

        - `ingredients`
          - `ingredients.ingredient_id`
          - `ingredients.is_essential`
        - `preparation_time`

        - `name`

        - `price`

        - `station`
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
                example: Risotto alla Milanese
                description: The name of the dish to display in the client app.
              description:
                $ref: '#/components/schemas/Description'
              category:
                $ref: '#/components/schemas/Category'
              image_name:
                $ref: '#/components/schemas/ImageName'
              ingredients:
                $ref: '#/components/schemas/Ingredients'
              preparation_time:
                $ref: '#/components/schemas/PreparationTime'
              price:
                $ref: '#/components/schemas/Price'
              station:
                $ref: '#/components/schemas/Station'
            required:
              - category
              - description
              - image_name
              - ingredients
              - preparation_time
              - name
              - price
              - station
  schemas:
    Dish:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/Id'
        created_at:
          $ref: '#/components/schemas/CreatedAt'
        name:
          type: string
          example: Risotto alla Milanese
          description: The name of the dish that appears in the client app and for the KDS.
        description:
          $ref: '#/components/schemas/Description'
        category:
          $ref: '#/components/schemas/Category'
        image_name:
          $ref: '#/components/schemas/ImageName'
        ingredients:
          $ref: '#/components/schemas/Ingredients'
        preparation_time:
          $ref: '#/components/schemas/Price'
        price:
          $ref: '#/components/schemas/Price'
        station:
          $ref: '#/components/schemas/Station'
    Problem:
      type: object
      properties:
        title:
          type: string
          description: >-
            A short summary of the error or problem encountered with the
            request.
          example: Human-readable error title.
        detail:
          type: string
          description: >-
            A more detailed description of the error or problem to indicate the
            source and the solution, if possible.
          example: Human-readable error details.
      required:
        - title
        - detail
    Description:
      type: string
      example: A description of the resource.
    Category:
      type: string
      enum:
        - Appetizer
        - Main Course
        - Dessert
        - Drinks
      example: Main Course
      description: >
        Used to indicate where in the client app the dish should appear for
        ordering and used by the expediter to prioritize dishes for preparation.
    ImageName:
      type: string
      description: >
        The name of the image file related to a specific dish. When present, the
        image for the dish will appear in the client app with the other dish
        details.
      example: burger
    Ingredients:
      type: array
      description: The list of ingredients related to a specific dish.
      items:
        type: object
        properties:
          ingredient_id:
            type: string
            example: 66294b2a4475a41f3e709bc5
            description: >-
              The unique ingredient identifier, generated when the ingredient
              was created.
          is_essential:
            type: boolean
            example: true
            description: >
              When `true` the ingredient is required to prepare the dish. For
              essential ingredients, if the ingredient quantity is a
              non-positive value, the client app will disable the related dishes
              in the client app.
      example:
        - ingredient_id: 66294b2a4475a41f3e709bc5
          is_essential: true
        - ingredient_id: 66294b2a4475a41f3e709bc6
          is_essential: true
        - ingredient_id: 66294b2a4475a41f3e709bc7
          is_essential: false
    PreparationTime:
      type: integer
      description: >-
        The amount of time, in minutes, it takes to prepate the dish. Used by
        the expeditor and staff to prioritize dish preparation at the various
        stations.
      example: 45
    Price:
      type: number
      format: float
      example: 999
      description: The price used by the client app to calculate order cost.
    Station:
      type: string
      description: >
        The prep station responsible for preparing the dish. This value is used
        by the expeditor to prioritize and triage order preparation for the KDS
        stations.
      enum:
        - cold
        - hot
        - beverages
      example: hot
    Id:
      type: string
      example: 674d0bf5c28b69001f8e03a1
      readOnly: true
      description: >
        A unique alpha-numeric string generated by the system when creating a
        resource (e.g., dishes, ingredients, etc). Ids are required for
        retrieving the properties of a specific resource.
    CreatedAt:
      type: string
      format: date-time
      example: '2024-04-22T10:00:00Z'
      readOnly: true
      description: >
        The date and time the resource was created. Timestamp uses ISO 8601
        format, Ex: `2025-04-05T14:55:03.824Z` 
  securitySchemes:
    AccessToken:
      type: http
      scheme: bearer

````