# Edara API v3: Work Orders

Read the [guide](../guide.md) first: authentication, paging, errors, rate limits and the shared `PagedResult`, `BatchResult` and `*Reference` shapes.

- `GET /v3/work-orders`: Lists work orders.
- `GET /v3/work-orders/{id}`: Gets a work order by id.
- `POST /v3/work-orders/issue-offering`: Creates an issue offering.
- `POST /v3/work-orders/receive-supplies`: Receives work order supplies.
- `POST /v3/work-orders/opening-balance`: Creates an opening balance.

## Endpoints

### `GET /v3/work-orders`: Lists work orders.

Operation `GetWorkOrder` · permission `read:work-order`

**Query string**: `GetWorkOrderQuery`

| field | type | default | validation | description |
|---|---|---|---|---|
| `offset` | `int?` | 0 | **no validator**: negative silently becomes 0 | Number of items to skip before returning results. Defaults to 0. |
| `limit` | `int?` | 100 | **no validator**: out of 1..1000 silently becomes 100 | Maximum number of items to return. Defaults to 100, maximum 1000. |
| `code` | `string` |  |  | Work-order document code. |
| `paperNumber` | `string` |  |  | Work-order paper number. |
| `orderDateFrom` | `DateTime?` |  |  | Inclusive lower bound of the document date range. Only used when listing. |
| `orderDateTo` | `DateTime?` |  |  | Inclusive upper bound of the document date range. Only used when listing. |
| `onlyMyOrders` | `bool` | true |  | Whether to limit results to work orders created by the current user. Only used when listing. Defaults to true. |
| `supplierId` | `int?` |  |  | Filters to work orders for this supplier. Mutually exclusive with `customerId`/`workOrderOtherPartyId`. |
| `customerId` | `int?` |  |  | Filters to work orders for this customer. Mutually exclusive with `supplierId`/`workOrderOtherPartyId`. |
| `workOrderOtherPartyId` | `int?` |  |  | Filters to work orders for this other party. Mutually exclusive with `supplierId`/`customerId`. |

**Responses**: OK `PagedResult<WorkOrderResponse>`: The paged list of matching work orders.

**Notes**

- `onlyMyOrders` defaults to `true` and also applies when you filter by `code` or `paperNumber`, not only when listing. A lookup for a document that another user created returns `200` with no items unless you set `onlyMyOrders` to `false`.
- With `onlyMyOrders` set to `true`, you only get documents created by the calling user. With `false`, you get documents created by any user.
- `code` and `paperNumber` are trimmed and match exactly.
- The supplier, customer and other-party filters match the exact id. Sending more than one of them returns `400`.
- `orderDateFrom` and `orderDateTo` are inclusive and compare against the full date and time of the document. An `orderDateTo` without a time means the start of that day, so send the end of the day to include it.
- The list is not filtered by document type: `IO`, `RS`, `RR`, `OB`, `IT`, `RT` and every other type come back together. Use `type` in the response to tell them apart.
- Results are ordered by `id`, descending.
- A page past the end of the list returns `totalCount` 0.

---

### `GET /v3/work-orders/{id}`: Gets a work order by id.

Operation `GetWorkOrderById` · permission `read:work-order`

**Parameters**

| name | in | type | default | description |
|---|---|---|---|---|
| `id` | route | `int` |  | The work order id. |

**Responses**: OK `WorkOrderResponse`: The work order.

**Notes**

- A work order of any type is returned by id. Check `type` in the response.
- You get `404` when the work order does not exist or has no lines.
- An id lookup also finds archived work orders.

---

### `POST /v3/work-orders/issue-offering`: Creates an issue offering.

Operation `CreateIssueOffering` · permission `create:work-order`

**Body**: `CreateIssueOfferingRequest`

