> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.supay.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.supay.dev/_mcp/server.

# 24 · Nota de Crédito-Débito

Ajustes con crédito fiscal por DocumentoAjuste. **Dos layouts**: el clásico
(`nota_credito_debito`) y el fiscal (`nota_fiscal_credito_debito`), elegidos con
`layout`. Exige `reference_invoice_id` del mismo tenant y cliente. Ver también:
[47 · Descuentos](/sectores/documentos-de-ajuste/47-nota-descuentos) · [29 · Conciliación](/sectores/documentos-de-ajuste/29-conciliacion).

## Cabecera (`data`)

| Campo                            | Tipo       | Obligatorio | Qué significa                  |
| -------------------------------- | ---------- | ----------- | ------------------------------ |
| `monto_descuento_credito_debito` | number     | Ver perfil  | Descuento del ajuste           |
| `monto_total_devuelto`           | number     | Ver perfil  | Total devuelto                 |
| `monto_efectivo_credito_debito`  | number     | No          | Override del crédito calculado |
| `numero_nota_credito_debito`     | string/int | Ver perfil  | Número del documento           |

## Detalle (`items[].data`)

Líneas estándar (sin campos sectoriales propios).

#### SDK TypeScript

```typescript
const nota = await supay.invoices.emit({
  point_of_sale_id: pos.id,
  customer: {
    document_type: "CI",
    document_number: "9971522",
    name: "Ramiro",
  },

  // Ajuste con layout explícito
  invoice_type: "credit_note",
  sector: "24",
  layout: "nota_fiscal_credito_debito",
  reference_invoice_id: "b61d67ed-7962-4989-958f-8ccc01979d64",

  // SKU de la factura ORIGINAL
  items: [
    {
      sku: "PROD-001",
      quantity: 1,
      price: 1250,
      discount: 0,
    },
  ],

});
```

#### REST API

```bash
curl -s -X POST "$BASE/v1/invoices/emit" \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "point_of_sale_id": "'$POS'",
    "customer": {
      "document_type": "CI",
      "document_number": "9971522",
      "name": "Ramiro"
    },
    "invoice_type": "credit_note",
    "sector": "24",
    "layout": "nota_fiscal_credito_debito",
    "reference_invoice_id": "b61d67ed-7962-4989-958f-8ccc01979d64",
    "items": [
      {
        "sku": "PROD-001",
        "quantity": 1,
        "price": 1250,
        "discount": 0
      }
    ]
  }' | jq '{id, status}'
```

## Errores típicos

| Situación                  | Respuesta                    |
| -------------------------- | ---------------------------- |
| Sin `reference_invoice_id` | `400 VALIDATION_ERROR`       |
| Sin `layout` (ambigüedad)  | `400` — elige uno de los dos |

> **Warning**
>
> `POST /siat/documento-ajuste/{pos}` está **deprecado**: emite siempre las notas
> por invoices (esta página), nunca directo al SIAT.