# Facilities

Facilities represent various locations that form part of the fulfillment network. These locations fulfill distinct roles in ensuring the smooth movement of goods, both inbound and outbound.&#x20;

{% hint style="success" %}
At least one facility must be created within fulfillmenttools to work.
{% endhint %}

## Facility types

There are two primary types of facilities: [**managed facilities**](https://docs.fulfillmenttools.com/documentation/products/core/facilities#managed-facilities) and [**suppliers**](https://docs.fulfillmenttools.com/documentation/products/core/facilities#suppliers).

The differentiation between managed and supplier facilities is fundamental for the efficient configuration of any fulfillment network, ensuring that each facility type is leveraged appropriately within the broader order management processes.

| Attribute                     | Managed facilities                    | Supplier facilities                         |
| ----------------------------- | ------------------------------------- | ------------------------------------------- |
| Fulfillment operations        | Managed within the network            | Managed externally by supplier              |
| Inventory role                | Storage, order fulfillment, transfers | Source of inventory                         |
| Carrier and logistics control | Full visibility and control           | Limited or no control                       |
| End customer interaction      | Direct fulfillment or pickup possible | Typically not interacting with end customer |
| Example entities              | Distribution centers, retail stores   | Manufacturers, publishers, wholesalers      |

### Managed facilities <a href="#managed-facilities" id="managed-facilities"></a>

**Managed facilities** are fulfillment locations that are directly operated and controlled within the network. The defining characteristic of these facilities is that the complete operational fulfillment process — including **picking, packing, shipping**, and related tasks — is managed internally or by a partner.

Managed facilities represent stores, warehouses, or other locations where orders can be fulfilled. A managed facility can be either type "store" or type "warehouse". The configuration made for a facility can have an influence on the routing decision as well as on the data displayed in the apps and clients

**Key attributes of managed facilities:**

* **Physical location and capabilities**: Comprehensive information regarding each facility’s address, working hours, fulfillment capacity, and handling capabilities is maintained within the system.
* [**Carrier integrations**](https://docs.fulfillmenttools.com/documentation/by-pillar/store-operations/carrier-management): Managed facilities are integrated with specific shipping carriers. The system tracks available carriers as well as their respective pickup times and schedules.
* **Fulfillment focus**: Typically, managed facilities handle **direct-to-consumer** deliveries. Orders are picked, packed, and shipped directly to the end customer. In certain cases, customers may also have the option to collect their orders directly from these facilities.
* [**Interfacility transfers**:](https://docs.fulfillmenttools.com/documentation/by-pillar/store-operations/interfacility-transfer) In addition to serving customers, managed facilities support **interfacility transfers**, enabling the efficient movement of stock between different managed locations.

### Supplier facilities <a href="#supplier-facilities" id="supplier-facilities"></a>

Suppliers are external entities within the supply chain that provide products to the network. These might include manufacturers, publishers, wholesalers, and distributors, among others.

In contrast to managed facilities, the operational responsibility at supplier locations lies entirely outside the network’s control. A supplier may operate multiple physical locations, but these individual sites are typically not known to the fulfillment network. Consequently, supplier facilities only have an optional registered addresses within the platform. Additionally, information such as working hours, capacity limits, or specific shipping carrier integrations are not maintained for supplier facilities.

**Key attributes of suppliers:**

* **External fulfillment operations**: Unlike managed facilities, the operational fulfillment processes at supplier locations are **outside the direct control** of the network. Tasks such as picking, packing, and shipping are managed by the suppliers themselves, following their own processes and schedules.
* **Supply chain role**: Suppliers primarily act as the upstream source of inventory, supplying goods to be stocked within managed facilities or shipped directly depending on the fulfillment strategy.

#### Implication on routing decisions

This lack of visibility has important implications for certain standard [routing rules](https://docs.fulfillmenttools.com/documentation/by-pillar/advanced-order-routing/routing-strategy). Since key data points about supplier facilities are unavailable, some rules can only consider the supplier part of the supply chain to a **limited extent** when dealing with supplier facilities. For example:

* The **geo distance rating** does not factor in transport routes originating from suppliers, as their exact locations might not be known.
* The **country fence** rule does not take into account the geographical location of supplier facilities.

These constraints should be considered when configuring routing strategies, especially when suppliers play a significant role in the overall fulfillment flow.

#### Supplier facility data

Supplier facility data is limited to a few key attributes due to the reasons mentioned above. These attributes are interpreted analogously to those of managed facilities:

* facility name
* facility status
* tenant facility ID

In addition, supplier facilities can be enriched with [**tags**](https://docs.fulfillmenttools.com/documentation/getting-started/tags) and [**custom attributes**](https://docs.fulfillmenttools.com/documentation/getting-started/custom-attributes) to provide further categorization or metadata.

{% hint style="info" %}
**Important information**

* Supplier facilities can also have [**listings**](https://docs.fulfillmenttools.com/documentation/by-pillar/global-inventory-hub/listing) assigned to them.
* [**Facility carrier connections**](https://docs.fulfillmenttools.com/documentation/by-pillar/store-operations/carrier-management) and [**facility custom service connections**](https://docs.fulfillmenttools.com/documentation/by-pillar/store-operations/services/custom-services) are **not** applicable for supplier facilities.
  {% endhint %}

## Facility endpoints

Full API information can be found in the [Facilities section in the REST API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/facilities).

Create a facility

{% stepper %}
{% step %}
**Make the POST request to create a facility**

```http
POST https://{projectId}.fulfillmenttools.com/api/facilities
```

{% code title="Request body example" %}

```json
{
  "name": "Nerd Herd Clothing",
  "type": "MANAGED_FACILITY",
  "address": {
    "companyName": "Nerd Herd Clothing Ltd",
    "country": "US",
    "postalCode": "90291",
    "city": "Los Angeles",
    "street": "Abbot Kinney Blvd",
    "houseNumber": "1344"
  },
    "services": [
        {
            "type": "SHIP_FROM_STORE"
        }
    ],
    "status": "ONLINE",
    "locationType": "STORE"
}
```

{% endcode %}

{% hint style="info" %}
The fields `services`, `status` and `locationType` are not required, but it is highly recommended to include at least the `services` section so the store can ship orders.
{% endhint %}

If the request is successful, you'll receive a `201 CREATED` response with a body like this:

{% code title="response.json" %}

```json
{
  "name": "Nerd Herd Clothing",
  "type": "MANAGED_FACILITY",
  "address": {
    "companyName": "Nerd Herd Clothing Ltd",
    "country": "US",
    "postalCode": "90291",
    "city": "Los Angeles",
    "street": "Abbot Kinney Blvd",
    "houseNumber": "1344"
  },
    "services": [
        {
            "type": "SHIP_FROM_STORE"
        }
    ],
    "status": "ONLINE",
    "locationType": "STORE",
    "fulfillmentProcessBuffer": 240,
    "capacityEnabled": false,
    "created": "2023-08-22T14:39:27.014Z",
    "lastModified": "2023-08-22T14:39:27.014Z",
    "version": 1,
    "id": "0dee02e8-f6a7-4080-b5ab-ffa477132f35"
}
```

{% endcode %}
{% endstep %}

{% step %}
**Add precise latitude and longitude**

Each facility needs valid geo coordinates (latitude and longitude) for use in the routing engine. If coordinates are missing in the `address` object, the system will attempt to resolve them based on the provided address (city center).

To provide precise coordinates, include `resolvedCoordinates` inside the `address` object, for example:

{% code title="address-with-coordinates.json" %}

```json
{
    // Facility object
    ...
    "address": {
        ...
        "resolvedCoordinates": {
            "lat": 50.937531,
            "lon": 6.960279
        }
    }
}
```

{% endcode %}

City center approach geo data is based on [opendatasoft](https://public.opendatasoft.com/explore/dataset/geonames-postal-code/information/) under the [CC BY 4.0 license](https://creativecommons.org/licenses/by/4.0/).

{% endstep %}
{% endstepper %}