| field | type | default | validation | description |
|---|---|---|---|---|
| `date` | `DateTime?` |  |  | The document date. |
| `serial` | `int?` |  |  | The serial number (auto-generated when omitted). |
| `paperNumber` | `string` |  | MaximumLength(50) | The paper number printed on the source document. |
| `notes` | `string` |  |  | Free-form notes captured on the document. |
| `warehouseId` | `int?` |  | NotNull().GreaterThan(0) | The id of the source warehouse the items are issued from. Required. |
| `workOrderResponsibleId` | `int?` |  |  | The id of the responsible user for the document. |
| `customerId` | `int?` |  |  | The id of the customer the items are issued to. |
| `otherPartyId` | `int?` |  |  | The id of the other party when no customer is set. |
| `salesPersonId` | `int?` |  |  | The id of the sales person credited with the issue. |
| `currencyId` | `int?` |  |  | The id of the document currency. |
| `exchangeRate` | `decimal?` |  |  | The exchange rate against the system currency at the document date. |
| `status` | `WorkOrderStatus?` |  |  | The initial document status. |
| `relatedSoCode` | `string` |  |  | The related sales-order code, when this document was sourced from a sales order. |
| `externalId` | `string` |  |  | An external identifier supplied by the caller for reconciliation. |
| `isAutoWorkOrder` | `bool?` |  |  | Whether the work order is auto-generated by an issued sales order. |
| `workOrderDetails` | `List<WorkOrderItemUpsertRequest>` | new List<WorkOrderItemUpsertRequest>() | NotNull().NotEmpty(); each: SetValidator(new WorkOrderItemUpsertRequestValidator()) | The line items on the work order. Required, at least one. |

**Responses**: Created `WorkOrderResponse`: Work order created.

**Business errors** (HTTP 409, match on `errorCode`):

- `DateMustBeLessThanSystemDate`: Date must be less than system date.
- `ErrorOrderPaperNoIsMandatory`: Order paper number is mandatory.
- `ErrorOrderResponsibleIsMandatory`: Responsible is mandatory.
- `ExchangeRateDecimalsExceedLimit`: The exchange rate decimals exceed the limit.
- `NoDefaultEvaluationCostMethod`: No default evaluation cost method is configured.
- `RelatedSODidNotPassPaymentApproval`: The related sales order did not pass payment approval.
- `SerialsCountExceedQuntity`: Entered serials exceed the line quantity.
- `msg_DocumentDateCannotbeBeforeRelatedSalesOrderDate`: Document date cannot be before the related sales order date.

**Notes**

- Send exactly one of `customerId` or `otherPartyId`. Sending both or neither returns `400`.
- Every `stockItemId` on the lines must exist, otherwise the request returns `400`. Inactive stock items are accepted.
- A `warehouseId` that does not exist returns `500`, not `400` or `404`.
- `code` and `serial` are always generated by Edara, per document type and warehouse. A `serial` you send is overwritten.
- If you omit `exchangeRate`, it is saved as 1, even when `currencyId` is a foreign currency. The current rate is never looked up, so send `exchangeRate` yourself for a foreign currency.
- If you omit `date`, the current date and time is used. A future date returns `409` with `errorCode` `DateMustBeLessThanSystemDate`.
- The document is saved all or nothing: if any step fails, nothing is saved. When the warehouse is connected to accounting, the related accounting journal entries are created in the same request.
- If the issue would make stock negative, the request returns `409` with `errorCode` `AddingItemQuantityCauseNegativeBalance` and names the stock items.
- When `relatedSoCode` refers to a sales order (the code contains SO), the request fails with `SalesOrderAlreadyIssued` if that sales order is already issued, or with `RelatedSalesOrderCancelled` if it is cancelled.
- Work order lines are matched to the sales order lines by exactly the same stock item, quantity and price, so send the same values as on the sales order.
- After a successful issue against a sales order, the sales order status changes to Shipped and its stock reservations are released.
- A `relatedSoCode` for a sales order that does not exist returns `500`.
- There is no duplicate protection. `externalId` and `paperNumber` are stored but not checked for duplicates, so a retried request creates a second document.
- `AddingItemQuantityCauseNegativeBalance`, `SalesOrderAlreadyIssued` and `RelatedSalesOrderCancelled` can be returned by this endpoint even though its error list does not include them.
- `ErrorOrderPaperNoIsMandatory`, `ErrorOrderResponsibleIsMandatory`, `RelatedSODidNotPassPaymentApproval` and `msg_DocumentDateCannotbeBeforeRelatedSalesOrderDate` are never returned by this endpoint.

