# shipFulfilment mutation


`shipFulfilment` is a GraphQL mutation of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Marks a fulfilment as shipped by another system. Call it when a shop or a 3PL packed and sent
the goods with its own carrier.

MAX does what its own dispatch does: it issues the goods from the fulfilment's warehouse,
releases their reservations, sets the fulfilment `SHIPPED` and completes the order when nothing
more is owed. The `fulfilment.shipped` event follows, and `sales_order.completed` when the order
completes.

- MAX creates no carrier shipment, so [`Shipment`](/chameleoon-max/type/shipment) and `SalesOrder.shipments` do not list
  it. The tracking numbers you send are the fulfilment's `parcels`.
- An unpaid order ships too. It stays unpaid, and its `paymentStatus` says so.
- A cash-on-delivery amount stored on the fulfilment is kept.
- It is the same when an external system runs the warehouse's stock and reported the goods
  with [`reportExternalIssue`](/chameleoon-max/mutation/report-external-issue): MAX offsets its own issue against the report.
- A fulfilment that is `PICKING`, `PICKED` or `PACKED` in MAX ships as it stands. Boxes a
  packer weighed in MAX keep their weight and size: the tracking numbers fill them in order,
  and a number beyond them is a box of its own.

#### Permissions

Requires the `fulfilment.ship`, `issue.write`, `issue.post`, `fulfilment.read` and `order.read`
permissions, with the order and the fulfilment's warehouse in your API key's scope.

#### Repeated calls

A fulfilment already `SHIPPED` changes nothing and returns `changed: false`, so a retry after a
lost answer is safe. The repeat's tracking numbers and carrier are ignored.

#### Errors

| Code | `extensions.reason` | When |
| --- | --- | --- |
| `NOT_FOUND` | | The fulfilment does not exist or your API key cannot see it. |
| `CONFLICT` | `FULFILMENT_STATUS` | The fulfilment is cancelled (`extensions.status`). |
| `CONFLICT` | `ORDER_STATUS` | The order is a draft, cancelled or merged (`extensions.status`). |
| `CONFLICT` | `ORDER_BLOCKED` | The order is stopped in MAX. A user clears the block. |
| `CONFLICT` | `NOTHING_TO_SHIP` | The fulfilment holds nothing to send. |
| `CONFLICT` | `SHIPMENT_EXISTS` | A user created the fulfilment's carrier shipment at Chameleoon from MAX. A user cancels it there or dispatches the fulfilment in MAX. |
| `CONFLICT` | `PACKING_IN_PROGRESS`, `PACKING_REDUCED` | A packer in MAX is packing the fulfilment, or has to take out what an order edit cut. A user in MAX resolves it. |
| `CONFLICT` | `STOCK_SHORT` | The warehouse does not hold the goods to issue, or other orders hold them. |
| `CONFLICT` | `WAREHOUSE_LOCKED` | The warehouse is being counted (a stocktake). Send it again once the count is finished. |
| `CONFLICT` | `NOT_DISPATCHABLE`, or none | MAX refused the dispatch for another reason, named in the message -- for example the fulfilment is not fully reserved, because the warehouse is short of what it sends. A user in MAX resolves it. |
| `INTERNAL` | | The fulfilment changed while it was being shipped. Send it again. |
| `VALIDATION` | | More than 50 tracking numbers (field `input.trackingNumbers`), one over 128 characters (field `input.trackingNumbers[i]`), or a carrier not in the active catalogue (field `input.carrier`). |

Costs 1 point plus 1 per tracking number, plus its selection.

## Arguments

- `id`: [`UUID!`](/chameleoon-max/type/uuid) · required
- `input`: [`ShipFulfilmentInput!`](/chameleoon-max/type/ship-fulfilment-input) · required

## Returns

[`ShipFulfilmentResult!`](/chameleoon-max/type/ship-fulfilment-result)

## Example

**Mutation**

```graphql
mutation shipFulfilment($id: UUID!, $input: ShipFulfilmentInput!) {
  shipFulfilment(id: $id, input: $input) {
    fulfilment {
      id
      number
      status
      salesOrderId
      warehouseId
      shippedAt
    }
    changed
  }
}
```

**Variables**

```json
{
  "id": "00000000-0000-4000-8000-000000000001",
  "input": {}
}
```

**Response**

```json
{
  "data": {
    "shipFulfilment": {
      "fulfilment": {
        "id": "00000000-0000-4000-8000-000000000001",
        "number": "example",
        "status": "OPEN",
        "salesOrderId": "00000000-0000-4000-8000-000000000001",
        "warehouseId": "00000000-0000-4000-8000-000000000001",
        "shippedAt": "2026-01-01T00:00:00Z"
      },
      "changed": true
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
