# Log a scrap event while the order is running (/docs/api-reference/production-orders/ProductionOrdersController_logScrapEvent)

`POST /api/factories/{factoryId}/production-orders/{id}/scrap-event`

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": {
    "quantity": {
      "type": "number",
      "description": "Scrap quantity (parts)",
      "example": 25
    },
    "reason": {
      "type": "string",
      "description": "Reason code",
      "enum": [
        "tool_wear",
        "material_defect",
        "machine_drift",
        "operator_error",
        "first_article",
        "quality_hold",
        "other"
      ],
      "example": "tool_wear"
    },
    "notes": {
      "type": "string",
      "description": "Free-text notes"
    },
    "loggedBy": {
      "type": "string",
      "description": "Actor (QA user) id"
    }
  },
  "required": [
    "quantity",
    "reason"
  ]
}
```

## Responses

### 201: Scrap event logged