---

### `POST /v3/work-orders/receive-supplies`: Receives work order supplies.

Operation `CreateReceiveSupplies` · permission `create:work-order`

**Body**: `CreateReceiveSuppliesRequest`

| field | type | default | validation | description |
|---|---|---|---|---|
| `date` | `DateTime?` |  |  | The document date. |
| `serial` | `int?` |  |  | The serial number (auto-generated when omitted). |
| `paperNumber` | `string` |  | MaximumLength(50) | The paper number printed on the source document. |
| `notes` | `string` |  |  | Free-form notes captured on the document. |
| `warehouseId` | `int?` |  | NotNull().GreaterThan(0) | The id of the destination warehouse the items are received into. Required. |
| `workOrderResponsibleId` | `int?` |  |  | The id of the responsible user for the document. |
| `supplierId` | `int?` |  |  | The id of the supplier the items are received from. |
| `otherPartyId` | `int?` |  |  | The id of the other party when no supplier is set. |
| `purchasePersonId` | `int?` |  |  | The id of the purchase person credited with the receipt. |
| `currencyId` | `int?` |  |  | The id of the document currency. |
| `exchangeRate` | `decimal?` |  |  | The exchange rate against the system currency at the document date. |
| `status` | `WorkOrderStatus?` |  |  | The initial document status. |
| `linkedDocumentCode` | `string` |  |  | The linked source document code (e.g. supplies request, purchase order). |
| `externalId` | `string` |  |  | An external identifier supplied by the caller for reconciliation. |
| `isAutoWorkOrder` | `bool?` |  |  | Whether the work order is auto-generated. |
| `workOrderDetails` | `List<WorkOrderItemUpsertRequest>` | new List<WorkOrderItemUpsertRequest>() | NotNull().NotEmpty(); each: SetValidator(new WorkOrderItemUpsertRequestValidator()) | The line items on the work order. Required, at least one. |

**Responses**: Created `WorkOrderResponse`: Work order created.

**Business errors** (HTTP 409, match on `errorCode`):

- `DateMustBeLessThanSystemDate`: Date must be less than system date.
- `ExchangeRateDecimalsExceedLimit`: The exchange rate decimals exceed the limit.
- `NoDefaultEvaluationCostMethod`: No default evaluation cost method is configured.
- `SerialsCountExceedQuntity`: Entered serials exceed the line quantity.

**Notes**

- Send exactly one of `supplierId` or `otherPartyId`. Sending both or neither returns `400`.
- Every line needs a `price` greater than 0. A line with no price or a zero price returns `400`.
- Every `stockItemId` on the lines must exist, otherwise the request returns `400`.
- If a stock item requires a batch number or an expiry date and a line does not have it, the request returns `400` and lists those lines.
- For a stock item that enforces batch and expiry and fills the batch automatically, a line with `expdate` gets its batch number replaced by that date in dd/MM/yyyy format, whatever batch number you send.
- If you omit `exchangeRate`, it is saved as 1, even when `currencyId` is a foreign currency. Edara looks up the current rate only when you send an `exchangeRate` of 0 or less.
- Without `currencyId`, the document is saved with no currency and a rate of 1.
- A `warehouseId` that does not exist returns `500`, not `400` or `404`.
- A document created here never marks a purchase order or a supplies request as received.
- `linkedDocumentCode` can hold several document codes separated by commas. Each one is stored as a separate document link.
- `code` and `serial` are always generated by Edara, per document type and warehouse. A `serial` you send is ignored.
- The document is saved all or nothing: if any step fails, nothing is saved. When the warehouse is connected to accounting, the related accounting documents are created in the same request.
- There is no duplicate protection, so a retried request creates a second document.

