# Create a new production order (/docs/api-reference/production-orders/ProductionOrdersController_create)

`POST /api/factories/{factoryId}/production-orders`

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

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

## Parameters

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

## Request body

Required.

Content type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "productId": {
      "type": "string",
      "description": "Product ID",
      "example": "a1b2c3d4-..."
    },
    "productName": {
      "type": "string",
      "description": "Product name for display",
      "example": "Widget A"
    },
    "batchNumber": {
      "type": "string",
      "description": "Customer's own batch identifier (free text, e.g. 'M062026-UBH')",
      "example": "M062026-UBH"
    },
    "methodId": {
      "type": "string",
      "description": "Production method ID"
    },
    "quantityTarget": {
      "type": "number",
      "description": "Target quantity to produce. Must be positive. Accepts decimals for measure-unit products (kg, L, m); integer for count-based products.",
      "example": 1000
    },
    "plannedStart": {
      "type": "string",
      "description": "Planned start date",
      "example": "2026-04-15T08:00:00Z"
    },
    "plannedEnd": {
      "type": "string",
      "description": "Planned end date",
      "example": "2026-04-20T17:00:00Z"
    },
    "shipDate": {
      "type": "string",
      "description": "Shipment date",
      "example": "2026-04-25T00:00:00Z"
    },
    "parentOrderId": {
      "type": "string",
      "description": "Parent order ID for sub-orders"
    },
    "createdBy": {
      "type": "string",
      "description": "User who created the order"
    },
    "priority": {
      "type": "string",
      "description": "Order priority",
      "enum": [
        "standard",
        "rush"
      ],
      "example": "standard"
    }
  },
  "required": [
    "productId",
    "quantityTarget"
  ]
}
```

## Responses

### 201: Production order created