# Interact with the Order Lifecycle

#### Overview

Changing the status of an order is an important part of tillit as it controls the execution of activities. To correctly trigger these activity, the correct endpoint need to be utilised. It is not advised that you change the status of an order via the `PUT:/core/order-instance` endpoint Instead the `POST:/core/order-manager` endpoint needs to be used. Each order lifecycle state has an endpoint that you need to query to be able to succesfully move orders between.

#### Ready an Order

This will move an order from the NEW state to the READY state. It will only work while the order has a status of NEW.

```javascript
POST:/core/order-manager/ready
body: {
    id: 1 //ID of the order to be changed
}
```

#### Start Order Changeover

This will move an order from the READY state to CHANGEOVER. It will only work while the order has a status of READY and scheduledChangeOverDuration is more than 0.

```javascript
POST:/core/order-manager/changeover
body: {
    id: 1 //ID of the order to be changed
}
```

#### Start an Order

This will move an order from the READY or CHANGEOVER state to RUNNING. It will only work while the order has a status of READY or CHANGEOVER

```javascript
POST:/core/order-manager/start
body: {
    id: 1 //ID of the order to be changed
}
```

#### Complete an Order

This will move an order from the RUNNING or SUSPENDED state to COMPLETE. It will only work while the order has a status of RUNNING or SUSPENDED.

```javascript
POST:/core/order-manager/complete
body: {
    id: 1 //ID of the order to be changed
}
```

#### Suspend an Order

This will move an order from the RUNNING state to SUSPENDED. It will only work while the order has a status of RUNNING.

```javascript
POST:/core/order-manager/suspend
body: {
    id: 1 //ID of the order to be changed
}
```

#### Resume an Order

This will move an order from the CANCELLED, SUSPENDED or COMPLETED state to RUNNING. It will only work while the order has a status of CANCELLED, SUSPENDED or COMPLETED.

```javascript
POST:/core/order-manager/resume
body: {
    id: 1 //ID of the order to be changed
}
```

#### Cancel an Order

This will move an order from the READY or NEW state to CANCELLED. It will only work while the order has a status of READY or NEW.

```javascript
POST:/core/order-manager/cancel
body: {
    id: 1 //ID of the order to be changed
}
```


---

# 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://help.tillit.cloud/api/rest-api/examples/interact-with-the-order-lifecycle.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.