---

### `POST /v3/work-orders/opening-balance`: Creates an opening balance.

Operation `CreateOpeningBalance` · permission `create:work-order`

**Body**: `WorkOrderUpsertRequest`

| field | type | default | validation | description |
|---|---|---|---|---|
| `date` | `DateTime?` |  |  | The document date. |
| `serial` | `int?` |  |  | The serial number (auto-generated when omitted). |
| `paperNumber` | `string` |  | MaximumLength(50) | The paper number printed on the source document. |
| `notes` | `string` |  |  | Free-form notes captured on the document. |
| `warehouseId` | `int?` |  | NotNull().GreaterThan(0) | The id of the source warehouse the items are moved from. Required. |
| `destinationWarehouseId` | `int?` |  |  | The id of the destination warehouse for internal-transfer documents. |
| `workOrderResponsibleId` | `int?` |  |  | The id of the responsible user for the document. |
| `customerId` | `int?` |  |  | The id of the customer (for sales-related work orders). |
| `supplierId` | `int?` |  |  | The id of the supplier (for purchase-related work orders). |
| `otherPartyId` | `int?` |  |  | The id of the other party (legacy free-text party). |
| `salesPersonId` | `int?` |  |  | The id of the sales person (for sales-related work orders). |
| `purchasePersonId` | `int?` |  |  | The id of the purchase person (for purchase-related work orders). |
| `currencyId` | `int?` |  |  | The id of the document currency. |
| `exchangeRate` | `decimal?` |  |  | The exchange rate against the system currency at the document date. |
| `status` | `WorkOrderStatus?` |  |  | The initial document status. |
| `relatedSoCode` | `string` |  |  | The related sales-order code (for IO/RR documents sourced from a sales order). |
| `linkedDocumentCode` | `string` |  |  | The linked source document code (e.g. supplies request, purchase order). |
| `externalId` | `string` |  |  | An external identifier supplied by the caller for reconciliation. |
| `isAutoWorkOrder` | `bool?` |  |  | Whether the work order is auto-generated by an issued sales order. |
| `workOrderDetails` | `List<WorkOrderItemUpsertRequest>` | new List<WorkOrderItemUpsertRequest>() | NotNull().NotEmpty(); each: SetValidator(new WorkOrderItemUpsertRequestValidator()) | The line items on the work order. Required, at least one. |

**Responses**: Created `WorkOrderResponse`: Opening balance created.

**Business errors** (HTTP 409, match on `errorCode`):

- `AllDetailsAreDeleted`: All opening balance details have been marked as deleted.
- `Error_OB_StockItemDuplication`: An opening balance cannot contain duplicate stock items.
- `OB_GroupingItemsNotAllowed`: Grouping items are not allowed in an opening balance.
- `OnlyOneOpeningBalanceAllowedPerWarehouse`: Only one opening balance is allowed per warehouse.
- `PreventModifyOpeningCostAfterClosingJE`: The opening cost cannot be modified after the closing journal entry.
- `QuantityMustHaveValue`: Quantity must have a value.

**Notes**

