# Quality and Andon (/docs/guides/quality-and-andon)



## Quality checks [#quality-checks]

Log a quality check against a production order:

```bash
curl -X POST https://api.xentr.ai/api/factories/[factory-slug]/quality/checks \
  -H "Authorization: Bearer $XENTR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "productionOrderId": "a1b2c3d4-...",
    "result": "pass",
    "notes": "Dimensional check OK, ±0.02mm"
  }'
```

## Log a defect [#log-a-defect]

```bash
curl -X POST https://api.xentr.ai/api/factories/[factory-slug]/quality/defects \
  -H "Authorization: Bearer $XENTR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "productionOrderId": "a1b2c3d4-...",
    "category": "dimensional",
    "severity": "minor",
    "quantity": 3,
    "notes": "Surface finish out of spec"
  }'
```

Defects deduct automatically from the order's `quantityGood` count and feed into OEE's Quality pillar.

## Andon [#andon]

Andon calls are escalation signals from the shop floor. Raise one when a machine needs attention:

```bash
curl -X POST https://api.xentr.ai/api/factories/[factory-slug]/andon \
  -H "Authorization: Bearer $XENTR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "machineCode": "CNC-001",
    "reason": "tooling_change",
    "priority": "high"
  }'
```

Escalations route via notifications (in-app + email) based on factory rules. Use the [Andon API](/docs/api-reference/andon) to list active calls, acknowledge, or resolve.

## Real-time [#real-time]

For shop-floor displays (TV dashboards), subscribe to the Supabase realtime channel `andon:<factoryId>` for live call updates instead of polling.
