# Update a defect category (edit or deactivate) (/docs/api-reference/quality/QualityController_updateDefectCategory)

`PATCH /api/factories/{factoryId}/quality/defect-categories/{id}`

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 | Category ID |

## Request body

Required.

Content type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Stable category code stored on defect codes."
    },
    "name": {
      "type": "string",
      "description": "Display name."
    },
    "color": {
      "type": "string",
      "description": "Hex colour for chips / charts.",
      "example": "#3b82f6"
    },
    "sortOrder": {
      "type": "number",
      "description": "Sort order (lower first).",
      "example": 10
    },
    "isActive": {
      "type": "boolean",
      "description": "Set false to archive the category."
    }
  }
}
```

## Responses

### 200