- `date` must not be after today, and the check compares it with the start of today. Today's date with a time of day is therefore rejected with `400`, so send a date without a time.
- If you omit `date`, it is saved as today at 00:00.
- A request can carry from 1 to 5000 lines. Outside that range it returns `400`.
- Every `stockItemId` on the lines must exist, otherwise the request returns `400`.
- Stock items that use batch tracking (automatic batch numbers, enforced batch or enforced expiry) are not allowed and return `400`.
- `unitOfMeasure`, when sent, must be one of the stock item's primary units of measure, otherwise the request returns `400`.
- A `warehouseId` that does not exist returns `404`. Inactive warehouses are accepted.
- Only `stockItemId`, `quantity`, `unitPrice`, `comments` and `unitOfMeasure` are read from each line. `price`, batch and serial fields are ignored, so use `unitPrice`, not `price`. The unit conversion ratio is always saved as 1.
- If a closing journal entry already exists, the request returns `409` with `errorCode` `PreventModifyOpeningCostAfterClosingJE`.
- A warehouse can have only one opening balance. A second one returns `409` with `errorCode` `OnlyOneOpeningBalanceAllowedPerWarehouse`.
- Grouping items return `409` with `errorCode` `OB_GroupingItemsNotAllowed`.
- The same stock item on more than one line returns `409` with `errorCode` `Error_OB_StockItemDuplication`.
- `AllDetailsAreDeleted` and `QuantityMustHaveValue` are never returned here: an empty line list or a quantity of 0 or less returns `400` first.
- The customer, supplier and currency fields, `relatedSoCode` and `destinationWarehouseId` have no effect on an opening balance: they are ignored or not used to link documents.

## Types

### `CurrencyReference`

Lightweight currency reference (id + ISO code + name).

| field | type | description |
|---|---|---|
| `id` | `int` | The currency id. |
| `code` | `string` | The ISO 4217 currency code. |
| `name` | `string` | The currency name. |

### `CustomerReference`

Lightweight customer reference (id + code + name).

| field | type | description |
|---|---|---|
| `id` | `int` | The customer id. |
| `code` | `string` | The customer code. |
| `name` | `string` | The customer name. |

### `DocumentRowState`

Row-state for mutable document detail lines.

Values (sent/returned as the name): `Added`=0, `Modified`=1, `Deleted`=2

### `DocumentType`

Document type codes shared across sales, purchase, and warehouse domains.

Values (sent/returned as the name): `RS`, `RR`, `RT`, `IO`, `IR`, `IT`, `TR`, `CI`, `CO`, `JE`, `SI`, `PI`, `CN`, `DN`, `NR`, `NP`, `SO`, `SR`, `RecSO`, `PO`, `PR`, `OB`, `RMA`

### `SalesPersonReference`

Lightweight sales-person reference (id + code + name).

| field | type | description |
|---|---|---|
| `id` | `int` | The sales-person id. |
| `code` | `string` | The sales-person code. |
| `name` | `string` | The sales-person name. |

### `StockItemReference`

Lightweight stock-item reference (id + code + description).

| field | type | description |
|---|---|---|
| `id` | `int` | The stock-item id. |
| `code` | `string` | The stock-item code. |
| `description` | `string` | The stock-item description. |

### `SupplierReference`

Lightweight supplier reference (id + code + name).

| field | type | description |
|---|---|---|
| `id` | `int` | The supplier id. |
| `code` | `string` | The supplier code. |
| `name` | `string` | The supplier name. |

### `UnitOfMeasureReference`

Lightweight unit-of-measure reference (id + name).

| field | type | description |
|---|---|---|
| `id` | `int` | The unit-of-measure id. |
| `name` | `string` | The unit-of-measure name. |

### `WarehouseReference`

Lightweight warehouse reference (id + code + name).

| field | type | description |
|---|---|---|
| `id` | `int` | The warehouse id. |
| `code` | `string` | The warehouse code. |
| `name` | `string` | The warehouse name. |

### `WorkOrderItemResponse`

Response describing a work-order line item.

