# Orders

### Overview of Simplio3D API Orders Endpoints

The Simplio3D API provides a set of endpoints that allow users to manage orders efficiently. Among these endpoints, the `GET /orders/{orderId}` endpoint is specifically designed to retrieve detailed information about a particular order by its unique ID. This enables users to monitor and track individual orders, ensuring they have access to up-to-date status and details of their transactions.

For more information on utilizing the Orders endpoints, please refer to the API documentation for additional details and examples.

## <mark style="color:green;">GET</mark> /orders/{orderId}

#### GET Endpoint: Retrieve an Order by ID

**Endpoint URL**

`GET open-api/v1/orders/{orderId}`

**Description**

Retrieve detailed information about a specific order using its unique identifier.

**Path Parameter**

* `orderId`: The unique identifier for the order you wish to retrieve.

**Response**

* `200 OK`: Successfully retrieved the order details.
* `404 Not Found`: No order was found with the provided ID.
* `500 Internal Server Error`: An error occurred on the server.

**Example Request**

```http
GET open-api/v1/orders/12345
```

**Example Response**

```json
{
  "orderId": "12345",
  "customerName": "John Doe",
  "orderDate": "2023-10-05",
  "status": "Shipped",
  "items": [
    {
      "productId": "A100",
      "quantity": 2
    }
  ],
  "totalAmount": 150.00
}
```

## Get order by ID

> Get a specific order by ID.

```json
{"openapi":"3.0.0","info":{"title":"Simplio3D-Open REST API","version":"1.0.0"},"tags":[{"name":"Orders","description":"API Endpoints for managing order"}],"servers":[{"url":"https://app.simplio3d.com","description":"API Open Base URL"},{"url":""}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Enter token in format (Bearer <your_token>)"}}},"paths":{"/api/open-api/v1/orders/{id}":{"get":{"tags":["Orders"],"summary":"Get order by ID","description":"Get a specific order by ID.","operationId":"eb76b24e9cf6682e8eed49c296501063","parameters":[{"name":"id","in":"path","description":"ID of the order","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Order retrieved successfully"},"401":{"description":"Unauthorized"},"404":{"description":"Order not found"},"500":{"description":"Internal Server Error"}}}}}}
```

## <mark style="color:orange;">POST</mark> /orders

#### POST Endpoint: Create a New Order

**Endpoint URL**

`POST /orders`

**Description**

This endpoint allows you to create a new order in the system.

**Request Headers**

* `Content-Type: application/json`
* `Authorization: Bearer <token>`

**Request Body**

```json
{
  "customer_id": "string",
  "product_id": "string",
  "quantity": "integer",
  "shipping_address": {
    "street": "string",
    "city": "string",
    "postcode": "string",
    "country": "string"
  }
}
```

**Response**

* **200 OK**: Order created successfully

  ```json
  {
    "order_id": "string",
    "status": "string",
    "created_at": "datetime"
  }
  ```
* **400 Bad Request**: Invalid input data
* **401 Unauthorized**: Missing or invalid authentication token

**Example**

```bash
curl -X POST "https://api.simplio3d.com/orders" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
  "customer_id": "12345",
  "product_id": "67890",
  "quantity": 2,
  "shipping_address": {
    "street": "123 Main St",
    "city": "Anytown",
    "postcode": "12345",
    "country": "USA"
  }
}'
```

## Create a new order

> Create a new order.

```json
{"openapi":"3.0.0","info":{"title":"Simplio3D-Open REST API","version":"1.0.0"},"tags":[{"name":"Orders","description":"API Endpoints for managing order"}],"servers":[{"url":"https://app.simplio3d.com","description":"API Open Base URL"},{"url":""}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Enter token in format (Bearer <your_token>)"}},"schemas":{"OrdersResource":{"title":"Order Resource","description":"Order resource representation","properties":{"id":{"description":"Unique identifier for the order","type":"integer"},"price":{"description":"Total price of the order","type":"number","format":"float"},"status":{"description":"Status of the order","type":"string"},"customer_details":{"description":"Details of the customer","type":"object"},"configurator_summary":{"description":"Summary of the configurator options selected","type":"object"},"configurator_snapshot":{"description":"URL of the configurator snapshot image","type":"string","format":"url"},"configurator_print_map":{"description":"Array of URLs for configurator print maps","type":"array","items":{"type":"string","format":"url"}},"invoice_url":{"description":"URL for downloading the order invoice","type":"string","format":"url"},"order_shopify":{"description":"Shopify order ID if applicable","type":"string"},"created_at":{"description":"Timestamp when the order was created","type":"string","format":"date-time"},"updated_at":{"description":"Timestamp when the order was last updated","type":"string","format":"date-time"}},"type":"object"}}},"paths":{"/api/open-api/v1/orders":{"post":{"tags":["Orders"],"summary":"Create a new order","description":"Create a new order.","operationId":"024b8d6bf20cbccde5a123cc95de147d","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"required":["price","customer_details","configurator_summary","configurator_id"],"properties":{"price":{"description":"Configurator total amount","type":"number"},"customer_details":{"description":"Customer details in JSON format","type":"string"},"configurator_summary":{"description":"Configurator summary in JSON format","type":"string"},"configurator_snapshot":{"description":"Configurator snapshot image file","type":"string","format":"binary"},"configurator_print_map":{"description":"Array of print map image files","type":"array","items":{"type":"string","format":"binary"}}},"type":"object"}}}},"responses":{"201":{"description":"Order created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrdersResource"}}}},"400":{"description":"Invalid request parameters"},"401":{"description":"Unauthorized request"},"500":{"description":"Internal server error"}}}}}}
```

