> For the complete documentation index, see [llms.txt](https://docs.fulfillmenttools.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fulfillmenttools.com/documentation/by-pillar/order-management/orders.md).

# Orders

An order represents the consumer's intent as captured in the shop system. The order is the starting point for all subsequent [routing](/documentation/by-pillar/advanced-order-routing.md) and [fulfillment](/documentation/by-pillar/store-operations.md) activities.

This article focuses on creating and canceling orders that go through the process via the API. For full details about the order entity, see the [Order Management article](/documentation/by-pillar/order-management.md). To modify an order, see the [Order modification article](/documentation/by-pillar/order-management/order-modification.md). To create an order record, see the [Order records article](/documentation/by-pillar/order-management/order-records.md).

## Create an order

To create a new order at fulfillmenttools, call the following `POST` endpoint:

```http
POST https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/orders
```

{% hint style="warning" %}
Orders with the same `tenantOrderId` are only allowed if the previous orders don't have a status of open, locked, or promised. Cancel the previous orders first.
{% endhint %}

Below is an example of an order

```json
{
  "consumer": {
    "addresses": [
      {
        "salutation": "Meneer",
        "firstName": "David",
        "lastName": "van den Boomgaard",
        "street": "Rombout Hogerbeetsstraat",
        "houseNumber": "96",
        "postalCode": "1052 XM",
        "province": "Noord-Holland",
        "city": "Amsterdam",
        "country": "NL"
      }
    ],
    "email": "david.boomgaard@mail.nl"
  },
  "tenantOrderId": "R456728546",
  "orderDate": "2024-01-19T08:45:50.525Z",
  "orderLineItems": [
    {
      "article": {
        "tenantArticleId": "TSHIRT-W-2468",
        "title": "Basic T-Shirt White"
      },
      "quantity": 1
    },
    {
      "article": {
        "tenantArticleId": "SNEAK-W-4891",
        "title": "White sneakers"
      },
      "quantity": 1
    }
  ],
  "deliveryPreferences": {
    "shipping": {
      "serviceLevel": "DELIVERY"
    }
  }
}
```

If the request was successful, it returns an HTTP `200 OK` response with a body that contains some new values:

`id`: Every order has a unique generated ID for identification

`version`: Version as part of our optimistic locking mechanism

`orderLineItems[].id`: Each order line item has its ID

`status`: Every order has a status, newly posted orders always have the status `OPEN`

`processId`: A process is an entity containing every entity involved in the whole fulfilling process

`created`: Time at which the order was created in the platform

`lastModified`: Time the order was most recently modified

## Cancel an order

You can't delete an order via the API, you can only cancel an order. To do this, you'll need to change the status of the order via API, or [cancel it via Backoffice](/documentation/backoffice/network-view/orders.md#operational-actions).

To edit an order, see the [Order modification article](/documentation/by-pillar/order-management/order-modification.md).

## Order sources

When a Customer Support Manager wants to see the source for each order (for example, their own online shop or third-party platforms like Amazon, Otto, and so on) to track the order process better and respond to customer inquiries more effectively, there's an option to define `source` of the order.

Users have two options:

* `sourceRef`: Refers to the existing source in configurations.
* `tenantSourceId`: Refers to the tenant source, which is defined in the source configurations.

{% hint style="info" %}
See the [Orders API Reference](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/orders).
{% endhint %}

### Create a source

Administrators can define possible sources of an order via API.

{% tabs %}
{% tab title="Endpoint" %}

```http
GET https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/configurations/ordersources
```

```http
PUT https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/configurations/ordersources
```

{% endtab %}

{% tab title="Request example" %}

```json
{
  "version": 1,
  "ordersources": [
    {
      "tenantSourceId" : "marketplace_Amazon", // optional but must be unique
      "nameLocalized": { 
          en_US: "Amazon_en", 
          de_DE: "Amazon_de" 
      }
    }
  ]
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fulfillmenttools.com/documentation/by-pillar/order-management/orders.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
