# Fulfillment via API

Your system sends orders into **your own** Meykt organization. A partner workshop — your fulfiller — produces and ships them. You never use the fulfiller's API key: you create, change, cancel and read everything with your own key, and Meykt projects the fulfiller's progress and shipments back onto your source order.

This page describes the whole route and its current limits. The individual endpoints are documented on [Orders](/en/developers/orders), [Files](/en/developers/files), [Shipping and progress](/en/developers/shipping) and [Webhooks](/en/developers/webhooks).

## Roles

| Role | Who | Works with |
|---|---|---|
| Client | Your organization. Your ERP, shop or custom system sends orders through the API. | Your API key, your webhooks, your order IDs |
| Fulfiller | The partner organization that produces and ships for you. | A copy of your order in its own Meykt organization |

The fulfiller works on a copy. Its internal IDs never appear in your API responses; every event and read refers to **your** order and **your** item IDs.

## Before the first order

All of these are set up once in Meykt. None of them can be done through the public API today.

1. **Active partnership.** You and the fulfiller are connected in Meykt (Fulfillment → As a fulfillment customer → Fulfiller connections). Only people can send and accept that invitation.
2. **Released products.** Every product the fulfiller should produce is released to that fulfiller. An order line whose SKU is unknown in Meykt, or whose product is not released, stays with you.
3. **Handover workflow.** You have an active automation workflow with the trigger **Order Created** and the step **Transfer to fulfiller**. Without it, API orders are accepted but never reach the fulfiller: `partner_handover` stays `null`, and `POST /v1/orders/{id}/handover-retry` answers `409` with `no_handover_automation`.
4. **Your own custom fields** (if you use them) are marked **Include in fulfillment handover**. Personalization and files sent through the API travel regardless of this setting.
5. **A live key** with `orders:write`, `orders:read`, `orders:change`, `orders:cancel` and, if you send files, `files:write`. Add `inventory:read` to read your stock at the fulfiller and `webhooks:manage` to register endpoints.

## What happens to an order

1. `POST /v1/orders` creates the order in your organization and answers `201`. Unknown SKUs are accepted and reported as `item_product_unmatched` warnings.
2. Your handover workflow runs. Every line whose product is released to an active fulfiller is copied to that fulfiller. Other lines stay with you.
3. The fulfiller produces. You receive `order.production_started`, `order.production_completed` or `order.production_failed` with `"produced_by_partner": true`. `order_item.completed` is not sent for partner-produced lines.
4. The fulfiller ships from the Meykt warehouse. You receive `order.shipped` with your source line quantities, all packages and the tracking known at dispatch.
5. `GET /v1/orders/{id}/progress` shows picking, production, shipping and `attention` for your source order across all fulfillers. `GET /v1/orders/{id}/shipments` and `/dispatches` show quantities, packages and tracking.

Several fulfillers can each produce part of one order. Shipping becomes `partial` until every current source quantity has shipped.

## Handover to the fulfiller

Every order read (`GET /v1/orders/{id}`, `GET /v1/orders`) carries `partner_handover`: the stored result of the last handover.

```json
"partner_handover": {
  "state": "partial",
  "checked_at": "2026-10-31T10:00:00.000Z",
  "left_behind": [{ "item_id": "5b1f…", "reason": "no_release" }]
}
```

- `state`: `all` = every line is at a fulfiller, `partial` = some lines stayed with you, `none` = none went out, `unknown` = the stored result could not be read. `null` = the order never went to a fulfiller (no handover ran).
- `left_behind` lists **your** line IDs (`items[].id`) that are not at a fulfiller, each with a reason:

| Reason | Meaning | What helps |
|---|---|---|
| `no_product` | The line matches no product in Meykt. | Fix the SKU in Meykt, then request the handover again. |
| `no_release` | The product is not released to a fulfiller. | Release it in Meykt, then request the handover again. |
| `set_parts_no_release` | The set is released, but not every part of its bill of materials is released to the same fulfiller. The set stays with you instead of reaching the fulfiller without its parts. | Release the parts in Meykt, then request the handover again. |
| `partnership_inactive` | The partnership with the fulfiller has ended or is paused. | Clarify in Meykt. |
| `partner_chain_blocked` | Passing it on would loop or go too deep through fulfillers. | Clarify with the partners. |
| `partner_order_open` | The fulfiller already holds an open order for this order; nothing is added to it. | Wait, or cancel there and request again. |
| `transfer_failed` | The copy could not be created. | Request the handover again. |
| `payment_pending` | Unpaid orders are held for this fulfiller. | Resolves itself when the order is paid. |
| `shop_location_pending`, `shop_location_unassigned`, `shop_location_split`, `shop_location_other_partner` | Shopify location allocation (orders from Shopify only). | Clarify in Shopify or Meykt. |
| `other` | A reason this API version does not know yet. | Check the order in Meykt. |

