> ## 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.

# Admin

# Point of Service API Admin Flow

The admin panel is used to create user accounts for the POS system, create and update dishes, and create and update dish ingredients.

To provide the proper experience for the admin panel, you'll need to provide the following capabilities:

1. Admin login
2. Create ingredients
3. Create dishes

Be sure you are familiar with the [POS authentication flow](/api-flows/auth) details.

## Step 1: Admin Login

The admin will log into the POS admin panel using their username and password.

### Request

The client sends an HTTP request to exchange the user's username and password for an access token.

**Endpoint**: `POST /auth/token`

```curl theme={null}
curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/auth/token' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic {base64EncodedclientidclientSecret}' \
  -H 'content-type: application/json' \
  -d '{
    "grant_type": "password",
    "user_name": "my-user-name",
    "password": "my-secure-password"
  }'
```

### Response

If the request was successful, the server responds with a `201 Created` status code with the response body containing access token.

## Step 2: Create Ingredients

Ingredients are components of dishes. Admins create ingredients and specify their quantity so they can track inventory and ensure patrons cannot order dishes that can't be made due to insufficient ingredient stock.

### Request

The client sends an HTTP request to create a new ingredient and specify the in stock quantity.

**Endpoint**: `POST /ingredients`

```curl theme={null}
curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/ingredients' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer {bearerToken}' \
  -H 'content-type: application/json' \
  -d '{
    "display_name": "basil",
    "name": "basil",
    "in_stock_qty": 100
  }'
```

### Response

If the request was successful, the server responds with a `201 Created` status code with the response body containing the full resource.

The `ingredient` object contains the following properties:

| Property        | Type    | Description                                                                                                        |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------ |
| `ingredient_id` | string  | The ingredient id - used to associate an ingredient with a dish                                                    |
| `created_at`    | string  | The date and time the ingredient was created. Uses ISO 8601 standard. Ex: `2025-04-05T14:55:03.824Z`               |
| `updated_at`    | string  | The date and time the ingredient was most recently updated. Uses ISO 8601 standard. Ex: `2025-04-05T14:55:03.824Z` |
| `display_name`  | string  | The ingredient name that will appear in the POS system for patrons and staff                                       |
| `name`          | string  | The ingredient name used primarily in the admin panel                                                              |
| `in_stock_qty`  | integer | The quantity of the ingredient currently available - used to track that an ingredient has a positive quantity      |

## Step 3: Create Dishes

Admins create dishes by associated them with the necessary ingredients.

The request body for creating dishes should contain the following properties:

| Property                    | Type             | Description                                                                                                |
| --------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------- |
| `display_name`              | string           | *Required* The dish name that appears in the POS system for patrons and staff                              |
| `name`                      | string           | *Required* The dish name used primarily in the admin panel                                                 |
| `description`               | string           | *Required* The long-text description of the dish.                                                          |
| `category`                  | enum string      | *Required* The category the dish belongs to. Values: `Appetizers`, `Main Course`, `Dessert`, and `Drinks`. |
| `preparation_time`          | integer          | *Optional* The time it takes to prepare the dish, in minutes.                                              |
| `price`                     | number           | *Required* The price of the dish.                                                                          |
| `image_name`                | string           | *Optional* The name of the image associated with the dish, if available.                                   |
| `station`                   | enum string      | *Required* The name of the station the dish is prepared at. Values: `hot`, `cold`, `beverage`              |
| `ingredients`               | array of objects | *Required* Object that contains the ingredient details of the ingredients included in the dish.            |
| `ingredients.ingredient_id` | string           | *Required* The id of the ingredient                                                                        |
| `ingredients.is_essential`  | boolean          | *Required* Indicates whether this ingredient is required to make this dish or not.                         |

### Request

The client sends an HTTP request to `{describe the purpose of the API request}`.

**Endpoint**: `POST /dishes`

```curl theme={null}
curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/dishes' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer {bearerToken}' \
  -H 'content-type: application/json' \
  -d '{
    "display_name": "Caprese Salad",
    "name": "Caprese Salad",
    "description": "Deconstructed tomato, basil, and fresh mozzeralla with a sprinkle of balsamic vinegar.",
    "category": "Appetizers",
    "price": 899,
    "station": "cold",
    "ingredients": [
      {
        "ingredient_id": "tomatoIngredientId",
        "is_essential": true
      },
      {
        "ingredient_id": "basilIngredientId",
        "is_essential": true
      },
      {
        "ingredient_id": "mozzIngredientId",
        "is_essential": true
      },
      {
        "ingredient_id": "balsVinegarIngredientId",
        "is_essential": true
      },
    ]
  }'
```

### Response

If the request was successful, the server responds with a `201 Created` status code with the response body containing new resource and the `dish_id`, which you'll use in numerous requests in both the [patron](/api-flows/patron) and [staff](/api-flows/staff) flows.
