Fulfillment Manager API · orders

Refund money and, for lines marked restock, walk the stock movements backwards

POST /orders/{orderId}/refunds

A refund with no lines is money only — shipping refunded for a late delivery, a goodwill credit — and reason says why. Lines are named by lineId (409 UnknownOrderLine otherwise); a kit line returns each of its parts, kits × per, in the part's own condition when named. The inventory service takes the units back (sellable to on-hand, damaged to the damaged bucket), the registry puts named sellable units back on the shelf, and accounting reverses the cost of sales they were drawn at as a cogs-reversal entry. A condition: "damaged" line additionally posts a write-down at the same drawn cost in the same fold step — revenue reversed, loss recognised, cost layers not restored; the units then sit in the damaged bucket until disposed via POST /write-offs (bucket: "damaged"), which posts no further entry. amountCents is the money going back: at most what the order has received net of earlier refunds (409 RefundExceedsPayments), so the order's money never shows a refund it was never paid for. It reverses only invoiced tax. Appends fulfillment.refunded. 409 OverRefund if a line would return more than the order shipped. refundId (a caller-minted rfd_…) is required and is the idempotency key: a retry with the same id is acknowledged with the refund already recorded and neither refunds nor restocks twice. Restocking refunds persist their validated plan before inventory calls; background recovery resumes interrupted movements before later organization mutations. The outcome fact is appended only after inventory acknowledges every return.

Access

Requires orders:write.

How scopes come from roles: Scopes and roles. Getting a token: Authentication and app tokens.

Retries

refundId (a caller-minted rfd_…) is required and is the idempotency key: a retry with the same id is acknowledged with the refund already recorded and neither refunds nor restocks twice.

A retry with the same key answers 201, with what the first call recorded.

Why every write carries a key: Idempotency and retries.

Facts appended

  • fulfillment.refunded

What a fact is: Facts and the journal.

AI agent tool

Agents call this as fulfillment_refund_order (Fulfillment: Refund order), in the fulfillment toolset. It is marked destructive, so the agent asks before running it.

Connecting an agent: AI agents.

Example

curl
curl -X POST 'https://fulfillment.getmanifold.io/orders/ord_01a156d4-8704-7a21-8b32-4c5d6e7f8091/refunds' \
  -H "Authorization: Bearer $MANIFOLD_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "refundId": "rfd_01a16470-4d50-7e61-9f72-b6c7d8e9f0a1",
  "amountCents": 2640,
  "reason": "One mug arrived chipped",
  "lines": [
    {
      "lineId": "lin_01a156d4-8704-7a21-8b32-5d6e7f809102",
      "quantity": 1,
      "restock": false,
      "condition": "damaged"
    }
  ]
}'
JavaScript (fetch)
const response = await fetch("https://fulfillment.getmanifold.io/orders/ord_01a156d4-8704-7a21-8b32-4c5d6e7f8091/refunds", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "refundId": "rfd_01a16470-4d50-7e61-9f72-b6c7d8e9f0a1",
    "amountCents": 2640,
    "reason": "One mug arrived chipped",
    "lines": [
      {
        "lineId": "lin_01a156d4-8704-7a21-8b32-5d6e7f809102",
        "quantity": 1,
        "restock": false,
        "condition": "damaged"
      }
    ]
  }),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();
