# Create Fulfillment Endpoint

## Structure

### Fulfillment

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id for the fulfillment</td><td>No</td></tr><tr><td>`reference`</td><td>string</td><td>The reference for the fulfillment</td><td>No</td></tr><tr><td>`state`</td><td>string</td><td>The state of the fulfillment (defaults to method's default if not passed)</td><td>No</td></tr><tr><td>`method`</td><td>int| string</td><td>The fulfillment method's id, name or driver (defaults to orders' default if not passed)</td><td>No</td></tr><tr><td>`tracking_code`</td><td>string</td><td>The tracking code for the fulfillment</td><td>No</td></tr><tr><td>`tracking_url`</td><td>url</td><td>The tracking url for the fulfillment</td><td>No</td></tr><tr><td>`weight`</td><td>float</td><td>The total weight of the fulfillment (calculated from items if not passed)</td><td>No</td></tr><tr><td>`weight_unit`</td><td>string</td><td>The weight unit (defaults to store's default if not provided)</td><td>No</td></tr><tr><td>`volume`</td><td>float</td><td>The total volume of the fulfillment (calculated from items if not passed)</td><td>No</td></tr><tr><td>`volume_unit`</td><td>string</td><td>The volume unit (defaults to store's default if not provided)</td><td>No</td></tr><tr><td>`delivery_note`</td><td>string</td><td>The delivery note for the fulfillment</td><td>No</td></tr><tr><td>`notify`</td><td>boolean</td><td>Whether the fulfillment notifications are activated (defaults to `true`)</td><td>No</td></tr><tr><td>`dispatched_at`</td><td>timestamp</td><td>The dispatched at of the fulfillment</td><td>No</td></tr><tr><td>`items`</td><td>array</td><td>An array of [Item](https://support.aerocommerce.com/books/api/page/create-fulfillment-endpoint#bkmrk-fulfillment-item) objects (if not passed every fulfillable item is fulfilled)</td><td>No</td></tr></tbody></table>

**Valid fulfillment states:** `failed`, `pending`, `open`, `successful`, `canceled`, `errored`

### Fulfillment Item

<table border="1" id="bkmrk-name-type-descriptio-1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the order item to be fulfilled</td><td>Conditional `*`</td></tr><tr><td>`sku`</td><td>string</td><td>The sku of the order item to be fulfilled</td><td>Conditional `*`</td></tr><tr><td>`quantity`</td><td>int</td><td>The quantity to be fulfilled (defaults to max possible)</td><td>No</td></tr><tr><td>`weight`</td><td>float</td><td>The weight of the item (uses order item's weight if not passed)</td><td>No</td></tr><tr><td>`weight_unit`</td><td>string</td><td>The weight unit (defaults to store's default if not provided)</td><td>No</td></tr><tr><td>`volume`</td><td>float</td><td>The volume of the fulfillment (uses order item's volume if not passed)</td><td>No</td></tr><tr><td>`volume_unit`</td><td>string</td><td>The volume unit (defaults to store's default if not provided)</td><td>No</td></tr></tbody></table>

`*` One of id or sku must be provided.

## Example Requests

<details id="bkmrk-fulfill-specific-ite"><summary>Fulfill Specific Items</summary>

```
POST /api/orders/{id|reference}/fulfillments
```

```json
{
    "reference": "F1-API",
    "tracking_code": "Test tracking code",
    "tracking_url": "http://aero.test",
    "delivery_note": "Test delivery note",
    "items": [
        {
            "sku": "ABC-123",
            "quantity": 1,
            "weight": 10,
            "weight_unit": "oz",
            "volume": 0.5,
            "volume_unit": "m^3"
        },
        {
            "sku": "DEF-456"
        }
    ]
}
```

</details><details id="bkmrk-fulfill-all-items-po"><summary>Fulfill All Items</summary>

```
POST /api/orders/{id|reference}/fulfillments
```

```json
{
    "reference": "F2-API",
    "tracking_code": "Test tracking code",
    "tracking_url": "http://aero.test",
    "delivery_note": "Test delivery note",
}
```

</details>## Example Response

```json
{
    "fulfillment": {
        "id": 1
    }
}
```