| field | type | description |
|---|---|---|
| `id` | `int` | The line id. |
| `workOrderHeaderId` | `int?` | The id of the parent work-order header. |
| `relatedSODetailId` | `int?` | The id of the related sales-order line, when sourced from a sales order. |
| `relatedPODetailId` | `int?` | The id of the related purchase-order line, when sourced from a purchase order. |
| `relatedSRQDetailId` | `int?` | The id of the related supplies-request line, when sourced from a supplies request. |
| `stockItem` | `StockItemReference` | The stock item on the line. |
| `unitOfMeasure` | `UnitOfMeasureReference` | The unit of measure the quantity is expressed in. |
| `uMRatio` | `decimal?` | The conversion ratio from the line UOM to the stock-item's primary UOM. |
| `quantity` | `decimal?` | The line quantity in the line UOM. |
| `returnedQuantity` | `decimal?` | The quantity returned against this line. |
| `invoicedQuantity` | `decimal?` | The quantity that has already been invoiced against this line. |
| `unitPrice` | `decimal?` | The unit price before discount and tax. |
| `price` | `decimal?` | The extended line price. |
| `dimensionsValue` | `decimal?` | The numeric value of the dimension qualifier. |
| `dimensions` | `string` | The dimension qualifier (e.g. size, color). |
| `partNumber` | `string` | The part number captured for the line. |
| `cost` | `decimal?` | The unit cost evaluated for the line. |
| `comments` | `string` | Free-form notes captured on the line. |
| `globalOnHandBalance` | `decimal?` | The on-hand balance across all warehouses at evaluation time. |
| `localOnHandBalance` | `decimal?` | The on-hand balance in the document's warehouse at evaluation time. |
| `salesPrice` | `decimal?` | The current sales price for the stock item. |
| `lastCost` | `decimal?` | The last cost recorded for the stock item. |
| `averageCost` | `decimal?` | The current average cost for the stock item. |
| `fifo` | `decimal?` | The current FIFO valuation for the stock item. |
| `lifo` | `decimal?` | The current LIFO valuation for the stock item. |
| `batchNumber` | `string` | The batch number, when the stock item is batch-tracked. |
| `productionDate` | `DateTime?` | The batch production date, when applicable. |
| `expdate` | `DateTime?` | The batch expiry date, when applicable. |
| `rowState` | `DocumentRowState?` | The row state (added / modified / removed) for partial updates. |
| `incentiveAssigneeId` | `int?` | The id of the incentive-assignee crediting on this line. |
| `incentiveDetailId` | `int?` | The id of the incentive-detail row applied to this line. |
| `packagesCount` | `int?` | The number of physical packages represented by the line quantity. |
| `unitCost` | `decimal?` | Calculated unit cost used by the material-cost endpoint. |

### `WorkOrderItemUpsertRequest`

Request to create or update a work-order line item.