Request body · application/json
{
  "refundId": "rfd_01a16470-4d50-7e61-9f72-b6c7d8e9f0a1",
  "amountCents": 2640,
  "reason": "One mug arrived chipped",
  "lines": [
    {
      "lineId": "lin_01a156d4-8704-7a21-8b32-5d6e7f809102",
      "quantity": 1,
      "restock": false,
      "condition": "damaged"
    }
  ]
}
Response · 201 · application/json
{
  "id": "ord_01a156d4-8704-7a21-8b32-4c5d6e7f8091",
  "reference": "PO-7781",
  "source": {
    "kind": "api"
  },
  "customer": {
    "companyId": "cmp_01a1588a-1f02-7a3b-8c4d-5e6f7a8b9c0d",
    "shippingAddressId": "cloc_01a1588a-1f02-7a3b-8c4d-6f7a8b9c0d1e",
    "billingAddressId": "cloc_01a1588a-1f02-7a3b-8c4d-6f7a8b9c0d1e"
  },
  "party": {
    "companyId": "cmp_01a1588a-1f02-7a3b-8c4d-5e6f7a8b9c0d",
    "name": "Harbour Ceramics Pty Ltd",
    "paymentTermsDays": 30,
    "shipTo": {
      "id": "cloc_01a1588a-1f02-7a3b-8c4d-6f7a8b9c0d1e",
      "label": "Fremantle warehouse",
      "address": {
        "firstName": "Receiving",
        "lastName": "Dock",
        "company": "Harbour Ceramics",
        "address1": "14 Kiln Street",
        "city": "Fremantle",
        "province": "Western Australia",
        "provinceCode": "WA",
        "country": "Australia",
        "countryCode": "AU",
        "zip": "6160"
      }
    },
    "billTo": {
      "id": "cloc_01a1588a-1f02-7a3b-8c4d-6f7a8b9c0d1e",
      "label": "Fremantle warehouse",
      "address": {
        "company": "Harbour Ceramics Pty Ltd",
        "address1": "PO Box 412",
        "city": "Fremantle",
        "provinceCode": "WA",
        "countryCode": "AU",
        "zip": "6959"
      }
    }
  },
  "catalogIds": [
    "cat_01a15880-2a10-7b2c-8d3e-4f5a6b7c8d9e"
  ],
  "currency": "AUD",
  "fx": {
    "currency": "AUD",
    "home": "AUD",
    "rate": 1,
    "rateDate": "2026-10-20",
    "source": "same"
  },
  "convention": "exclusive",
  "shippingTaxBasis": {
    "_tag": "calculated",
    "treatment": "domestic",
    "country": "AU",
    "class": "follows-goods",
    "rateBps": 1000
  },
  "shippingMethod": {
    "title": "Standard",
    "code": "STD"
  },
  "number": "SO-01042",
  "serial": 1042,
  "status": "partially-shipped",
  "lines": [
    {
      "id": "lin_01a156d4-8704-7a21-8b32-5d6e7f809102",
      "sku": "MUG-SPECKLE",
      "name": "Speckled stoneware mug",
      "ordered": 4,
      "removed": false,
      "catalogId": "cat_01a15880-2a10-7b2c-8d3e-4f5a6b7c8d9e",
      "discountCents": 0,
      "allocated": 4,
      "picked": 4,
      "packed": 4,
      "dispatched": 4,
      "invoiced": 4,
      "returned": 1,
      "unitPriceCents": 2400,
      "listPriceCents": 2400,
      "inclusive": false,
      "taxBasis": {
        "_tag": "calculated",
        "treatment": "domestic",
        "country": "AU",
        "parts": [
          {
            "class": "standard",
            "rateBps": 1000,
            "weight": 1
          }
        ]
      },
      "orderDiscountCents": 0,
      "tax": {
        "inclusive": false,
        "amountCents": 9600,
        "entries": [
          {
            "class": "standard",
            "treatment": "domestic",
            "country": "AU",
            "rateBps": 1000,
            "netCents": 9600,
            "taxCents": 960,
            "source": "manifold"
          }
        ],
        "netCents": 9600,
        "taxCents": 960,
        "grossCents": 10560
      }
    },
    {
      "id": "lin_01a156d4-8704-7a21-8b32-7f8091021324",
      "sku": "BOWL-SALT-L",
      "name": "Salt-glaze serving bowl, large",
      "ordered": 2,
      "removed": false,
      "catalogId": "cat_01a15880-2a10-7b2c-8d3e-4f5a6b7c8d9e",
      "discountCents": 0,
      "allocated": 2,
      "picked": 0,
      "packed": 0,
      "dispatched": 0,
      "invoiced": 0,
      "returned": 0,
      "unitPriceCents": 3800,
      "listPriceCents": 3800,
      "inclusive": false,
      "taxBasis": {
        "_tag": "calculated",
        "treatment": "domestic",
        "country": "AU",
        "parts": [
          {
            "class": "standard",
            "rateBps": 1000,
            "weight": 1
          }
        ]
      },
      "orderDiscountCents": 0,
      "tax": {
        "inclusive": false,
        "amountCents": 7600,
        "entries": [
          {
            "class": "standard",
            "treatment": "domestic",
            "country": "AU",
            "rateBps": 1000,
            "netCents": 7600,
            "taxCents": 760,
            "source": "manifold"
          }
        ],
        "netCents": 7600,
        "taxCents": 760,
        "grossCents": 8360
      }
    }
  ],
  "workflow": {
    "paymentTerms": "on-account",
    "pick": "manual",
    "pack": "manual",
    "ship": "manual",
    "invoice": "manual",
    "shortfall": "wait",
    "allocation": "single-site-preferred",
    "routing": {
      "order": "rank",
      "decider": "manifold",
      "priority": []
    },
    "routingByCatalog": {}
  },
  "paymentTermsBy": "customer",
  "createdSequence": 4096,
  "shipments": [
    {
      "id": "shp_01a156d4-8704-7a21-8b32-8091021324a5",
      "number": "SH-01057",
      "reference": "auto:ord_01a156d4-8704-7a21-8b32-4c5d6e7f8091:1",
      "status": "shipped",
      "locationId": "loc_01a0f6b0-1100-7e51-8f62-7a8b9cadbec4",
      "lines": [
        {
          "lineId": "lin_01a156d4-8704-7a21-8b32-5d6e7f809102",
          "sku": "MUG-SPECKLE",
          "quantity": 4,
          "dispatchId": "dsp_01a1588b-1a20-7b31-9c42-6e7f80910213"
        }
      ],
      "cartons": [
        {
          "packaging": "carton",
          "weightGrams": 2150,
          "size": {
            "lengthMm": 300,
            "widthMm": 250,
            "heightMm": 150
          }
        }
      ],
      "carrier": "Australia Post",
      "service": "Parcel Post",
      "trackingNumber": "33XYZ0012345",
      "trackingUrl": "https://auspost.com.au/mypost/track/details/33XYZ0012345",
      "createdAt": "2026-10-20T01:02:11.204Z",
      "updatedAt": "2026-10-20T03:12:40.000Z"
    },
    {
      "id": "shp_01a1588b-2b30-7c41-8d52-91021324a5b6",
      "number": "SH-01058",
      "reference": "PO-7781-bowls",
      "status": "cancelled",
      "locationId": "loc_01a0f6b0-1100-7e51-8f62-7a8b9cadbec4",
      "lines": [],
      "cartons": [],
      "createdAt": "2026-10-20T03:31:09.402Z",
      "updatedAt": "2026-10-20T03:33:51.660Z"
    },
    {
      "id": "shp_01a1588b-2b30-7c41-8d52-021324a5b6c7",
      "number": "SH-01059",
      "reference": "moved:PO-7781-bowls-shopfront",
      "status": "pending",
      "locationId": "loc_01a0f6b0-1100-7e51-8f62-8b9cadbecfd5",
      "lines": [
        {
          "lineId": "lin_01a156d4-8704-7a21-8b32-7f8091021324",
          "sku": "BOWL-SALT-L",
          "quantity": 2
        }
      ],
      "cartons": [],
      "createdAt": "2026-10-20T03:33:51.660Z",
      "updatedAt": "2026-10-20T03:33:51.660Z"
    }
  ],
  "invoices": [
    {
      "id": "inv_01a1588b-1a20-7b31-9c42-7f8091021324",
      "number": "INV-00871",
      "lines": [
        {
          "lineId": "lin_01a156d4-8704-7a21-8b32-5d6e7f809102",
          "sku": "MUG-SPECKLE",
          "quantity": 4,
          "unitPriceCents": 2400,
          "discountCents": 0,
          "tax": {
            "inclusive": false,
            "amountCents": 9600,
            "entries": [
              {
                "class": "standard",
                "treatment": "domestic",
                "country": "AU",
                "rateBps": 1000,
                "netCents": 9600,
                "taxCents": 960,
                "source": "manifold"
              }
            ],
            "netCents": 9600,
            "taxCents": 960,
            "grossCents": 10560
          }
        }
      ],
      "tax": {
        "netCents": 9600,
        "taxCents": 960,
        "grossCents": 10560,
        "breakdown": [
          {
            "class": "standard",
            "treatment": "domestic",
            "country": "AU",
            "rateBps": 1000,
            "exempt": false,
            "taxableCents": 9600,
            "taxCents": 960
          }
        ]
      },
      "header": {
        "kind": "tax-invoice",
        "region": "AU-GST",
        "sellerTaxNumber": "11 222 333 444",
        "buyerIdentityRequired": false,
        "presentation": "exclusive"
      },
      "totalCents": 10560,
      "shipmentId": "shp_01a156d4-8704-7a21-8b32-8091021324a5",
      "issuedAt": "2026-10-20T03:15:00.000Z"
    }
  ],
  "refunds": [
    {
      "id": "rfd_01a16470-4d50-7e61-9f72-b6c7d8e9f0a1",
      "number": "RF-00064",
      "lines": [
        {
          "lineId": "lin_01a156d4-8704-7a21-8b32-5d6e7f809102",
          "sku": "MUG-SPECKLE",
          "quantity": 1,
          "restock": false,
          "condition": "damaged",
          "tax": {
            "inclusive": false,
            "amountCents": 2400,
            "entries": [
              {
                "class": "standard",
                "treatment": "domestic",
                "country": "AU",
                "rateBps": 1000,
                "netCents": 2400,
                "taxCents": 240,
                "source": "manifold"
              }
            ],
            "netCents": 2400,
            "taxCents": 240,
            "grossCents": 2640
          }
        }
      ],
      "amountCents": 2640,
      "tax": {
        "netCents": 2400,
        "taxCents": 240,
        "grossCents": 2640,
        "breakdown": [
          {
            "class": "standard",
            "treatment": "domestic",
            "country": "AU",
            "rateBps": 1000,
            "exempt": false,
            "taxableCents": 2400,
            "taxCents": 240
          }
        ]
      },
      "header": {
        "kind": "adjustment-note",
        "region": "AU-GST",
        "sellerTaxNumber": "11 222 333 444",
        "buyerIdentityRequired": false,
        "presentation": "exclusive"
      },
      "reason": "One mug arrived chipped",
      "refundedAt": "2026-10-22T00:48:30.256Z"
    }
  ],
  "payments": [
    {
      "id": "pay_01a15f20-3c40-7d51-8e62-a5b6c7d8e9f0",
      "number": "PAY-00912",
      "amountCents": 10560,
      "method": "bank-transfer",
      "reference": "HARBOUR CERAMICS 4471",
      "receivedAt": "2026-10-21T01:10:00.000Z",
      "recordedAt": "2026-10-21T01:12:44.381Z",
      "fx": {
        "currency": "AUD",
        "home": "AUD",
        "rate": 1,
        "rateDate": "2026-10-21",
        "source": "same"
      }
    }
  ],
  "notes": [
    {
      "id": "note_01a15f6e-5e60-7f71-8a82-c7d8e9f0a1b2",
      "reference": "note-harbour-dock",
      "body": "Deliveries to the rear dock, weekdays before 3pm.",
      "by": {
        "_tag": "user",
        "id": "usr_01a15889-fa80-7b11-8c22-3d4e5f6a7b8c"
      },
      "postedAt": "2026-10-21T02:05:17.902Z"
    }
  ],
  "edits": [],
  "consignments": [],
  "money": {
    "subtotalCents": 17200,
    "charges": {
      "shippingCents": 0,
      "shippingDiscountCents": 0,
      "discountCents": 0
    },
    "discountCents": 0,
    "tax": {
      "netCents": 17200,
      "taxCents": 1720,
      "grossCents": 18920,
      "breakdown": [
        {
          "class": "standard",
          "treatment": "domestic",
          "country": "AU",
          "rateBps": 1000,
          "exempt": false,
          "taxableCents": 17200,
          "taxCents": 1720
        }
      ]
    },
    "totalCents": 18920,
    "paidCents": 10560,
    "refundedCents": 2640,
    "balanceCents": 11000,
    "refundOwedCents": 0,
    "status": "partially-refunded"
  },
  "discounts": [],
  "shortfalls": [],
  "createdAt": "2026-10-20T01:02:11.204Z",
  "updatedAt": "2026-10-22T00:48:30.256Z"
}

