# Purchase order

The `purchaseOrder` is a sub-entity of the `inboundProcess` which maps all processes around incoming goods in a store or warehouse. Whenever a `purchaseOrder` is created, a corresponding `inboundProcess` is automatically created.

Create a `purchaseOrder` by executing the following POST call with the JSON body.

```http
POST https://{YOUR-TENANT-NAME}.api.fulfillmenttools.com/api/purchaseorders
```

{% code title="Request" %}

```http
{
  "facilityRef": "CGN-01",
  "orderDate": "2025-03-12T14:15:39.683Z",
  "requestedDate": {
    "type": "TIME_POINT",
    "value": "2025-03-16T14:15:39.683Z"
  },
  "requestedItems": [
    {
      "quantity": {
        "unit": "pieces",
        "value": 100
      },
      "tenantArticleId": "22222"
    }
  ],
  "status": "OPEN",
  "supplier": {
    "name": "fulfillmenttools"
  }
}
```

{% endcode %}

A successful request returns a `201 CREATED` response with the newly created `purchaseOrder` object in the body:

{% code title="Response (201 CREATED)" %}

```json
{
    "status": "OPEN",
    "cancelled": false,
    "orderDate": "2025-03-12T14:15:39.683Z",
    "requestedDate": {
        "type": "TIME_POINT",
        "value": "2025-03-16T14:15:39.683Z"
    },
    "requestedItems": [
        {
            "tenantArticleId": "22222",
            "quantity": {
                "unit": "pieces",
                "value": 100
            }
        }
    ],
    "supplier": {
        "name": "fulfillmenttools"
    },
    "id": "38378d4e-585c-49e1-883f-1ac4faf289ad",
    "created": "2025-03-12T14:56:56.381Z",
    "lastModified": "2025-03-12T14:56:56.381Z",
    "version": 1,
    "facilityRef": "CGN-01",
    "inboundProcessRef": "2d965d89-0ef9-49a0-8380-53c2fde06134"
}
```

{% endcode %}

A `purchaseOrder` can also be created in the following ways:

* **Simultaneously with an inbound process:** Include the `purchaseOrder` data when creating a new `inboundProcess`.

```http
POST https://{YOUR-TENANT-NAME}.api.fulfillmenttools.com/api/inboundprocesses
```

* **Adding to an existing inbound process:** Add a `purchaseOrder` to an `inboundProcess` that has already been created.

```http
PUT https://{YOUR-TENANT-NAME}.api.fulfillmenttools.com/api/inboundprocesses/{inboundProcessId}/purchaseorder
```

<br>


---

# 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.fulfillmenttools.com/documentation/by-pillar/global-inventory-hub/inbound-process/purchase-order.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.
