Fulfillment Manager API · history

Refund a historical order after go live

POST /historical-orders/{orderId}/refunds

Refund a historical order after go live: money back and, per named line, units returned (restocked or not).

Issues a credit note from the refunds series reversing the tax the order recorded. 409 RefundExceedsPayments past paid less refunded; 409 OverRefund past a line's units; 409 HistoricalOrderNotRefundable while read-only (before-go-live), for an open mirrored order, or restocking a line with no SKU. Appends fulfillment.historical-order-refunded. Idempotent on refundId: a retry answers the order as it stands and appends nothing.

Access

Requires orders:write.

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

Retries

Idempotent on refundId: a retry answers the order as it stands and appends nothing.

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

Why every write carries a key: Idempotency and retries.

Facts appended

  • fulfillment.historical-order-refunded

What a fact is: Facts and the journal.

AI agent tool

Agents call this as fulfillment_refund_historical_order (Fulfillment: Refund historical order), in the orders toolset.

Connecting an agent: AI agents.

Example

curl
curl -X POST 'https://fulfillment.getmanifold.io/historical-orders/ord_01a0e100-7250-7ee1-8a68-60718293a4b5/refunds' \
  -H "Authorization: Bearer $MANIFOLD_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "refundId": "rfd_01a15a90-a580-7111-9d9b-c6d7e8f90a1b",
  "amountCents": 2400,
  "reason": "Returned unused",
  "lines": [
    {
      "lineId": "lin_ad6f099f-b8df-e1c1-4d01-3ec78fc98587",
      "quantity": 1,
      "restock": true,
      "condition": "sellable"
    }
  ]
}'
JavaScript (fetch)
const response = await fetch("https://fulfillment.getmanifold.io/historical-orders/ord_01a0e100-7250-7ee1-8a68-60718293a4b5/refunds", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "refundId": "rfd_01a15a90-a580-7111-9d9b-c6d7e8f90a1b",
    "amountCents": 2400,
    "reason": "Returned unused",
    "lines": [
      {
        "lineId": "lin_ad6f099f-b8df-e1c1-4d01-3ec78fc98587",
        "quantity": 1,
        "restock": true,
        "condition": "sellable"
      }
    ]
  }),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();
Request body · application/json
{
  "refundId": "rfd_01a15a90-a580-7111-9d9b-c6d7e8f90a1b",
  "amountCents": 2400,
  "reason": "Returned unused",
  "lines": [
    {
      "lineId": "lin_ad6f099f-b8df-e1c1-4d01-3ec78fc98587",
      "quantity": 1,
      "restock": true,
      "condition": "sellable"
    }
  ]
}
Response · 200 · application/json
{
  "id": "ord_01a0e100-7250-7ee1-8a68-60718293a4b5",
  "source": {
    "kind": "api"
  },
  "externalNumber": "#1188",
  "placedAt": "2025-11-14T03:22:10.000Z",
  "customer": {
    "personId": "psn_01a1588a-0c41-7d2e-9a10-3b5c6d7e8f90"
  },
  "currency": "AUD",
  "lines": [
    {
      "id": "lin_ad6f099f-b8df-e1c1-4d01-3ec78fc98587",
      "sku": "MUG-SPECKLE",
      "name": "Speckled stoneware mug",
      "quantity": 4,
      "unitPriceCents": 2400,
      "discountCents": 0,
      "taxCents": 873,
      "externalId": "13011223001"
    },
    {
      "id": "lin_1cb63d29-651e-6b92-7b22-38433247989f",
      "name": "Gift wrap",
      "quantity": 1,
      "unitPriceCents": 500,
      "discountCents": 0,
      "taxCents": 45
    }
  ],
  "charges": {
    "shippingCents": 1000,
    "shippingDiscountCents": 0,
    "discountCents": 0
  },
  "taxesIncluded": true,
  "money": {
    "totalCents": 11100,
    "paidCents": 11100,
    "refundedCents": 0
  },
  "outcome": "fulfilled",
  "fx": {
    "currency": "AUD",
    "home": "AUD",
    "rate": 1,
    "rateDate": "2025-11-14",
    "source": "same"
  },
  "refunds": [
    {
      "refundId": "rfd_01a15a90-a580-7111-9d9b-c6d7e8f90a1b",
      "number": "RF-00063",
      "amountCents": 2400,
      "taxCents": 0,
      "lines": [
        {
          "lineId": "lin_ad6f099f-b8df-e1c1-4d01-3ec78fc98587",
          "quantity": 1,
          "restock": true
        }
      ],
      "refundedAt": "2026-10-21T03:41:10.502Z"
    }
  ],
  "recordedAt": "2026-10-16T02:00:41.229Z",
  "updatedAt": "2026-10-21T03:41:10.502Z"
}

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
HistoricalOrderNotRefundable orderId, reason This history cannot be refunded now. reason says why.Refund it in the source system until you go live.
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.
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.