The panel writes this call in other languages. It does not send it: Manifold's APIs do not take calls from a web page on another site, so run the call from your own code or terminal. The whole API as OpenAPI: fulfillment-manager.openapi.json. Base URL https://fulfillment.getmanifold.io.

Errors

Every refusal is a status and a JSON body whose _tag names it. A refused call changes nothing.

401

RefusalWhat it meansWhat to do
Unauthorized reason The token is missing, expired or not one Manifold issued.Get a fresh token and send the call again.
TokenAlreadyUsed tokenId A single-use app token was already spent.Mint a new token for this call.

402

RefusalWhat it meansWhat to do
SubscriptionRequired status The organization's subscription has lapsed, so writes are refused.An owner settles billing. Reads still work meanwhile.

403

RefusalWhat it meansWhat to do
TenantRequired userId The token names no organization.Choose the organization, then get a new token.
ScopeRequired required The token's roles do not grant the scope this call needs.Ask an owner or admin for a role that grants it.

404

RefusalWhat it meansWhat to do
FulfillmentOrderNotFound orderId No such record in this organization.Check the id in the path or the body.
ItemNotFound sku No such record in this organization.Check the id in the path or the body.

409

RefusalWhat it meansWhat to do
UnknownOrderLine orderId, lineId A line named is not on the order or the parcel.Use the lin_ ids from the order.
OverRefund orderId, lineId, sku, dispatched, previouslyReturned, requested More units would come back than the line shipped.Return at most what shipped, less earlier returns.
RefundExceedsPayments orderId, requested, refundableCents The refund is more than the order has been paid, less earlier refunds. refundableCents says how much can go back.Refund at most refundableCents.
CreditHolderMismatch orderId, holderId The request was refused, and nothing changed.Nothing changed. Read the record, then decide.
MirroredFromSource source This area is fed by your source system until the organization goes live.Make the change in the source system, or go live first.

502

RefusalWhat it meansWhat to do
InventoryUnavailable reason The inventory service did not answer, so nothing changed.Send the same request again, with the same key.

503

RefusalWhat it meansWhat to do
RequestLogUnavailable tokenId, reason The service could not record the request, so it did nothing.Send the same request again, with the same key.

How refusals work everywhere: Errors.

Used in