# Adjust the target quantity on an active order (audited; requires a reason, cascades to sub-orders, warns on material shortfall / below-produced) (/docs/api-reference/production-orders/ProductionOrdersController_adjustQuantity)

`POST /api/factories/{factoryId}/production-orders/{id}/adjust-quantity`

Base URL: https://api.xentr.ai

Authentication: bearer token (`Authorization: Bearer <token>`).

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `factoryId` | path | yes | string | Factory ID |
| `id` | path | yes | string | Production Order ID |

## Request body

Required.

Content type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "quantityTarget": {
      "type": "number",
      "description": "New target quantity for the order",
      "example": 1500
    },
    "reason": {
      "type": "string",
      "description": "Reason for the change (recorded in the audit log)",
      "example": "Customer added 500 units to the order"
    },
    "expectedVersion": {
      "type": "number",
      "description": "Order version the client last saw (optimistic concurrency). Omit to accept the current version."
    },
    "allocations": {
      "description": "Per-machine allocation of the new target. Required when 2+ active sibling sub-orders exist; the assignments must cover every active leg and sum to quantityTarget.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "subOrderId": {
            "type": "string",
            "description": "Sub-order (machine leg) id"
          },
          "quantityAssigned": {
            "type": "number",
            "description": "Quantity assigned to this leg",
            "example": 600
          }
        },
        "required": [
          "subOrderId",
          "quantityAssigned"
        ]
      }
    },
    "acknowledgements": {
      "description": "Acknowledge non-blocking warnings (material shortfall / below already-produced) to apply despite them.",
      "allOf": [
        {
          "type": "object",
          "properties": {
            "materialShortfall": {
              "type": "boolean",
              "description": "Proceed despite a raw-material shortfall at the new target"
            },
            "belowProduced": {
              "type": "boolean",
              "description": "Proceed despite the new total/assignment being below what is already produced"
            }
          }
        }
      ]
    }
  },
  "required": [
    "quantityTarget",
    "reason"
  ]
}
```

## Responses

### 200: Quantity adjusted

### 400: Invalid state or allocation

### 404: Production order not found

### 409: Version conflict — order changed since loaded

### 422: Unacknowledged warnings — resubmit with acknowledgements