## <mark style="color:green;">GET</mark> /orders

#### GET Endpoint: Fetch All Orders

**Endpoint URL**

```
GET /open-api/v1/orders
```

**Description**

This endpoint retrieves a comprehensive list of all orders in the system, allowing users to manage and review order details efficiently.

**Query Parameters**

* **status** (optional): Filter orders by their status (e.g., `pending`, `completed`).
* **limit** (optional): Limit the number of orders returned.
* **offset** (optional): Specify the starting point for the list of orders returned.

**Headers**

* **Authorization**: Bearer token required for authentication.

**Response**

* **200 OK**: Successfully retrieved the list of orders.

  * **Content**: JSON array of order objects, each containing:

    * `order_id`: Unique identifier for the order.
    * `customer_name`: Name of the customer.
    * `total_amount`: Total amount of the order.
    * `status`: Current status of the order.
    * `created_at`: Timestamp of order creation.

  **Example Request**

  ```http
  GET /open-api/v1/orders?status=pending&limit=10 HTTP/1.1
  Host: api.simplio3d.com
  Authorization: Bearer your-token-here
  ```

  **Example Response**

  ```json
  [
      {
          "order_id": "12345",
          "customer_name": "John Doe",
          "total_amount": 250.00,
          "status": "pending",
          "created_at": "2023-09-12T10:20:30Z"
      },
      {
          "order_id": "12346",
          "customer_name": "Jane Smith",
          "total_amount": 135.75,
          "status": "completed",
          "created_at": "2023-09-11T08:15:00Z"
      }
  ]
  ```

  **Error Responses**

  * **401 Unauthorized**: Authentication failed; token missing or invalid.
  * **500 Internal Server Error**: An error occurred on the server.

## GET /api/open-api/v1/orders

> Fetch all orders

```json
{"openapi":"3.0.0","info":{"title":"Simplio3D-Open REST API","version":"1.0.0"},"tags":[{"name":"Orders","description":"API Endpoints for managing order"}],"servers":[{"url":"https://app.simplio3d.com","description":"API Open Base URL"},{"url":""}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Enter token in format (Bearer <your_token>)"}}},"paths":{"/api/open-api/v1/orders":{"get":{"tags":["Orders"],"summary":"Fetch all orders","operationId":"c8f29adea587435e7ae6bc3f61862859","parameters":[{"name":"per_page","in":"query","description":"Number of results per page","required":false,"schema":{"type":"integer"}},{"name":"page","in":"query","description":"Number of page","required":false,"schema":{"type":"integer"}},{"name":"order_by","in":"query","description":"Field to sort orders by","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort order (asc or desc)","required":false,"schema":{"type":"string","enum":["asc","desc"]}},{"name":"configurator_id","in":"query","description":"Filter orders by specific configurator ID","required":false,"schema":{"type":"integer"}},{"name":"start_date","in":"query","description":"Filter orders created after this date","required":false,"schema":{"type":"string","format":"date"}},{"name":"end_date","in":"query","description":"Filter orders created before this date","required":false,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"properties":{"data":{"type":"array","items":{"properties":{"configurator":{"properties":{"id":{"type":"integer"},"configurator_name":{"type":"string"}},"type":"object"}},"type":"object"}},"pagination":{"properties":{"current_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"},"last_page":{"type":"integer"},"next_page_url":{"type":"string","nullable":true},"prev_page_url":{"type":"string","nullable":true}},"type":"object"}},"type":"object"}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"}}}}}}
```

## The OrdersResource object

```json
{"openapi":"3.0.0","info":{"title":"Simplio3D-Open REST API","version":"1.0.0"},"components":{"schemas":{"OrdersResource":{"title":"Order Resource","description":"Order resource representation","properties":{"id":{"description":"Unique identifier for the order","type":"integer"},"price":{"description":"Total price of the order","type":"number","format":"float"},"status":{"description":"Status of the order","type":"string"},"customer_details":{"description":"Details of the customer","type":"object"},"configurator_summary":{"description":"Summary of the configurator options selected","type":"object"},"configurator_snapshot":{"description":"URL of the configurator snapshot image","type":"string","format":"url"},"configurator_print_map":{"description":"Array of URLs for configurator print maps","type":"array","items":{"type":"string","format":"url"}},"invoice_url":{"description":"URL for downloading the order invoice","type":"string","format":"url"},"order_shopify":{"description":"Shopify order ID if applicable","type":"string"},"created_at":{"description":"Timestamp when the order was created","type":"string","format":"date-time"},"updated_at":{"description":"Timestamp when the order was last updated","type":"string","format":"date-time"}},"type":"object"}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.simplio3d.com/api-reference/open-api/orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