Subscribe explicitly to `order.partner_handover_incomplete` (a new or changed gap) and `order.partner_handover_completed` (a reported gap has closed). Both carry the same `partner_handover` object. Repeated runs with the same result send nothing.

**Request the handover again.** After releasing a product, `POST /v1/orders/{id}/handover-retry` (scope `orders:change`, empty body) runs the same handover as "Request fulfillment again" in Meykt:

```bash
curl -X POST https://api.meykt.com/v1/orders/{id}/handover-retry \
  -H "Authorization: Bearer $MEYKT_API_KEY"
```

The answer names what this attempt did (`outcome`) and the stored state afterwards (`partner_handover`):

If the attempt finishes but its stored state cannot be read, the response is `503 service_unavailable`. Read the order's current `partner_handover` before deciding on another action. The error does not mean the handover failed, and the response never substitutes the earlier state for the current one.

| `outcome` | Meaning |
|---|---|
| `handed_over` | Lines went to a fulfiller (`created_partner_orders` new orders there). |
| `partially_handed_over` | Some lines went out; see `left_behind`. |
| `already_handed_over` | Everything was already at the fulfiller. |
| `partner_order_open` | The fulfiller still has an open order for it; no second one was created. |
| `waiting_for_own_production` | Your workflow waits for your own production first. |
| `not_handed_over` | Nothing went out; see `left_behind`. |
| `handover_step_not_reached` | Your workflow ended before its handover step. |

Sending it twice never creates a second fulfiller order. Rejected with `409`: test orders (`test_order`), cancelled, completed or shipped orders (`order_closed`), no handover workflow (`no_handover_automation`), and orders that already have production in your own Meykt (`own_production_exists`) — handing those over again would produce them twice, so a person decides that in Meykt.

## Personalization and files

- **Line personalization, typed fields and line files** arrive at the fulfiller completely, on the matching line.
- **Order-level personalization, `note`, `warehouse_note` and `priority`** arrive with every copy.
- **Order-level files** go to **every** fulfiller of the order, including a fulfiller that only receives some of the lines. Attach artwork to the line it belongs to whenever you can.
- **Always set a `role`** on each file (for example `logo`). The fulfiller's workflows select files by role; a file without a role cannot be chosen there.
- Storage: your original counts against your plan. Each fulfiller's copy counts against the fulfiller's plan — once per uploaded file and fulfiller order, even if many lines use it.

## Changes and cancellation