| field | type | validation | description |
|---|---|---|---|
| `id` | `int?` |  | The line id (set on update only). |
| `workOrderId` | `int?` |  | The id of the parent work-order header. |
| `relatedSODetailId` | `int?` |  | The id of the related sales-order line, when sourced from a sales order. |
| `relatedPODetailId` | `int?` |  | The id of the related purchase-order line, when sourced from a purchase order. |
| `relatedSRQDetailId` | `int?` |  | The id of the related supplies-request line, when sourced from a supplies request. |
| `stockItemId` | `int?` | NotNull().GreaterThan(0) | The id of the stock item on the line. Required. |
| `unitOfMeasure` | `int?` |  | The id of the unit of measure the quantity is expressed in. |
| `uMRatio` | `decimal?` |  | The conversion ratio from the line UOM to the stock-item's primary UOM. |
| `quantity` | `decimal?` | NotNull().GreaterThan(0m) | The line quantity in the line UOM. Required. |
| `returnedQuantity` | `decimal?` |  | The quantity returned against this line. |
| `unitPrice` | `decimal?` |  | The unit price before discount and tax. |
| `price` | `decimal?` |  | The extended line price. |
| `dimensionsValue` | `decimal?` |  | The numeric value of the dimension qualifier. |
| `dimensions` | `string` |  | The dimension qualifier (e.g. size, color). |
| `partNumber` | `string` | MaximumLength(100) | The part number captured for the line. |
| `cost` | `decimal?` |  | The unit cost to evaluate the line at. |
| `comments` | `string` |  | Free-form notes captured on the line. |
| `globalOnHandBalance` | `decimal?` |  | The on-hand balance across all warehouses at evaluation time. |
| `localOnHandBalance` | `decimal?` |  | The on-hand balance in the document's warehouse at evaluation time. |
| `salesPrice` | `decimal?` |  | The current sales price for the stock item. |
| `lastCost` | `decimal?` |  | The last cost recorded for the stock item. |
| `averageCost` | `decimal?` |  | The current average cost for the stock item. |
| `fifo` | `decimal?` |  | The current FIFO valuation for the stock item. |
| `lifo` | `decimal?` |  | The current LIFO valuation for the stock item. |
| `batchNumber` | `string` | MaximumLength(100) | The batch number, when the stock item is batch-tracked. |
| `productionDate` | `DateTime?` |  | The batch production date, when applicable. |
| `expdate` | `DateTime?` |  | The batch expiry date, when applicable. |
| `rowState` | `DocumentRowState?` |  | The row state (added / modified / removed) for partial updates. |
| `incentiveAssigneeId` | `int?` |  | The id of the incentive-assignee crediting on this line. |
| `incentiveDetailId` | `int?` |  | The id of the incentive-detail row applied to this line. |
| `packagesCount` | `int?` |  | The number of physical packages represented by the line quantity. |

### `WorkOrderResponse`

Response describing a work order (Issue Offering, Receive Supplies, Receive Returns, or Opening Balance).

| field | type | description |
|---|---|---|
| `id` | `int` | The work-order id. |
| `type` | `DocumentType?` | The document type (e.g. IssueOffering, ReceiveSupplies). |
| `date` | `DateTime?` | The document date. |
| `serial` | `int?` | The auto-generated serial number. |
| `code` | `string` | The document code (unique per tenant). |
| `paperNumber` | `string` | The paper number printed on the source document. |
| `notes` | `string` | Free-form notes captured on the document. |
| `warehouse` | `WarehouseReference` | The source warehouse the items are moved from. |
| `destinationWarehouse` | `WarehouseReference` | The destination warehouse for internal-transfer documents. |
| `workOrderOtherPartyId` | `int?` | The id of the other party (legacy free-text party id). |
| `workOrderResponsibleId` | `int?` | The id of the responsible user for the document. |
| `customer` | `CustomerReference` | The customer (for sales-related work orders). |
| `supplier` | `SupplierReference` | The supplier (for purchase-related work orders). |
| `salesPerson` | `SalesPersonReference` | The sales person credited (for sales-related work orders). |
| `purchasePersonId` | `int?` | The id of the purchase person (for purchase-related work orders). |
| `currency` | `CurrencyReference` | The document currency. |
| `exchangeRate` | `decimal?` | The exchange rate against the system currency at the document date. |
| `status` | `WorkOrderStatus?` | The current document status. |
| `rejectReason` | `string` | The rejection reason when the document was rejected. |
| `relatedWorkOrderHeaderId` | `int?` | The id of the related work-order header, when one exists. |
| `externalId` | `string` | An external identifier supplied by the caller for reconciliation. |
| `isRelatedOrderFullfilled` | `bool?` | Whether the related sales/purchase order has been fully fulfilled. |
| `incentiveID` | `int?` | The id of the incentive plan attached to this document. |
| `isAutoWorkOrder` | `bool?` | Whether the work order was auto-generated by an issued sales order. |
| `workOrderDetails` | `List<WorkOrderItemResponse>` | The line items on the work order. |

### `WorkOrderStatus`

Work-order status values for the v3 API contract.

Values (sent/returned as the name): `Pending`=0, `Accepted`=1, `Released`=2, `Rejected`=3