`PATCH /v1/orders/{id}` and `POST /v1/orders/{id}/cancel` reach the fulfiller. Before it starts work, its copy is replaced or cancelled directly or after its approval, depending on its setting. After it has started, it is always asked: it sees the changed lines and your `message`, and if it agrees, it stops its production, chooses whether booked services stay billed, and Meykt hands over the new version ([details](/en/developers/orders#after-work-has-started-at-the-partner)).

| Command result | Meaning |
|---|---|
| `completed` | Applied, including the fulfiller's copy. |
| `decision_required` with `partner_approval_required` | The fulfiller must approve. Keep reading the command until it ends. |
| `rejected` with `partner_declined` | The fulfiller declined. Your order is unchanged. |
| `decision_required` with `partner_orders_parallel` | The fulfiller holds more than one execution order; someone in Meykt must resolve that first. |
| `rejected` with `partner_forwarded` | The fulfiller passed the work on. Clarify with the partners involved. |
| `rejected` with `order_work_started` | Work started on your own order, or the fulfiller's order is already completed or shipped. The API cannot change or cancel the order any more. |

A change replaces the complete line list. Send **every** line with its `external_line_id`, not only the changed one.

**The fulfiller cancels on its own.** A fulfiller can cancel its order for yours — for example when an article is no longer available. It writes a message with an optional reason (the same reasons as for questions). You receive `order.partner_cancelled` with `reason` and `note`, the thread shows the cancellation, and `partners[].status` becomes `cancelled`. Your own order stays open: request fulfillment again, produce it elsewhere or cancel it. If Shopify had assigned the order to the fulfiller's Meykt location, Meykt gives that part back in Shopify (the order stays open there); requesting fulfillment again requests it in Shopify again. Subscribe explicitly to `order.partner_cancelled`.

## Questions and messages

Every order at a fulfiller has one conversation between you and the fulfiller. It is the same thread your team sees on the order in Meykt.

**The fulfiller asks.** When something blocks the work — an undeliverable address, an unusable file, unclear personalization — the fulfiller asks a question with a reason. Its order goes to `query` and its automations wait. You receive `order.message_received` with `message.kind: "question"` and the reason, and `order.production_held` with the same reason.

| Reason | Typical case |
|---|---|
| `address_undeliverable` | The carrier rejects the address. |
| `file_unusable` | A file is too small, damaged or the wrong format. |
| `personalization_unclear` | The text or option cannot be produced as given. |
| `item_unavailable` | Material or the article is missing. |
| `deadline_at_risk` | The order will be late. |
| `other` | Anything else; read the text. |

**You answer.** `POST /v1/orders/{id}/messages` with `idempotency_key`, `body` and `reply_to` (the id of the fulfiller's message). If the order is with several fulfillers and you do not reply to a message, name the fulfiller with `partner_order_number` from `partners`.

```bash
curl -X POST https://api.meykt.com/v1/orders/{id}/messages \
  -H "Authorization: Bearer $MEYKT_API_KEY" -H "Content-Type: application/json" \
  -d '{ "idempotency_key": "6f2c…", "body": "The house number is 21, not 12.", "reply_to": "b41e…" }'
```

**Wrong address?** `POST /v1/orders/{id}/shipping-address` changes only the shipping address — also after work has started — and passes it on to every fulfiller order without a shipping label at once (`passed_on_to_partners`). Where a label exists or the parcel is gone, Meykt changes nothing silently; both sides see an open point (`too_late_at_partners`). Send your answer in the same call with `message` and `reply_to`; the address is saved first, then the message.

```bash
curl -X POST https://api.meykt.com/v1/orders/{id}/shipping-address \
  -H "Authorization: Bearer $MEYKT_API_KEY" -H "Content-Type: application/json" \
  -d '{ "idempotency_key": "9a1d…", "address": { "name": "Mara Keller", "line1": "Hauptstr. 21", "postal_code": "79098", "city": "Freiburg", "country": "DE" },
        "message": "Sorry, typo — it is 21.", "reply_to": "b41e…" }'
```

**The fulfiller continues.** Your answer does not end the question by itself; the fulfiller decides that it is enough. Then you receive `order.production_resumed` (and, as before, `order.production_started` when production runs again).

**Pause, hold and failure with a reason.** When the fulfiller pauses or holds an order, you receive `order.production_held` with `fulfillment_status` (`query`, `paused`, `on_hold`), `reason` and `note`. A failure reported by the fulfiller adds `reason` and `note` to `order.production_failed`.

**Read the thread.** `GET /v1/orders/{id}/messages` returns all messages oldest first, `open_question`, and `partners` with name, order number and status at each fulfiller. `from` is `you` or `partner`; `read_at` shows when the other side read a message.

Subscribe explicitly to `order.message_received`, `order.production_held` and `order.production_resumed`.

## Current limits

These are known gaps. Plan your integration around them.

- **Test orders are never handed to a fulfiller.** To test the full route, use a live key with a real order and cancel it before the fulfiller starts work.
- **Releasing products and fixing SKUs happen in Meykt.** The API shows the gap (`partner_handover`) and requests the handover again, but cannot release a product.
- **Shipping outside the Meykt warehouse is reported by the fulfiller** — in Meykt or through its own system ([Receiving orders as a fulfiller](/en/developers/fulfiller)). It reaches you as `order.shipped` with `"source": "external"` (or `order.handed_over`), and `GET /v1/orders/{id}/completion` lists it under `partner_reports` with tracking numbers. `/progress` and `/shipments` show only warehouse shipments. Your own order keeps its status; you cannot report a handed-over order yourself (`handed_to_partner`).
- **A tracking number recorded after dispatch** appears in `/dispatches` but not in the v1 `/shipments` response, and it sends no new event.
- **After the fulfiller has completed or shipped its order,** no change or cancellation is possible through the API; write to the fulfiller with `POST /v1/orders/{id}/messages`.
- **Status set automatically by production** (for example a failed run) carries no reason; only states the fulfiller sets by hand carry `reason` and `note`.
- **No replacement shipment.** A lost or damaged parcel needs a new order with a new `external_order_id`.

## Stock at the fulfiller

`GET /v1/inventory` with `inventory:read` includes goods you own that are stored at an authorized fulfiller (`warehouse.origin: "partner"`). The partnership must be active and the product released. See [Inventory](/en/developers/inventory).

## For people setting this up in Meykt

The help center explains the same route from the dashboard side:

- [Fulfillment and network overview](https://help.meykt.com/en/fulfillment/ueberblick)
- [Release products](https://help.meykt.com/en/fulfillment/produkte-freigeben)
- [Handle transferred orders](https://help.meykt.com/en/fulfillment/auftraege-abwickeln)
